[Gdiplus 13/15] Implement GdipCreateRegionPath

Adam Petaccia adam at tpetaccia.com
Wed Jul 9 02:34:07 CDT 2008


---
 dlls/gdiplus/region.c |   21 +++++++++++++++++----
 1 files changed, 17 insertions(+), 4 deletions(-)

diff --git a/dlls/gdiplus/region.c b/dlls/gdiplus/region.c
index d202be0..04a1598 100644
--- a/dlls/gdiplus/region.c
+++ b/dlls/gdiplus/region.c
@@ -124,8 +124,6 @@ GpStatus WINGDIPAPI GdipCreateRegion(GpRegion **region)
 
 GpStatus WINGDIPAPI GdipCreateRegionPath(GpPath *path, GpRegion **region)
 {
-    GpPath *pathCopy;
-
     if(!(path && region))
         return InvalidParameter;
 
@@ -135,8 +133,23 @@ GpStatus WINGDIPAPI GdipCreateRegionPath(GpPath *path, GpRegion **region)
     if (!*region)
         return OutOfMemory;
 
-    GdipClonePath(path, &pathCopy);
-    (*region)->outline = *pathCopy;
+    (*region)->outline = *path;
+    (*region)->outline.pathdata.Points = GdipAlloc(path->datalen * sizeof(PointF));
+    (*region)->outline.pathdata.Types = GdipAlloc(path->datalen);
+
+    if (!(*region)->outline.pathdata.Points ||
+        !(*region)->outline.pathdata.Types)
+    {
+        GdipFree(*region);
+        GdipFree((*region)->outline.pathdata.Points);
+        GdipFree((*region)->outline.pathdata.Types);
+        return OutOfMemory;
+    }
+
+    memcpy((*region)->outline.pathdata.Points, path->pathdata.Points,
+            path->datalen * sizeof(PointF));
+    memcpy((*region)->outline.pathdata.Types, path->pathdata.Types,
+            path->datalen);
 
     return Ok;
 }
-- 
1.5.4.3




More information about the wine-patches mailing list