Adam Petaccia : gdiplus: Implement GdipCombineRegionRegion.

Alexandre Julliard julliard at winehq.org
Tue Aug 5 07:26:25 CDT 2008


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

Author: Adam Petaccia <adam at tpetaccia.com>
Date:   Mon Aug  4 13:56:56 2008 -0400

gdiplus: Implement GdipCombineRegionRegion.

---

 dlls/gdiplus/region.c       |   31 +++++++++++++++++++++++++++----
 dlls/gdiplus/tests/region.c |    9 ---------
 2 files changed, 27 insertions(+), 13 deletions(-)

diff --git a/dlls/gdiplus/region.c b/dlls/gdiplus/region.c
index d07ed38..b66cbb4 100644
--- a/dlls/gdiplus/region.c
+++ b/dlls/gdiplus/region.c
@@ -311,11 +311,34 @@ GpStatus WINGDIPAPI GdipCombineRegionRectI(GpRegion *region,
     return GdipCombineRegionRect(region, &rectf, mode);
 }
 
-GpStatus WINGDIPAPI GdipCombineRegionRegion(GpRegion *region1, GpRegion *region2,
-                                            CombineMode mode)
+GpStatus WINGDIPAPI GdipCombineRegionRegion(GpRegion *region1,
+        GpRegion *region2, CombineMode mode)
 {
-    FIXME("(%p %p %d): stub\n", region1, region2, mode);
-    return NotImplemented;
+    region_element *left, *right;
+    GpStatus stat;
+
+    TRACE("%p %p %d\n", region1, region2, mode);
+
+    if(!(region1 && region2))
+        return InvalidParameter;
+
+    left  = GdipAlloc(sizeof(region_element));
+    if (!left)
+        return OutOfMemory;
+
+    *left = region1->node;
+    stat = clone_element(&region2->node, &right);
+    if (stat != Ok)
+    {
+        GdipFree(left);
+        delete_element(right);
+        return OutOfMemory;
+    }
+
+    fuse_region(region1, left, right, mode);
+    region1->header.num_children += region2->header.num_children;
+
+    return Ok;
 }
 
 GpStatus WINGDIPAPI GdipCreateRegion(GpRegion **region)
diff --git a/dlls/gdiplus/tests/region.c b/dlls/gdiplus/tests/region.c
index d1e65d6..77b1e3b 100644
--- a/dlls/gdiplus/tests/region.c
+++ b/dlls/gdiplus/tests/region.c
@@ -160,7 +160,6 @@ todo_wine
     ok(status == Ok, "status %08x\n", status);
 
     status = GdipCombineRegionRegion(region, region2, CombineModeComplement);
-todo_wine
     ok(status == Ok, "status %08x\n", status);
 
     rect.X = 400;
@@ -172,22 +171,15 @@ todo_wine
 
     status = GdipGetRegionDataSize(region, &needed);
     ok(status == Ok, "status %08x\n", status);
-todo_wine
     expect(156, needed);
     status = GdipGetRegionData(region, (BYTE*)buf, sizeof(buf), &needed);
     ok(status == Ok, "status %08x\n", status);
-todo_wine
-{
     expect(156, needed);
     expect_dword(buf, 148);
-}
     trace("buf[1] = %08x\n", buf[1]);
     expect_magic((DWORD*)(buf + 2));
-todo_wine
     expect_dword(buf + 3, 10);
     expect_dword(buf + 4, CombineModeExclude);
-todo_wine
-{
     expect_dword(buf + 5, CombineModeComplement);
     expect_dword(buf + 6, CombineModeXor);
     expect_dword(buf + 7, CombineModeIntersect);
@@ -222,7 +214,6 @@ todo_wine
     expect_float(buf + 36, 500.0);
     expect_float(buf + 37, 22.0);
     expect_float(buf + 38, 55.0);
-}
 
     status = GdipDeleteRegion(region2);
     ok(status == Ok, "status %08x\n", status);




More information about the wine-cvs mailing list