Vincent Povirk : gdiplus: Ignore the graphics transforms in GdipGetRegionBounds.

Alexandre Julliard julliard at winehq.org
Tue Aug 4 12:24:49 CDT 2009


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Mon Aug  3 10:09:07 2009 -0500

gdiplus: Ignore the graphics transforms in GdipGetRegionBounds.

---

 dlls/gdiplus/region.c         |    3 ++-
 dlls/gdiplus/tests/graphics.c |    2 +-
 dlls/gdiplus/tests/region.c   |   23 +++++++++++++++++++++++
 3 files changed, 26 insertions(+), 2 deletions(-)

diff --git a/dlls/gdiplus/region.c b/dlls/gdiplus/region.c
index 8fe5e26..039e789 100644
--- a/dlls/gdiplus/region.c
+++ b/dlls/gdiplus/region.c
@@ -657,7 +657,8 @@ GpStatus WINGDIPAPI GdipGetRegionBounds(GpRegion *region, GpGraphics *graphics,
     if(!region || !graphics || !rect)
         return InvalidParameter;
 
-    status = GdipGetRegionHRgn(region, graphics, &hrgn);
+    /* Contrary to MSDN, native ignores the graphics transform. */
+    status = GdipGetRegionHRgn(region, NULL, &hrgn);
     if(status != Ok)
         return status;
 
diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index 6fd49f7..fbd9a48 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -459,7 +459,7 @@ static void test_BeginContainer2(void)
     status = GdipEndContainer(graphics, cont2);
 
     GdipGetClipBounds(graphics, &clip);
-    todo_wine ok(fabs(defClip[0] - clip.X) < 0.0001 &&
+    ok(fabs(defClip[0] - clip.X) < 0.0001 &&
             fabs(defClip[1] - clip.Y) < 0.0001 &&
             fabs(defClip[2] - clip.Width) < 0.0001 &&
             fabs(defClip[3] - clip.Height) < 0.0001,
diff --git a/dlls/gdiplus/tests/region.c b/dlls/gdiplus/tests/region.c
index d48554c..8b1b04e 100644
--- a/dlls/gdiplus/tests/region.c
+++ b/dlls/gdiplus/tests/region.c
@@ -1176,6 +1176,29 @@ static void test_getbounds(void)
     ok(rectf.Width  == 100.0, "Expected width = 0.0, got %.2f\n", rectf.Width);
     ok(rectf.Height == 100.0, "Expected height = 0.0, got %.2f\n", rectf.Height);
 
+    /* the world and page transforms are ignored */
+    GdipScaleWorldTransform(graphics, 2.0, 2.0, MatrixOrderPrepend);
+    GdipSetPageUnit(graphics, UnitInch);
+    GdipSetPageScale(graphics, 2.0);
+    status = GdipGetRegionBounds(region, graphics, &rectf);
+    ok(status == Ok, "status %08x\n", status);
+    ok(rectf.X == 10.0, "Expected X = 0.0, got %.2f\n", rectf.X);
+    ok(rectf.Y == 0.0, "Expected Y = 0.0, got %.2f\n", rectf.Y);
+    ok(rectf.Width  == 100.0, "Expected width = 0.0, got %.2f\n", rectf.Width);
+
+    rectf.X = 10.0; rectf.Y = 0.0;
+    rectf.Width = rectf.Height = 100.0;
+    status = GdipCombineRegionRect(region, &rectf, CombineModeReplace);
+    ok(status == Ok, "status %08x\n", status);
+    rectf.X = rectf.Y = 0.0;
+    rectf.Height = rectf.Width = 0.0;
+    status = GdipGetRegionBounds(region, graphics, &rectf);
+    ok(status == Ok, "status %08x\n", status);
+    ok(rectf.X == 10.0, "Expected X = 0.0, got %.2f\n", rectf.X);
+    ok(rectf.Y == 0.0, "Expected Y = 0.0, got %.2f\n", rectf.Y);
+    ok(rectf.Width  == 100.0, "Expected width = 0.0, got %.2f\n", rectf.Width);
+    ok(rectf.Height == 100.0, "Expected height = 0.0, got %.2f\n", rectf.Height);
+
     status = GdipDeleteRegion(region);
     ok(status == Ok, "status %08x\n", status);
     status = GdipDeleteGraphics(graphics);




More information about the wine-cvs mailing list