From f331fe4c2721efb40df1bc6b8ad0a25778beb80c Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Mon, 1 Mar 2010 12:39:51 +0100 Subject: [PATCH] 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 50a5a2feff2..ff90564ab73 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 bf1851959fc..7608b38c0a9 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 001836fa158..13d67e6798b 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