[3/3] gdiplus: Allow excluding from infinite regions.

Vincent Povirk madewokherd at gmail.com
Wed Oct 30 12:51:59 CDT 2013


-------------- next part --------------
From 44333f2f9b916d8882319c4c7d3fc30652dfb411 Mon Sep 17 00:00:00 2001
From: Vincent Povirk <vincent at codeweavers.com>
Date: Wed, 30 Oct 2013 11:46:30 -0500
Subject: [PATCH 3/3] gdiplus: Allow excluding from infinite regions.

---
 dlls/gdiplus/region.c       |  8 +++----
 dlls/gdiplus/tests/region.c | 52 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 56 insertions(+), 4 deletions(-)

diff --git a/dlls/gdiplus/region.c b/dlls/gdiplus/region.c
index 7186518..d2e0207 100644
--- a/dlls/gdiplus/region.c
+++ b/dlls/gdiplus/region.c
@@ -994,8 +994,8 @@ static GpStatus get_region_hrgn(struct region_element *element, GpGraphics *grap
                     case CombineModeIntersect:
                         return get_region_hrgn(element->elementdata.combine.right, graphics, hrgn);
                     case CombineModeXor: case CombineModeExclude:
-                        FIXME("cannot exclude from an infinite region\n");
-                        /* fall-through */
+                        left = CreateRectRgn(-4194304, -4194304, 4194304, 4194304);
+                        break;
                     case CombineModeUnion: case CombineModeComplement:
                         *hrgn = NULL;
                         return Ok;
@@ -1019,8 +1019,8 @@ static GpStatus get_region_hrgn(struct region_element *element, GpGraphics *grap
                         *hrgn = left;
                         return Ok;
                     case CombineModeXor: case CombineModeComplement:
-                        FIXME("cannot exclude from an infinite region\n");
-                        /* fall-through */
+                        right = CreateRectRgn(-4194304, -4194304, 4194304, 4194304);
+                        break;
                     case CombineModeUnion: case CombineModeExclude:
                         DeleteObject(left);
                         *hrgn = NULL;
diff --git a/dlls/gdiplus/tests/region.c b/dlls/gdiplus/tests/region.c
index c9da573..335c265 100644
--- a/dlls/gdiplus/tests/region.c
+++ b/dlls/gdiplus/tests/region.c
@@ -1873,6 +1873,57 @@ static void test_isvisiblerect(void)
     ReleaseDC(0, hdc);
 }
 
+static void test_excludeinfinite(void)
+{
+    GpStatus status;
+    GpRegion *region;
+    UINT count=0xdeadbeef;
+    GpRectF scans[4];
+    GpMatrix *identity;
+    BOOL infinite=0xdeadbeef;
+    static const RectF rect_exclude = {0.0, 0.0, 1.0, 1.0};
+
+    status = GdipCreateMatrix(&identity);
+    expect(Ok, status);
+
+    status = GdipCreateRegion(&region);
+    expect(Ok, status);
+
+    status = GdipCombineRegionRect(region, &rect_exclude, CombineModeExclude);
+    expect(Ok, status);
+
+    status = GdipGetRegionScansCount(region, &count, identity);
+    expect(Ok, status);
+    expect(4, count);
+
+    count = 4;
+    status = GdipGetRegionScans(region, scans, &count, identity);
+    expect(Ok, status);
+
+    expectf(-4194304.0, scans[0].X);
+    expectf(-4194304.0, scans[0].Y);
+    expectf(8388608.0, scans[0].Width);
+    expectf(4194304.0, scans[0].Height);
+
+    expectf(-4194304.0, scans[1].X);
+    expectf(0.0, scans[1].Y);
+    expectf(4194304.0, scans[1].Width);
+    expectf(1.0, scans[1].Height);
+
+    expectf(1.0, scans[2].X);
+    expectf(0.0, scans[2].Y);
+    expectf(4194303.0, scans[2].Width);
+    expectf(1.0, scans[2].Height);
+
+    expectf(-4194304.0, scans[3].X);
+    expectf(1.0, scans[3].Y);
+    expectf(8388608.0, scans[3].Width);
+    expectf(4194303.0, scans[3].Height);
+
+    GdipDeleteRegion(region);
+    GdipDeleteMatrix(identity);
+}
+
 START_TEST(region)
 {
     struct GdiplusStartupInput gdiplusStartupInput;
@@ -1898,6 +1949,7 @@ START_TEST(region)
     test_getbounds();
     test_isvisiblepoint();
     test_isvisiblerect();
+    test_excludeinfinite();
 
     GdiplusShutdown(gdiplusToken);
 }
-- 
1.8.1.2


More information about the wine-patches mailing list