[Gdiplus 12/15] Implement GdipCreateRegion

Adam Petaccia adam at tpetaccia.com
Wed Jul 9 02:34:04 CDT 2008


---
 dlls/gdiplus/region.c       |   18 +++++++++++++++---
 dlls/gdiplus/tests/region.c |    9 ++++++---
 2 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/dlls/gdiplus/region.c b/dlls/gdiplus/region.c
index de86ce1..d202be0 100644
--- a/dlls/gdiplus/region.c
+++ b/dlls/gdiplus/region.c
@@ -104,10 +104,22 @@ GpStatus WINGDIPAPI GdipCombineRegionRegion(GpRegion *region1, GpRegion *region2
 
 GpStatus WINGDIPAPI GdipCreateRegion(GpRegion **region)
 {
-    FIXME("(%p): stub\n", region);
+    GpPath* path;
+    GpStatus stat;
 
-    *region = NULL;
-    return NotImplemented;
+    if (!region)
+        return InvalidParameter;
+
+    TRACE("(%p)\n", region);
+
+    stat = GdipCreatePath(FillModeAlternate, &path);
+    if (stat != Ok)
+        return stat;
+
+    GdipCreateRegionPath(path, region);
+    GdipDeletePath(path);
+
+    return Ok;
 }
 
 GpStatus WINGDIPAPI GdipCreateRegionPath(GpPath *path, GpRegion **region)
diff --git a/dlls/gdiplus/tests/region.c b/dlls/gdiplus/tests/region.c
index cfe3106..5706b99 100644
--- a/dlls/gdiplus/tests/region.c
+++ b/dlls/gdiplus/tests/region.c
@@ -45,12 +45,15 @@ static void test_create_rgn(void)
     GpRect rect;
 
     status = GdipCreateRegion(&region);
-todo_wine
     ok(status == Ok, "status %08x\n", status);
 
-    if(status != Ok) return;
-
+todo_wine
     status = GdipGetRegionDataSize(region, &needed);
+    if(status != Ok)
+    {
+        GdipDeleteRegion(region);
+        return;
+    }
     ok(status == Ok, "status %08x\n", status);
     ok(needed == 20, "got %d\n", needed);
     status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
-- 
1.5.4.3




More information about the wine-patches mailing list