Commit 90fb4748 authored by David Kahurani's avatar David Kahurani Committed by Alexandre Julliard

gdiplus: Use GdipCreatePath2 in GdipClonePath.

This seems like a more effective interface and avoids code duplication. Signed-off-by: 's avatarDavid Kahurani <k.kahurani@gmail.com>
parent ba6a6d57
...@@ -1185,24 +1185,15 @@ GpStatus WINGDIPAPI GdipClonePath(GpPath* path, GpPath **clone) ...@@ -1185,24 +1185,15 @@ GpStatus WINGDIPAPI GdipClonePath(GpPath* path, GpPath **clone)
if(!path || !clone) if(!path || !clone)
return InvalidParameter; return InvalidParameter;
*clone = malloc(sizeof(GpPath)); if (path->pathdata.Count)
if(!*clone) return OutOfMemory; return GdipCreatePath2(path->pathdata.Points, path->pathdata.Types, path->pathdata.Count,
path->fill, clone);
**clone = *path; else
{
(*clone)->pathdata.Points = malloc(path->datalen * sizeof(PointF)); *clone = calloc(1, sizeof(GpPath));
(*clone)->pathdata.Types = malloc(path->datalen); if(!*clone) return OutOfMemory;
if(!(*clone)->pathdata.Points || !(*clone)->pathdata.Types){
free((*clone)->pathdata.Points);
free((*clone)->pathdata.Types);
free(*clone);
return OutOfMemory;
} }
memcpy((*clone)->pathdata.Points, path->pathdata.Points,
path->datalen * sizeof(PointF));
memcpy((*clone)->pathdata.Types, path->pathdata.Types, path->datalen);
return Ok; return Ok;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment