Commit c6fa30a2 authored by Damjan Jovanovic's avatar Damjan Jovanovic Committed by Alexandre Julliard

winex11.drv: Fix copying top-down/bottom-up DIBs.

parent 48f934ee
...@@ -1535,6 +1535,7 @@ static BOOL X11DRV_ClientSideDIBCopy( X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ...@@ -1535,6 +1535,7 @@ static BOOL X11DRV_ClientSideDIBCopy( X11DRV_PDEVICE *physDevSrc, INT xSrc, INT
{ {
DIBSECTION srcDib, dstDib; DIBSECTION srcDib, dstDib;
BYTE *srcPtr, *dstPtr; BYTE *srcPtr, *dstPtr;
INT srcRowOffset, dstRowOffset;
INT bytesPerPixel; INT bytesPerPixel;
INT bytesToCopy; INT bytesToCopy;
INT y; INT y;
...@@ -1574,11 +1575,6 @@ static BOOL X11DRV_ClientSideDIBCopy( X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ...@@ -1574,11 +1575,6 @@ static BOOL X11DRV_ClientSideDIBCopy( X11DRV_PDEVICE *physDevSrc, INT xSrc, INT
FIXME("potential optimization: client-side compressed DIB copy\n"); FIXME("potential optimization: client-side compressed DIB copy\n");
return FALSE; return FALSE;
} }
if (srcDib.dsBmih.biHeight < 0 || dstDib.dsBmih.biHeight < 0)
{
FIXME("potential optimization: client-side bottom-up DIB copy\n");
return FALSE;
}
switch (dstDib.dsBm.bmBitsPixel) switch (dstDib.dsBm.bmBitsPixel)
{ {
...@@ -1599,14 +1595,34 @@ static BOOL X11DRV_ClientSideDIBCopy( X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ...@@ -1599,14 +1595,34 @@ static BOOL X11DRV_ClientSideDIBCopy( X11DRV_PDEVICE *physDevSrc, INT xSrc, INT
bytesToCopy = width * bytesPerPixel; bytesToCopy = width * bytesPerPixel;
srcPtr = &physDevSrc->bitmap->base[ySrc*srcDib.dsBm.bmWidthBytes + xSrc*bytesPerPixel]; if (srcDib.dsBmih.biHeight < 0)
dstPtr = &physDevDst->bitmap->base[yDst*dstDib.dsBm.bmWidthBytes + xDst*bytesPerPixel]; {
srcPtr = &physDevSrc->bitmap->base[ySrc*srcDib.dsBm.bmWidthBytes + xSrc*bytesPerPixel];
srcRowOffset = srcDib.dsBm.bmWidthBytes;
}
else
{
srcPtr = &physDevSrc->bitmap->base[(srcDib.dsBm.bmWidth-ySrc-1)*srcDib.dsBm.bmWidthBytes
+ xSrc*bytesPerPixel];
srcRowOffset = -srcDib.dsBm.bmWidthBytes;
}
if (dstDib.dsBmih.biHeight < 0)
{
dstPtr = &physDevDst->bitmap->base[yDst*dstDib.dsBm.bmWidthBytes + xDst*bytesPerPixel];
dstRowOffset = dstDib.dsBm.bmWidthBytes;
}
else
{
dstPtr = &physDevDst->bitmap->base[(dstDib.dsBm.bmWidth-yDst-1)*dstDib.dsBm.bmWidthBytes
+ xDst*bytesPerPixel];
dstRowOffset = -dstDib.dsBm.bmWidthBytes;
}
for (y = yDst; y < yDst + height; ++y) for (y = yDst; y < yDst + height; ++y)
{ {
memcpy(dstPtr, srcPtr, bytesToCopy); memcpy(dstPtr, srcPtr, bytesToCopy);
srcPtr += srcDib.dsBm.bmWidthBytes; srcPtr += srcRowOffset;
dstPtr += dstDib.dsBm.bmWidthBytes; dstPtr += dstRowOffset;
} }
return TRUE; return TRUE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment