From 2a445d0ebd5d8d3673513afc0e342925df7d2cbd Mon Sep 17 00:00:00 2001 From: Adam Petaccia Date: Mon, 4 Aug 2008 13:56:56 -0400 Subject: [PATCH] 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 d07ed3896b0..b66cbb42084 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(®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 d1e65d60cfe..77b1e3bfd99 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); -- 2.11.4.GIT