winex11.drv: Correctly handle overlapping source and destination regions on the same DIB when copying DIBs client-side.

This commit is contained in:
Damjan Jovanovic 2007-08-11 10:46:08 +02:00 committed by Alexandre Julliard
parent 28ca9a8658
commit 28ddfe802e
1 changed files with 10 additions and 1 deletions

View File

@ -1623,9 +1623,18 @@ static BOOL X11DRV_ClientSideDIBCopy( X11DRV_PDEVICE *physDevSrc, INT xSrc, INT
dstRowOffset = -dstDib.dsBm.bmWidthBytes;
}
/* Handle overlapping regions on the same DIB */
if (physDevSrc == physDevDst && ySrc < yDst)
{
srcPtr += srcRowOffset * (height - 1);
srcRowOffset = -srcRowOffset;
dstPtr += dstRowOffset * (height - 1);
dstRowOffset = -dstRowOffset;
}
for (y = yDst; y < yDst + height; ++y)
{
memcpy(dstPtr, srcPtr, bytesToCopy);
memmove(dstPtr, srcPtr, bytesToCopy);
srcPtr += srcRowOffset;
dstPtr += dstRowOffset;
}