[try7][Gdiplus 03/10] Implement GdipCreateRegionRect

Adam Petaccia adam at tpetaccia.com
Mon Aug 4 12:56:37 CDT 2008


Changelog:
(try4):
    region->node is no longer a pointer
    Update to new naming scheme
(try3):
    Don't leak on failure.
---
 dlls/gdiplus/region.c |   26 ++++++++++++++++++++++----
 1 files changed, 22 insertions(+), 4 deletions(-)

diff --git a/dlls/gdiplus/region.c b/dlls/gdiplus/region.c
index 48a9d00..80ce5c8 100644
--- a/dlls/gdiplus/region.c
+++ b/dlls/gdiplus/region.c
@@ -332,12 +332,30 @@ 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);
+    GpStatus stat;
 
-    *region = NULL;
-    return NotImplemented;
+    TRACE("%p, %p\n", rect, region);
+
+    if (!(rect && region))
+        return InvalidParameter;
+
+    *region = GdipAlloc(sizeof(GpRegion));
+    stat = init_region(*region, RegionDataRect);
+    if(stat != Ok)
+    {
+        GdipDeleteRegion(*region);
+        return stat;
+    }
+
+    (*region)->node.elementdata.rect.X = rect->X;
+    (*region)->node.elementdata.rect.Y = rect->Y;
+    (*region)->node.elementdata.rect.Width = rect->Width;
+    (*region)->node.elementdata.rect.Height = rect->Height;
+
+    return Ok;
 }
 
 GpStatus WINGDIPAPI GdipCreateRegionRectI(GDIPCONST GpRect *rect, GpRegion **region)
-- 
1.5.4.3




More information about the wine-patches mailing list