On Wed, Jul 09, 2008 at 03:34:01AM -0400, Adam Petaccia wrote:
dlls/gdiplus/region.c | 28 ++++++++++++++++++++++++---- dlls/gdiplus/tests/region.c | 8 ++++---- 2 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/dlls/gdiplus/region.c b/dlls/gdiplus/region.c index 59e2fa6..de86ce1 100644 --- a/dlls/gdiplus/region.c +++ b/dlls/gdiplus/region.c @@ -129,12 +129,32 @@ GpStatus WINGDIPAPI GdipCreateRegionPath(GpPath *path, GpRegion **region) return Ok; }
-GpStatus WINGDIPAPI GdipCreateRegionRect(GDIPCONST GpRectF *rect, GpRegion **region) +GpStatus WINGDIPAPI GdipCreateRegionRect(GDIPCONST GpRectF *rect,
GpRegion **region)
{
- FIXME("(%p, %p): stub\n", rect, region);
- GpPath *path;
- GpStatus stat;
- *region = NULL;
- return NotImplemented;
- if (!(rect && region))
return InvalidParameter;
- TRACE("%p, %p\n", rect, region);
- *region = GdipAlloc(sizeof(GpRegion*));
- if(!*region)
return OutOfMemory;
- stat = GdipCreatePath(FillModeAlternate, &path);
- if (stat != Ok) { GdipDeleteRegion(*region); return stat;}
- stat = GdipAddPathRectangle(path, rect->X, rect->Y,
rect->Width, rect->Height);
- if (stat != Ok) { GdipDeleteRegion(*region); return stat;}
- stat = GdipCreateRegionPath(path, region);
- if (stat != Ok) { GdipDeleteRegion(*region); return stat;}
- GdipDeletePath(path);
- return Ok;
}
This doesn't look right. See the GdipGetRegionData tests (and extend them to add paths), these are supposed to help understanding how regions are stored. It looks to me that a region is stored as a sequence of rects and paths that are combined with various CombineMode ops.
I'll send a patch that adds paths to the test in a bit.
Huw.