Commit 8a9438d5 authored by Adam Petaccia's avatar Adam Petaccia Committed by Alexandre Julliard

gdiplus: Implement GdipDeleteRegion.

parent 889bc311
...@@ -121,6 +121,27 @@ static inline GpStatus init_region(GpRegion* region, const RegionType type) ...@@ -121,6 +121,27 @@ static inline GpStatus init_region(GpRegion* region, const RegionType type)
return Ok; return Ok;
} }
static inline void delete_element(region_element* element)
{
switch(element->type)
{
case RegionDataRect:
break;
case RegionDataPath:
GdipDeletePath(element->elementdata.pathdata.path);
break;
case RegionDataEmptyRect:
case RegionDataInfiniteRect:
break;
default:
delete_element(element->elementdata.combine.left);
delete_element(element->elementdata.combine.right);
GdipFree(element->elementdata.combine.left);
GdipFree(element->elementdata.combine.right);
break;
}
}
GpStatus WINGDIPAPI GdipCloneRegion(GpRegion *region, GpRegion **clone) GpStatus WINGDIPAPI GdipCloneRegion(GpRegion *region, GpRegion **clone)
{ {
FIXME("(%p %p): stub\n", region, clone); FIXME("(%p %p): stub\n", region, clone);
...@@ -212,8 +233,15 @@ GpStatus WINGDIPAPI GdipCreateRegionHrgn(HRGN hrgn, GpRegion **region) ...@@ -212,8 +233,15 @@ GpStatus WINGDIPAPI GdipCreateRegionHrgn(HRGN hrgn, GpRegion **region)
GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region) GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region)
{ {
FIXME("(%p): stub\n", region); TRACE("%p\n", region);
return NotImplemented;
if (!region)
return InvalidParameter;
delete_element(&region->node);
GdipFree(region);
return Ok;
} }
GpStatus WINGDIPAPI GdipGetRegionBounds(GpRegion *region, GpGraphics *graphics, GpRectF *rect) GpStatus WINGDIPAPI GdipGetRegionBounds(GpRegion *region, GpGraphics *graphics, GpRectF *rect)
......
...@@ -108,6 +108,7 @@ todo_wine ...@@ -108,6 +108,7 @@ todo_wine
expect_magic((DWORD*)(buf + 2)); expect_magic((DWORD*)(buf + 2));
expect_dword(buf + 3, 0); expect_dword(buf + 3, 0);
expect_dword(buf + 4, RGNDATA_INFINITE_RECT); expect_dword(buf + 4, RGNDATA_INFINITE_RECT);
}
status = GdipDeleteRegion(region); status = GdipDeleteRegion(region);
ok(status == Ok, "status %08x\n", status); ok(status == Ok, "status %08x\n", status);
...@@ -116,6 +117,8 @@ todo_wine ...@@ -116,6 +117,8 @@ todo_wine
rect.Y = 20; rect.Y = 20;
rect.Width = 100; rect.Width = 100;
rect.Height = 200; rect.Height = 200;
todo_wine
{
status = GdipCreateRegionRectI(&rect, &region); status = GdipCreateRegionRectI(&rect, &region);
ok(status == Ok, "status %08x\n", status); ok(status == Ok, "status %08x\n", status);
status = GdipGetRegionDataSize(region, &needed); status = GdipGetRegionDataSize(region, &needed);
...@@ -216,7 +219,6 @@ todo_wine ...@@ -216,7 +219,6 @@ todo_wine
expect_float(buf + 37, 22.0); expect_float(buf + 37, 22.0);
expect_float(buf + 38, 55.0); expect_float(buf + 38, 55.0);
status = GdipDeleteRegion(region2); status = GdipDeleteRegion(region2);
ok(status == Ok, "status %08x\n", status); ok(status == Ok, "status %08x\n", status);
status = GdipDeleteRegion(region); status = GdipDeleteRegion(region);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment