Module: wine Branch: master Commit: 90fb47489e6e720037102f08b9e84df23fa0d211 URL: https://gitlab.winehq.org/wine/wine/-/commit/90fb47489e6e720037102f08b9e84df...
Author: David Kahurani k.kahurani@gmail.com Date: Wed Jan 24 12:30:22 2024 +0300
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
---
dlls/gdiplus/graphicspath.c | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-)
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 9e186aa43d1..dabd458b312 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -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; }