Alexandre Julliard : x11drv: Clear new bitmaps if they don' t contain any data.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Mar 20 15:36:20 CST 2006


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Mon Mar 20 16:00:34 2006 +0100

x11drv: Clear new bitmaps if they don't contain any data.

---

 dlls/gdi/tests/gdiobj.c |    2 --
 dlls/x11drv/bitmap.c    |   11 +++++++++++
 2 files changed, 11 insertions(+), 2 deletions(-)

diff --git a/dlls/gdi/tests/gdiobj.c b/dlls/gdi/tests/gdiobj.c
index ec4d2d4..4de266c 100644
--- a/dlls/gdi/tests/gdiobj.c
+++ b/dlls/gdi/tests/gdiobj.c
@@ -1034,9 +1034,7 @@ static void test_bitmap(void)
     memset(buf, 0xAA, sizeof(buf));
     ret = GetBitmapBits(hbmp, sizeof(buf), buf);
     ok(ret == bm.bmWidthBytes * bm.bmHeight, "%d != %d\n", ret, bm.bmWidthBytes * bm.bmHeight);
-todo_wine {
     ok(!memcmp(buf, buf_cmp, sizeof(buf)), "buffers do not match\n");
-}
 
     hbmp_old = SelectObject(hdc, hbmp_old);
     ok(hbmp_old == hbmp, "wrong old bitmap %p\n", hbmp_old);
diff --git a/dlls/x11drv/bitmap.c b/dlls/x11drv/bitmap.c
index b2e7718..060102f 100644
--- a/dlls/x11drv/bitmap.c
+++ b/dlls/x11drv/bitmap.c
@@ -146,7 +146,18 @@ BOOL X11DRV_CreateBitmap( X11DRV_PDEVICE
     }
 
     if (bitmap.bmBits) /* Set bitmap bits */
+    {
         X11DRV_SetBitmapBits( hbitmap, bitmap.bmBits, bitmap.bmHeight * bitmap.bmWidthBytes );
+    }
+    else  /* else clear the bitmap */
+    {
+        wine_tsx11_lock();
+        XSetFunction( gdi_display, BITMAP_GC(physBitmap), GXclear );
+        XFillRectangle( gdi_display, physBitmap->pixmap, BITMAP_GC(physBitmap), 0, 0,
+                        bitmap.bmWidth, bitmap.bmHeight );
+        XSetFunction( gdi_display, BITMAP_GC(physBitmap), GXcopy );
+        wine_tsx11_unlock();
+    }
     return TRUE;
 }
 




More information about the wine-cvs mailing list