From bba20a68b8e4895583b917e9df8962d94f4b45bf Mon Sep 17 00:00:00 2001 From: Evan Stade Date: Wed, 1 Aug 2007 17:55:44 -0700 Subject: [PATCH] gdiplus: Added GdipClonePath. --- dlls/gdiplus/gdiplus.spec | 2 +- dlls/gdiplus/graphicspath.c | 26 ++++++++++++++++++++++++++ include/gdiplusflat.h | 1 + 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index 1b96a3bd0ab..81ff0aec915 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -55,7 +55,7 @@ @ stub GdipCloneImage @ stub GdipCloneImageAttributes @ stdcall GdipCloneMatrix(ptr ptr) -@ stub GdipClonePath +@ stdcall GdipClonePath(ptr ptr) @ stdcall GdipClonePen(ptr ptr) @ stub GdipCloneRegion @ stub GdipCloneStringFormat diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 82f583821e1..b11d9186855 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -212,6 +212,32 @@ GpStatus WINGDIPAPI GdipAddPathPath(GpPath *path, GDIPCONST GpPath* addingPath, return Ok; } +GpStatus WINGDIPAPI GdipClonePath(GpPath* path, GpPath **clone) +{ + if(!path || !clone) + return InvalidParameter; + + *clone = GdipAlloc(sizeof(GpPath)); + if(!*clone) return OutOfMemory; + + memcpy(*clone, path, sizeof(GpPath)); + + (*clone)->pathdata.Points = GdipAlloc(path->datalen * sizeof(PointF)); + (*clone)->pathdata.Types = GdipAlloc(path->datalen); + if(!(*clone)->pathdata.Points || !(*clone)->pathdata.Types){ + GdipFree(*clone); + GdipFree((*clone)->pathdata.Points); + GdipFree((*clone)->pathdata.Types); + return OutOfMemory; + } + + memcpy((*clone)->pathdata.Points, path->pathdata.Points, + path->datalen * sizeof(PointF)); + memcpy((*clone)->pathdata.Types, path->pathdata.Types, path->datalen); + + return Ok; +} + GpStatus WINGDIPAPI GdipClosePathFigure(GpPath* path) { if(!path) diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 90c7e45f2a0..045c17bc6c7 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -97,6 +97,7 @@ GpStatus WINGDIPAPI GdipAddPathBeziers(GpPath*,GDIPCONST GpPointF*,INT); GpStatus WINGDIPAPI GdipAddPathEllipse(GpPath*,REAL,REAL,REAL,REAL); GpStatus WINGDIPAPI GdipAddPathLine2(GpPath*,GDIPCONST GpPointF*,INT); GpStatus WINGDIPAPI GdipAddPathPath(GpPath*,GDIPCONST GpPath*,BOOL); +GpStatus WINGDIPAPI GdipClonePath(GpPath*,GpPath**); GpStatus WINGDIPAPI GdipClosePathFigure(GpPath*); GpStatus WINGDIPAPI GdipClosePathFigures(GpPath*); GpStatus WINGDIPAPI GdipCreatePath(GpFillMode,GpPath**);