Henri Verbeet : winex11.drv: Store if a bitmap is top-down in X_PHYSBITMAP.

Alexandre Julliard julliard at winehq.org
Mon Mar 1 09:27:36 CST 2010


Module: wine
Branch: master
Commit: f331fe4c2721efb40df1bc6b8ad0a25778beb80c
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=f331fe4c2721efb40df1bc6b8ad0a25778beb80c

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Mon Mar  1 12:39:51 2010 +0100

winex11.drv: Store if a bitmap is top-down in X_PHYSBITMAP.

GetObject() is supposed to return the absolute height, and there's no other
way to retrieve this information after the bitmap is created.

---

 dlls/winex11.drv/bitblt.c |    4 ++--
 dlls/winex11.drv/dib.c    |    5 +++++
 dlls/winex11.drv/x11drv.h |    1 +
 3 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c
index 50a5a2f..ff90564 100644
--- a/dlls/winex11.drv/bitblt.c
+++ b/dlls/winex11.drv/bitblt.c
@@ -1308,7 +1308,7 @@ static BOOL client_side_dib_copy( X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc
 
     bytesToCopy = width * bytesPerPixel;
 
-    if (srcDib.dsBmih.biHeight < 0)
+    if (physDevSrc->bitmap->topdown)
     {
       srcPtr = &physDevSrc->bitmap->base[ySrc*srcDib.dsBm.bmWidthBytes + xSrc*bytesPerPixel];
       srcRowOffset = srcDib.dsBm.bmWidthBytes;
@@ -1319,7 +1319,7 @@ static BOOL client_side_dib_copy( X11DRV_PDEVICE *physDevSrc, INT xSrc, INT ySrc
         + xSrc*bytesPerPixel];
       srcRowOffset = -srcDib.dsBm.bmWidthBytes;
     }
-    if (dstDib.dsBmih.biHeight < 0)
+    if (physDevDst->bitmap->topdown)
     {
       dstPtr = &physDevDst->bitmap->base[yDst*dstDib.dsBm.bmWidthBytes + xDst*bytesPerPixel];
       dstRowOffset = dstDib.dsBm.bmWidthBytes;
diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c
index bf18519..7608b38 100644
--- a/dlls/winex11.drv/dib.c
+++ b/dlls/winex11.drv/dib.c
@@ -4726,12 +4726,17 @@ HBITMAP CDECL X11DRV_CreateDIBSection( X11DRV_PDEVICE *physDev, HBITMAP hbitmap,
 {
     X_PHYSBITMAP *physBitmap;
     DIBSECTION dib;
+    WORD bpp, compr;
+    LONG w, h;
 #ifdef HAVE_LIBXXSHM
     int major, minor;
     Bool pixmaps;
 #endif
 
+    DIB_GetBitmapInfo( &bmi->bmiHeader, &w, &h, &bpp, &compr );
+
     if (!(physBitmap = X11DRV_init_phys_bitmap( hbitmap ))) return 0;
+    if (h < 0) physBitmap->topdown = TRUE;
     physBitmap->status = DIB_Status_None;
 
     GetObjectW( hbitmap, sizeof(dib), &dib );
diff --git a/dlls/winex11.drv/x11drv.h b/dlls/winex11.drv/x11drv.h
index 001836f..13d67e6 100644
--- a/dlls/winex11.drv/x11drv.h
+++ b/dlls/winex11.drv/x11drv.h
@@ -127,6 +127,7 @@ typedef struct
     int         *colorMap;          /* color map info */
     int          nColorMap;
     BOOL         trueColor;
+    BOOL         topdown;
     CRITICAL_SECTION lock;          /* GDI access lock */
     enum x11drv_shm_mode shm_mode;
 #ifdef HAVE_LIBXXSHM




More information about the wine-cvs mailing list