Piotr Caban : gdiplus: Fix GdipGetVisibleClipBounds behavior on metafiles.

Alexandre Julliard julliard at winehq.org
Thu Jul 13 14:41:34 CDT 2017


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

Author: Piotr Caban <piotr at codeweavers.com>
Date:   Thu Jul 13 11:54:06 2017 +0200

gdiplus: Fix GdipGetVisibleClipBounds behavior on metafiles.

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

---

 dlls/gdiplus/graphics.c       |  4 ++++
 dlls/gdiplus/tests/metafile.c | 15 +++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c
index 10d581d..c5c66a9 100644
--- a/dlls/gdiplus/graphics.c
+++ b/dlls/gdiplus/graphics.c
@@ -2098,6 +2098,10 @@ static GpStatus get_visible_clip_region(GpGraphics *graphics, GpRegion *rgn)
     GpRectF rectf;
     GpRegion* tmp;
 
+    /* Ignore graphics image bounds for metafiles */
+    if (graphics->image && graphics->image_type == ImageTypeMetafile)
+        return GdipCombineRegionRegion(rgn, graphics->clip, CombineModeReplace);
+
     if((stat = get_graphics_bounds(graphics, &rectf)) != Ok)
         return stat;
 
diff --git a/dlls/gdiplus/tests/metafile.c b/dlls/gdiplus/tests/metafile.c
index feeaedb..28881f8 100644
--- a/dlls/gdiplus/tests/metafile.c
+++ b/dlls/gdiplus/tests/metafile.c
@@ -2117,6 +2117,7 @@ static void test_clipping(void)
     GpGraphics *graphics;
     GpBitmap *bitmap;
     GpBrush *brush;
+    GpRectF rect;
     ARGB color;
     HDC hdc;
     static const GpRectF frame = {0.0, 0.0, 100.0, 100.0};
@@ -2140,9 +2141,23 @@ static void test_clipping(void)
     stat = GdipSaveGraphics(graphics, &state);
     expect(Ok, stat);
 
+    stat = GdipGetVisibleClipBounds(graphics, &rect);
+    expect(Ok, stat);
+    ok(rect.X == -0x400000, "rect.X = %f\n", rect.X);
+    ok(rect.Y == -0x400000, "rect.Y = %f\n", rect.Y);
+    ok(rect.Width == 0x800000, "rect.Width = %f\n", rect.Width);
+    ok(rect.Height == 0x800000, "rect.Height = %f\n", rect.Height);
+
     stat = GdipSetClipRect(graphics, 30, 30, 10, 10, CombineModeReplace);
     expect(Ok, stat);
 
+    stat = GdipGetVisibleClipBounds(graphics, &rect);
+    expect(Ok, stat);
+    ok(rect.X == 30, "rect.X = %f\n", rect.X);
+    ok(rect.Y == 30, "rect.Y = %f\n", rect.Y);
+    ok(rect.Width == 10, "rect.Width = %f\n", rect.Width);
+    ok(rect.Height == 10, "rect.Height = %f\n", rect.Height);
+
     stat = GdipCreateSolidFill((ARGB)0xff000000, (GpSolidFill**)&brush);
     expect(Ok, stat);
 




More information about the wine-cvs mailing list