mirror of
https://github.com/FunkyFr3sh/cnc-ddraw.git
synced 2025-03-24 17:49:52 +01:00
improve DDBLT_COLORFILL performance - fill only the first row and then copy first row into the remaining rows
This commit is contained in:
parent
20205db5d5
commit
d00b95f8b0
@ -147,31 +147,25 @@ HRESULT __stdcall ddraw_surface_Blt(IDirectDrawSurfaceImpl *This, LPRECT lpDestR
|
|||||||
|
|
||||||
if (This->surface && (dwFlags & DDBLT_COLORFILL))
|
if (This->surface && (dwFlags & DDBLT_COLORFILL))
|
||||||
{
|
{
|
||||||
|
unsigned char *dst = (unsigned char *)This->surface + (dst_x * This->lXPitch) + (This->lPitch * dst_y);
|
||||||
|
unsigned char *firstRow = dst;
|
||||||
|
int x, i;
|
||||||
|
|
||||||
if (This->bpp == 8)
|
if (This->bpp == 8)
|
||||||
{
|
{
|
||||||
int y, x;
|
for (x = 0; x < dst_w; x++)
|
||||||
for (y = 0; y < dst_h; y++)
|
((unsigned char *)dst)[x] = lpDDBltFx->dwFillColor;
|
||||||
{
|
|
||||||
int ydst = This->width * (y + dst_y);
|
|
||||||
|
|
||||||
for (x = 0; x < dst_w; x++)
|
|
||||||
{
|
|
||||||
((unsigned char *)This->surface)[x + dst_x + ydst] = lpDDBltFx->dwFillColor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else if (This->bpp == 16)
|
else if (This->bpp == 16)
|
||||||
{
|
{
|
||||||
int y, x;
|
for (x = 0; x < dst_w; x++)
|
||||||
for (y = 0; y < dst_h; y++)
|
((unsigned short *)dst)[x] = lpDDBltFx->dwFillColor;
|
||||||
{
|
}
|
||||||
int ydst = This->width * (y + dst_y);
|
|
||||||
|
|
||||||
for (x = 0; x < dst_w; x++)
|
for (i = 1; i < dst_h; i++)
|
||||||
{
|
{
|
||||||
((unsigned short *)This->surface)[x + dst_x + ydst] = lpDDBltFx->dwFillColor;
|
dst += This->lPitch;
|
||||||
}
|
memcpy(dst, firstRow, dst_w * This->lXPitch);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user