mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-24 17:49:52 +01:00
use memset for DDBLT_COLORFILL
This commit is contained in:
parent
32fff11093
commit
f41b2fc177
@ -166,30 +166,45 @@ HRESULT __stdcall ddraw_surface_Blt(IDirectDrawSurfaceImpl *This, LPRECT lpDestR
|
|||||||
{
|
{
|
||||||
unsigned char *dst = (unsigned char *)This->surface + (dst_x * This->lXPitch) + (This->lPitch * dst_y);
|
unsigned char *dst = (unsigned char *)This->surface + (dst_x * This->lXPitch) + (This->lPitch * dst_y);
|
||||||
unsigned char *firstRow = dst;
|
unsigned char *firstRow = dst;
|
||||||
|
unsigned int dst_pitch = dst_w * This->lXPitch;
|
||||||
int x, i;
|
int x, i;
|
||||||
|
|
||||||
if (This->bpp == 8)
|
if (This->bpp == 8)
|
||||||
{
|
{
|
||||||
unsigned char color = (unsigned char)lpDDBltFx->dwFillColor;
|
unsigned char color = (unsigned char)lpDDBltFx->dwFillColor;
|
||||||
|
|
||||||
for (x = 0; x < dst_w; x++)
|
for (i = 0; i < dst_h; i++)
|
||||||
firstRow[x] = color;
|
{
|
||||||
|
memset(dst, color, dst_pitch);
|
||||||
|
dst += This->lPitch;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (This->bpp == 16)
|
else if (This->bpp == 16)
|
||||||
{
|
{
|
||||||
unsigned short *row1 = (unsigned short *)dst;
|
unsigned short *row1 = (unsigned short *)dst;
|
||||||
unsigned short color = (unsigned short)lpDDBltFx->dwFillColor;
|
unsigned short color = (unsigned short)lpDDBltFx->dwFillColor;
|
||||||
|
|
||||||
for (x = 0; x < dst_w; x++)
|
if ((color & 0xFF) == (color >> 8))
|
||||||
row1[x] = color;
|
{
|
||||||
}
|
unsigned char c8 = (unsigned char)(color & 0xFF);
|
||||||
|
|
||||||
unsigned int widthInBytes = dst_w * This->lXPitch;
|
for (i = 0; i < dst_h; i++)
|
||||||
|
{
|
||||||
|
memset(dst, c8, dst_pitch);
|
||||||
|
dst += This->lPitch;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
for (x = 0; x < dst_w; x++)
|
||||||
|
row1[x] = color;
|
||||||
|
|
||||||
for (i = 1; i < dst_h; i++)
|
for (i = 1; i < dst_h; i++)
|
||||||
{
|
{
|
||||||
dst += This->lPitch;
|
dst += This->lPitch;
|
||||||
memcpy(dst, firstRow, widthInBytes);
|
memcpy(dst, firstRow, dst_pitch);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user