[try7][Gdiplus 08/10] Implement GdipCombineRegionRegion
Adam Petaccia
adam at tpetaccia.com
Mon Aug 4 12:56:56 CDT 2008
Changelog:
(try4):
Use a new common function: fuse_region
re-work (header->node isn't a pointer); choose better variable names
Update to new naming scheme
(try3):
Plug a memory leak that would occur when we're out of memory
---
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 d0889be..1365eb3 100644
--- a/dlls/gdiplus/region.c
+++ b/dlls/gdiplus/region.c
@@ -313,11 +313,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;
+
+ memcpy(left, ®ion1->node, sizeof(region_element));
+ stat = clone_element(®ion2->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);
--
1.5.4.3
More information about the wine-patches
mailing list