gdiplus: Implement GdipDeleteRegion.

This commit is contained in:
Adam Petaccia 2008-07-24 19:01:32 -04:00 committed by Alexandre Julliard
parent 889bc31197
commit 8a9438d560
2 changed files with 33 additions and 3 deletions

View File

@ -121,6 +121,27 @@ static inline GpStatus init_region(GpRegion* region, const RegionType type)
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)
{
FIXME("(%p %p): stub\n", region, clone);
@ -212,8 +233,15 @@ GpStatus WINGDIPAPI GdipCreateRegionHrgn(HRGN hrgn, GpRegion **region)
GpStatus WINGDIPAPI GdipDeleteRegion(GpRegion *region)
{
FIXME("(%p): stub\n", region);
return NotImplemented;
TRACE("%p\n", region);
if (!region)
return InvalidParameter;
delete_element(&region->node);
GdipFree(region);
return Ok;
}
GpStatus WINGDIPAPI GdipGetRegionBounds(GpRegion *region, GpGraphics *graphics, GpRectF *rect)

View File

@ -108,6 +108,7 @@ todo_wine
expect_magic((DWORD*)(buf + 2));
expect_dword(buf + 3, 0);
expect_dword(buf + 4, RGNDATA_INFINITE_RECT);
}
status = GdipDeleteRegion(region);
ok(status == Ok, "status %08x\n", status);
@ -116,6 +117,8 @@ todo_wine
rect.Y = 20;
rect.Width = 100;
rect.Height = 200;
todo_wine
{
status = GdipCreateRegionRectI(&rect, &region);
ok(status == Ok, "status %08x\n", status);
status = GdipGetRegionDataSize(region, &needed);
@ -216,7 +219,6 @@ todo_wine
expect_float(buf + 37, 22.0);
expect_float(buf + 38, 55.0);
status = GdipDeleteRegion(region2);
ok(status == Ok, "status %08x\n", status);
status = GdipDeleteRegion(region);