Vincent Povirk : gdiplus: Return visible clip bounds in world coordinates.

Alexandre Julliard julliard at winehq.org
Tue Jun 7 11:08:16 CDT 2016


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

Author: Vincent Povirk <vincent at codeweavers.com>
Date:   Mon Jun  6 16:00:50 2016 -0500

gdiplus: Return visible clip bounds in world coordinates.

Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/gdiplus/graphics.c       |  8 ++++++++
 dlls/gdiplus/tests/graphics.c | 23 +++++++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index dac52ef..8353809 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -4297,6 +4297,7 @@ GpStatus WINGDIPAPI GdipGetVisibleClipBounds(GpGraphics *graphics, GpRectF *rect
 {
     GpRegion *clip_rgn;
     GpStatus stat;
+    GpMatrix device_to_world;
 
     TRACE("(%p, %p)\n", graphics, rect);
 
@@ -4313,6 +4314,13 @@ GpStatus WINGDIPAPI GdipGetVisibleClipBounds(GpGraphics *graphics, GpRectF *rect
     if((stat = get_visible_clip_region(graphics, clip_rgn)) != Ok)
         goto cleanup;
 
+    /* transform to world coordinates */
+    if((stat = get_graphics_transform(graphics, CoordinateSpaceWorld, CoordinateSpaceDevice, &device_to_world)) != Ok)
+        goto cleanup;
+
+    if((stat = GdipTransformRegion(clip_rgn, &device_to_world)) != Ok)
+        goto cleanup;
+
     /* get bounds of the region */
     stat = GdipGetRegionBounds(clip_rgn, graphics, rect);
 
diff --git a/dlls/gdiplus/tests/graphics.c b/dlls/gdiplus/tests/graphics.c
index 3ee3363..cf5652b 100644
--- a/dlls/gdiplus/tests/graphics.c
+++ b/dlls/gdiplus/tests/graphics.c
@@ -2313,6 +2313,29 @@ static void test_GdipGetVisibleClipBounds_window(void)
         recti.X, recti.Y, recti.Width, recti.Height,
         exp.X, exp.Y, exp.Width, exp.Height);
 
+    /* window bounds with transform applied */
+    status = GdipResetClip(graphics);
+    expect(Ok, status);
+
+    status = GdipScaleWorldTransform(graphics, 0.5, 0.5, MatrixOrderPrepend);
+    expect(Ok, status);
+
+    exp.X = window.X * 2.0;
+    exp.Y = window.Y * 2.0;
+    exp.Width = window.Width * 2.0;
+    exp.Height = window.Height * 2.0;
+
+    status = GdipGetVisibleClipBounds(graphics, &rectf);
+    expect(Ok, status);
+    ok(rectf.X == exp.X &&
+        rectf.Y == exp.Y &&
+        rectf.Width == exp.Width &&
+        rectf.Height == exp.Height,
+        "Expected clip bounds (%0.f, %0.f, %0.f, %0.f) to be "
+        "twice the window size (%0.f, %0.f, %0.f, %0.f)\n",
+        rectf.X, rectf.Y, rectf.Width, rectf.Height,
+        exp.X, exp.Y, exp.Width, exp.Height);
+
     GdipDeleteGraphics(graphics);
     EndPaint(hwnd, &ps);
 }




More information about the wine-cvs mailing list