wined3d: BltFast dealing correctly with overlapping src and dest.

This commit is contained in:
Luis Javier Merino 2008-03-19 03:44:37 +01:00 committed by Alexandre Julliard
parent 03f18eb425
commit 3bb1ea3d34
1 changed files with 18 additions and 3 deletions

View File

@ -1613,13 +1613,28 @@ IWineD3DBaseSurfaceImpl_BltFast(IWineD3DSurface *iface,
else else
{ {
int width = w * bpp; int width = w * bpp;
INT sbufpitch, dbufpitch;
TRACE("NO color key copy\n"); TRACE("NO color key copy\n");
/* Handle overlapping surfaces */
if (sbuf < dbuf)
{
sbuf += (h - 1) * slock.Pitch;
dbuf += (h - 1) * dlock.Pitch;
sbufpitch = -slock.Pitch;
dbufpitch = -dlock.Pitch;
}
else
{
sbufpitch = slock.Pitch;
dbufpitch = dlock.Pitch;
}
for (y = 0; y < h; y++) for (y = 0; y < h; y++)
{ {
/* This is pretty easy, a line for line memcpy */ /* This is pretty easy, a line for line memcpy */
memcpy(dbuf, sbuf, width); memmove(dbuf, sbuf, width);
sbuf += slock.Pitch; sbuf += sbufpitch;
dbuf += dlock.Pitch; dbuf += dbufpitch;
} }
TRACE("Copy done\n"); TRACE("Copy done\n");
} }