1
0
Fork 0
mirror of synced 2025-03-07 03:53:26 +01:00

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:
David Kahurani 2024-01-24 12:30:22 +03:00 committed by Alexandre Julliard
parent ba6a6d5781
commit 90fb47489e

View file

@ -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;
}