mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-24 17:49:52 +01:00
remove duplicate code
This commit is contained in:
parent
f4a403f434
commit
5ad539bbb4
78
src/blt.c
78
src/blt.c
@ -385,7 +385,13 @@ void blt_colorfill(
|
|||||||
|
|
||||||
dst += (dst_x * bytes_pp) + (dst_p * dst_y);
|
dst += (dst_x * bytes_pp) + (dst_p * dst_y);
|
||||||
|
|
||||||
if (bpp == 8)
|
if (bpp == 8 ||
|
||||||
|
(bpp == 16 &&
|
||||||
|
(color & 0xFF) == ((color >> 8) & 0xFF)) ||
|
||||||
|
(bpp == 32 &&
|
||||||
|
(color & 0xFF) == ((color >> 8) & 0xFF) &&
|
||||||
|
(color & 0xFF) == ((color >> 16) & 0xFF) &&
|
||||||
|
(color & 0xFF) == ((color >> 24) & 0xFF)))
|
||||||
{
|
{
|
||||||
if (size == dst_p)
|
if (size == dst_p)
|
||||||
{
|
{
|
||||||
@ -402,70 +408,32 @@ void blt_colorfill(
|
|||||||
}
|
}
|
||||||
else if (bpp == 16)
|
else if (bpp == 16)
|
||||||
{
|
{
|
||||||
if ((color & 0xFF) == ((color >> 8) & 0xFF))
|
unsigned short* first_row = (unsigned short*)dst;
|
||||||
|
|
||||||
|
for (int x = 0; x < dst_w; x++)
|
||||||
{
|
{
|
||||||
if (size == dst_p)
|
first_row[x] = (unsigned short)color;
|
||||||
{
|
|
||||||
memset(dst, color, dst_p * dst_h);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int i = 0; i < dst_h; i++)
|
|
||||||
{
|
|
||||||
memset(dst, color, size);
|
|
||||||
dst += dst_p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
for (int i = 1; i < dst_h; i++)
|
||||||
{
|
{
|
||||||
unsigned short* first_row = (unsigned short*)dst;
|
dst += dst_p;
|
||||||
|
memcpy(dst, first_row, size);
|
||||||
for (int x = 0; x < dst_w; x++)
|
|
||||||
{
|
|
||||||
first_row[x] = (unsigned short)color;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 1; i < dst_h; i++)
|
|
||||||
{
|
|
||||||
dst += dst_p;
|
|
||||||
memcpy(dst, first_row, size);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (bpp == 32)
|
else if (bpp == 32)
|
||||||
{
|
{
|
||||||
if ((color & 0xFF) == ((color >> 8) & 0xFF) &&
|
unsigned int* first_row = (unsigned int*)dst;
|
||||||
(color & 0xFF) == ((color >> 16) & 0xFF) &&
|
|
||||||
(color & 0xFF) == ((color >> 24) & 0xFF))
|
for (int x = 0; x < dst_w; x++)
|
||||||
{
|
{
|
||||||
if (size == dst_p)
|
first_row[x] = color;
|
||||||
{
|
|
||||||
memset(dst, color, dst_p * dst_h);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
for (int i = 0; i < dst_h; i++)
|
|
||||||
{
|
|
||||||
memset(dst, color, size);
|
|
||||||
dst += dst_p;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
for (int i = 1; i < dst_h; i++)
|
||||||
{
|
{
|
||||||
unsigned int* first_row = (unsigned int*)dst;
|
dst += dst_p;
|
||||||
|
memcpy(dst, first_row, size);
|
||||||
for (int x = 0; x < dst_w; x++)
|
|
||||||
{
|
|
||||||
first_row[x] = color;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 1; i < dst_h; i++)
|
|
||||||
{
|
|
||||||
dst += dst_p;
|
|
||||||
memcpy(dst, first_row, size);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user