[2/3] gdiplus: Fix clipping region bounds calculation with rotating transform.

Dmitry Timoshkov dmitry at baikal.ru
Mon Jul 22 03:49:19 CDT 2013


---
 dlls/gdiplus/graphics.c       |  9 +++++++--
 dlls/gdiplus/tests/graphics.c | 20 +++++++++-----------
 2 files changed, 16 insertions(+), 13 deletions(-)

diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 43464c9..d79239e 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -4068,6 +4068,7 @@ GpStatus WINGDIPAPI GdipFlush(GpGraphics *graphics, GpFlushIntention intention)
 GpStatus WINGDIPAPI GdipGetClipBounds(GpGraphics *graphics, GpRectF *rect)
 {
     GpStatus status;
+    GpRegion *clip;
 
     TRACE("(%p, %p)\n", graphics, rect);
 
@@ -4077,10 +4078,14 @@ GpStatus WINGDIPAPI GdipGetClipBounds(GpGraphics *graphics, GpRectF *rect)
     if(graphics->busy)
         return ObjectBusy;
 
-    status = GdipGetRegionBounds(graphics->clip, graphics, rect);
+    status = GdipCreateRegion(&clip);
+    if (status != Ok) return status;
+
+    status = GdipGetClip(graphics, clip);
     if (status == Ok)
-        transform_rectf(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, rect);
+        status = GdipGetRegionBounds(clip, graphics, rect);
 
+    GdipDeleteRegion(clip);
     return status;
 }
 
diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index ad98142..2f8b025 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -4739,6 +4739,8 @@ static void test_clipping(void)
     status = GdipGetClipBounds(graphics, &rect);
     expect(Ok, status);
     ok((rect.X == 13.75 && rect.Y == 4.375 && rect.Width == 18.75 && rect.Height == 9.375) ||
+       /* rounding under Wine is slightly different */
+       (rect.X == 14.0 && rect.Y == 4.0 && rect.Width == 19.0 && rect.Height == 10.0) /* Wine */ ||
        broken(rect.X == 45.0 && rect.Y == 20.0 && rect.Width == 50.0 && rect.Height == 25.0) /* before Win7 */,
        "expected 13.75,4.375-18.75,9.375, got %.2f,%.2f-%.2f,%.2f\n", rect.X, rect.Y, rect.Width, rect.Height);
 
@@ -4883,9 +4885,7 @@ static void test_clipping(void)
     status = GdipGetClipBounds(graphics, &rect);
     expect(Ok, status);
     expectf_(20.612978, rect.X, 1.0);
-todo_wine
     expectf_(-6.256012, rect.Y, 1.5);
-todo_wine
     expectf_(25.612978, rect.Width, 1.0);
     expectf_(12.806489, rect.Height, 1.0);
 
@@ -4987,13 +4987,10 @@ todo_wine
 
     status = GdipGetClipBounds(graphics, &rect);
     expect(Ok, status);
-todo_wine
-    expectf(-28.100956, rect.X);
-    expectf(7.806488, rect.Y);
-todo_wine
-    expectf(25.612978, rect.Width);
-todo_wine
-    expectf(12.806489, rect.Height);
+    expectf_(-28.100956, rect.X, 1.0);
+    expectf_(7.806488, rect.Y, 1.5);
+    expectf_(25.612978, rect.Width, 1.0);
+    expectf_(12.806489, rect.Height, 1.0);
 
     status = GdipSetEmpty(region);
     expect(Ok, status);
@@ -5061,8 +5058,9 @@ todo_wine
     expect(Ok, status);
     ret = GetRgnBox(hrgn, &rc);
     ok(ret == COMPLEXREGION, "expected COMPLEXREGION, got %d\n", ret);
-todo_wine
-    ok(rc.left == 4500 && rc.top == 351 && rc.right == 8728 && rc.bottom == 3407,
+    ok((rc.left == 4500 && rc.top == 351 && rc.right == 8728 && rc.bottom == 3407) ||
+       /* rounding under Wine is slightly different */
+       (rc.left == 4499 && rc.top == 351 && rc.right == 8728 && rc.bottom == 3407) /* Wine */,
        "expected (4500,351)-(8728,3407), got (%d,%d)-(%d,%d)\n", rc.left, rc.top, rc.right, rc.bottom);
     DeleteObject(hrgn);
 
-- 
1.8.3.3




More information about the wine-patches mailing list