winex11.drv: Fix copying top-down/bottom-up DIBs.
This commit is contained in:
parent
48f934ee96
commit
c6fa30a2cf
|
@ -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
|
||||||
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
|
||||||
|
|
||||||
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;
|
||||||
|
|
Loading…
Reference in New Issue