[try7][Gdiplus 09/10] Implement GdipCombineRegionPath

Adam Petaccia adam at tpetaccia.com
Mon Aug 4 12:56:59 CDT 2008


Changelog:
(try5):
    Shut up a compiler warning

(try4):
    Use a new common function: fuse_region
    region->node isn't a pointer.
    Update to new naming scheme
(try3):
    Be more careful to free memory on failure.
---
 dlls/gdiplus/region.c       |   34 ++++++++++++++++++++++++++++++++--
 dlls/gdiplus/tests/region.c |    1 -
 2 files changed, 32 insertions(+), 3 deletions(-)

diff --git a/dlls/gdiplus/region.c b/dlls/gdiplus/region.c
index 1365eb3..aeba732 100644
--- a/dlls/gdiplus/region.c
+++ b/dlls/gdiplus/region.c
@@ -254,8 +254,38 @@ GpStatus WINGDIPAPI GdipCloneRegion(GpRegion *region, GpRegion **clone)
 
 GpStatus WINGDIPAPI GdipCombineRegionPath(GpRegion *region, GpPath *path, CombineMode mode)
 {
-    FIXME("(%p %p %d): stub\n", region, path, mode);
-    return NotImplemented;
+    GpRegion *path_region;
+    region_element *left, *right = NULL;
+    GpStatus stat;
+
+    TRACE("%p %p %d\n", region, path, mode);
+
+    if (!(region && path))
+        return InvalidParameter;
+
+    stat = GdipCreateRegionPath(path, &path_region);
+    if (stat != Ok)
+        return stat;
+
+    left = GdipAlloc(sizeof(region_element));
+    if (!left)
+        goto out;
+    memcpy(left, &region->node, sizeof(region_element));
+
+    stat = clone_element(&path_region->node, &right);
+    if (stat != Ok)
+        goto out;
+
+    fuse_region(region, left, right, mode);
+
+    GdipDeleteRegion(path_region);
+    return Ok;
+
+out:
+    GdipFree(left);
+    delete_element(right);
+    GdipDeleteRegion(path_region);
+    return stat;
 }
 
 GpStatus WINGDIPAPI GdipCombineRegionRect(GpRegion *region,
diff --git a/dlls/gdiplus/tests/region.c b/dlls/gdiplus/tests/region.c
index 77b1e3b..df9e744 100644
--- a/dlls/gdiplus/tests/region.c
+++ b/dlls/gdiplus/tests/region.c
@@ -70,7 +70,6 @@ static void test_getregiondata(void)
     status = GdipGetRegionDataSize(region, &needed);
     ok(status == Ok, "status %08x\n", status);
     expect(20, needed);
-todo_wine
     status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
     ok(status == Ok, "status %08x\n", status);
     expect(20, needed);
-- 
1.5.4.3




More information about the wine-patches mailing list