gdiplus: Use GdipCreatePath2 in GdipClonePath.
This seems like a more effective interface and avoids code duplication. Signed-off-by: David Kahurani <k.kahurani@gmail.com>
This commit is contained in:
parent
ba6a6d5781
commit
90fb47489e
1 changed files with 7 additions and 16 deletions
|
@ -1185,24 +1185,15 @@ GpStatus WINGDIPAPI GdipClonePath(GpPath* path, GpPath **clone)
|
|||
if(!path || !clone)
|
||||
return InvalidParameter;
|
||||
|
||||
*clone = malloc(sizeof(GpPath));
|
||||
if(!*clone) return OutOfMemory;
|
||||
|
||||
**clone = *path;
|
||||
|
||||
(*clone)->pathdata.Points = malloc(path->datalen * sizeof(PointF));
|
||||
(*clone)->pathdata.Types = malloc(path->datalen);
|
||||
if(!(*clone)->pathdata.Points || !(*clone)->pathdata.Types){
|
||||
free((*clone)->pathdata.Points);
|
||||
free((*clone)->pathdata.Types);
|
||||
free(*clone);
|
||||
return OutOfMemory;
|
||||
if (path->pathdata.Count)
|
||||
return GdipCreatePath2(path->pathdata.Points, path->pathdata.Types, path->pathdata.Count,
|
||||
path->fill, clone);
|
||||
else
|
||||
{
|
||||
*clone = calloc(1, sizeof(GpPath));
|
||||
if(!*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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue