Sergey Khodych : winex11: BitBlt returns TRUE when drawing outside of the clipping or visible region .

Alexandre Julliard julliard at winehq.org
Thu Nov 6 08:25:57 CST 2008


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

Author: Sergey Khodych <khodych at gmail.com>
Date:   Tue Nov  4 19:59:34 2008 +0200

winex11: BitBlt returns TRUE when drawing outside of the clipping or visible region.

---

 dlls/gdi32/tests/bitmap.c |   46 +++++++++++++++++++++++++++++++++++++++++++++
 dlls/winex11.drv/bitblt.c |    3 ++
 2 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c
index 7607667..0b41f19 100644
--- a/dlls/gdi32/tests/bitmap.c
+++ b/dlls/gdi32/tests/bitmap.c
@@ -2189,6 +2189,51 @@ void test_GdiAlphaBlend()
 
 }
 
+static void test_clipping(void)
+{
+    HBITMAP bmpDst;
+    HBITMAP oldDst;
+    HBITMAP bmpSrc;
+    HBITMAP oldSrc;
+    HRGN hRgn;
+    LPVOID bits;
+    BOOL result;
+
+    HDC hdcDst = CreateCompatibleDC( NULL );
+    HDC hdcSrc = CreateCompatibleDC( NULL );
+
+    BITMAPINFO bmpinfo={{0}};
+    bmpinfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
+    bmpinfo.bmiHeader.biWidth = 100;
+    bmpinfo.bmiHeader.biHeight = 100;
+    bmpinfo.bmiHeader.biPlanes = 1;
+    bmpinfo.bmiHeader.biBitCount = GetDeviceCaps( hdcDst, BITSPIXEL );
+    bmpinfo.bmiHeader.biCompression = BI_RGB;
+
+    bmpDst = CreateDIBSection( hdcDst, &bmpinfo, DIB_RGB_COLORS, &bits, NULL, 0 );
+    ok(bmpDst != NULL, "Couldn't create destination bitmap\n");
+    oldDst = (HBITMAP)SelectObject( hdcDst, bmpDst );
+
+    bmpSrc = CreateDIBSection( hdcSrc, &bmpinfo, DIB_RGB_COLORS, &bits, NULL, 0 );
+    ok(bmpSrc != NULL, "Couldn't create source bitmap\n");
+    oldSrc = (HBITMAP)SelectObject( hdcSrc, bmpSrc );
+
+    result = BitBlt( hdcDst, 0, 0, 100, 100, hdcSrc, 100, 100, SRCCOPY );
+    ok(result, "BitBlt failed\n");
+
+    hRgn = CreateRectRgn( 0,0,0,0 );
+    SelectClipRgn( hdcDst, hRgn );
+
+    result = BitBlt( hdcDst, 0, 0, 100, 100, hdcSrc, 0, 0, SRCCOPY );
+    ok(result, "BitBlt failed\n");
+
+    DeleteObject( bmpDst );
+    DeleteObject( bmpSrc );
+    DeleteObject( hRgn );
+    DeleteDC( hdcDst );
+    DeleteDC( hdcSrc );
+}
+
 START_TEST(bitmap)
 {
     HMODULE hdll;
@@ -2214,4 +2259,5 @@ START_TEST(bitmap)
     test_GdiAlphaBlend();
     test_bitmapinfoheadersize();
     test_get16dibits();
+    test_clipping();
 }
diff --git a/dlls/winex11.drv/bitblt.c b/dlls/winex11.drv/bitblt.c
index c740b10..5b5742c 100644
--- a/dlls/winex11.drv/bitblt.c
+++ b/dlls/winex11.drv/bitblt.c
@@ -1686,7 +1686,10 @@ BOOL X11DRV_BitBlt( X11DRV_PDEVICE *physDevDst, INT xDst, INT yDst,
       if (!BITBLT_GetVisRectangles( physDevDst, xDst, yDst, width, height,
                                     physDevSrc, xSrc, ySrc, width, height,
                                     &visRectSrc, &visRectDst ))
+      {
+        result = TRUE;
         goto END;
+      }
 
       xSrc = visRectSrc.left;
       ySrc = visRectSrc.top;




More information about the wine-cvs mailing list