Michael Karcher : winex11: Fix GetDIBits of 1 bit DDBs.

Alexandre Julliard julliard at winehq.org
Tue Jul 1 08:27:54 CDT 2008


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

Author: Michael Karcher <wine at mkarcher.dialup.fu-berlin.de>
Date:   Sun Jun 29 13:30:21 2008 +0200

winex11: Fix GetDIBits of 1 bit DDBs.

1 bpp DDBs seem to always carry an implicit palette of black and white,
regardless of what the DC says. Based on a patch from Eric Pouech.

---

 dlls/gdi32/tests/bitmap.c |    5 +----
 dlls/winex11.drv/dib.c    |   15 +++++++++++++--
 2 files changed, 14 insertions(+), 6 deletions(-)

diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c
index 9a7213c..4c4abe0 100644
--- a/dlls/gdi32/tests/bitmap.c
+++ b/dlls/gdi32/tests/bitmap.c
@@ -1190,10 +1190,7 @@ static void test_GetDIBits_selected_DIB(UINT bpp)
             break;
         }
     }
-    if (bpp != 1)
-        ok(equalContents, "GetDIBits with %d bpp DIB selected in DC: Invalid DIB bits\n",bpp);
-    else
-        todo_wine ok(equalContents, "GetDIBits with %d bpp DIB selected in DC: Invalid DIB bits\n",bpp);
+    ok(equalContents, "GetDIBits with %d bpp DIB selected in DC: Invalid DIB bits\n",bpp);
 
     HeapFree(GetProcessHeap(), 0, bits2);
     DeleteDC(dc);
diff --git a/dlls/winex11.drv/dib.c b/dlls/winex11.drv/dib.c
index 4b287ea..8988428 100644
--- a/dlls/winex11.drv/dib.c
+++ b/dlls/winex11.drv/dib.c
@@ -4031,13 +4031,24 @@ INT X11DRV_GetDIBits( X11DRV_PDEVICE *physDev, HBITMAP hbitmap, UINT startscan,
   int bitmap_type;
   BOOL core_header;
   void* colorPtr;
-
-  GetPaletteEntries( GetCurrentObject( physDev->hdc, OBJ_PAL ), 0, 256, palette );
+  const PALETTEENTRY peBlack = {0,0,0,0};
+  const PALETTEENTRY peWhite = {255,255,255,0};
 
   if (!physBitmap) return 0;
   if (!(obj_size = GetObjectW( hbitmap, sizeof(dib), &dib ))) return 0;
 
   bitmap_type = DIB_GetBitmapInfo( (BITMAPINFOHEADER*)info, &width, &tempHeight, &descr.infoBpp, &descr.compression);
+
+  if (physDev->depth > 1)
+  {
+    GetPaletteEntries( GetCurrentObject( physDev->hdc, OBJ_PAL ), 0, 256, palette );
+  }
+  else
+  {
+    palette[0] = peBlack;
+    palette[1] = peWhite;
+  }
+
   if (bitmap_type == -1)
   {
       ERR("Invalid bitmap\n");




More information about the wine-cvs mailing list