Alexandre Julliard : gdi32: Clip the returned DC bounds to the device rectangle.

Alexandre Julliard julliard at winehq.org
Tue Apr 10 13:52:33 CDT 2012


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Tue Apr 10 13:34:25 2012 +0200

gdi32: Clip the returned DC bounds to the device rectangle.

---

 dlls/gdi32/dc.c       |    4 ++++
 dlls/gdi32/tests/dc.c |    1 -
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/dlls/gdi32/dc.c b/dlls/gdi32/dc.c
index 1e0ac10..aee02c4 100644
--- a/dlls/gdi32/dc.c
+++ b/dlls/gdi32/dc.c
@@ -1318,6 +1318,10 @@ UINT WINAPI GetBoundsRect(HDC hdc, LPRECT rect, UINT flags)
     {
         *rect = dc->BoundsRect;
         ret = is_rect_empty( rect ) ? DCB_RESET : DCB_SET;
+        rect->left = max( rect->left, 0 );
+        rect->top = max( rect->top, 0 );
+        rect->right = min( rect->right, dc->vis_rect.right - dc->vis_rect.left );
+        rect->bottom = min( rect->bottom, dc->vis_rect.bottom - dc->vis_rect.top );
         DPtoLP( hdc, (POINT *)rect, 2 );
     }
     if (flags & DCB_RESET)
diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c
index e2ec28c..5536abf 100644
--- a/dlls/gdi32/tests/dc.c
+++ b/dlls/gdi32/tests/dc.c
@@ -930,7 +930,6 @@ static void test_boundsrect(void)
     ret = GetBoundsRect( hdc, &rect, 0 );
     ok( ret == DCB_SET, "GetBoundsRect returned %x\n", ret );
     SetRect( &expect, 6, 6, 1, 1 );
-    todo_wine
     ok( EqualRect(&rect, &expect), "Got (%d,%d)-(%d,%d)\n", rect.left, rect.top, rect.right, rect.bottom );
     SetBoundsRect( hdc, NULL, DCB_ENABLE );
     LineTo( hdc, 50, 40 );




More information about the wine-cvs mailing list