winex11.drv: SetDIBits fails when startscan != 0
Massimo Del Fedele
max at veneto.com
Mon Mar 16 17:05:40 CDT 2009
---
dlls/winex11.drv/dib.c | 8 +++++---
1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c
index 6df4137..42d9082 100644
--- a/dlls/winex11.drv/dib.c
+++ b/dlls/winex11.drv/dib.c
@@ -3927,6 +3927,7 @@ INT CDECL X11DRV_SetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT start
X11DRV_DIB_IMAGEBITS_DESCR descr;
DIBSECTION ds;
LONG width, height, tmpheight;
+ LONG widthBytes;
INT result;
descr.physDev = physDev;
@@ -3936,6 +3937,7 @@ INT CDECL X11DRV_SetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT start
if (DIB_GetBitmapInfo( &info->bmiHeader, &width, &height,
&descr.infoBpp, &descr.compression ) == -1)
return 0;
+ widthBytes = ((width * descr.infoBpp +31) &~31) / 8;
tmpheight = height;
if (height < 0) height = -height;
@@ -3977,7 +3979,7 @@ INT CDECL X11DRV_SetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT start
default: break;
}
- descr.bits = bits;
+ descr.bits = (BYTE *)bits + widthBytes * (tmpheight > 0 ? (height - startscan - lines) : startscan);
descr.image = NULL;
descr.palentry = NULL;
descr.infoWidth = width;
@@ -3988,11 +3990,11 @@ INT CDECL X11DRV_SetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT start
descr.xSrc = 0;
descr.ySrc = 0;
descr.xDest = 0;
- descr.yDest = height - startscan - lines;
+ descr.yDest = 0;
descr.width = ds.dsBm.bmWidth;
descr.height = lines;
descr.useShm = FALSE;
- descr.dibpitch = ((descr.infoWidth * descr.infoBpp + 31) &~31) / 8;
+ descr.dibpitch = widthBytes;
X11DRV_DIB_Lock( physBitmap, DIB_Status_GdiMod );
result = X11DRV_DIB_SetImageBits( &descr );
--
1.5.6.3
--------------020208070302050603080601--
More information about the wine-patches
mailing list