From: Esme Povirk esme@codeweavers.com
--- dlls/gdiplus/graphicspath.c | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-)
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 53e0d1d6a35..7b45e08e971 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -324,6 +324,28 @@ static GpStatus extend_current_figure(GpPath *path, GDIPCONST PointF *points, IN return Ok; }
+static GpStatus add_closed_figure(GpPath *path, GDIPCONST PointF *points, INT count, BYTE type) +{ + INT insert_index = path->pathdata.Count; + + if(!count) + return Ok; + + if(!lengthen_path(path, count)) + return OutOfMemory; + + memcpy(path->pathdata.Points + insert_index, points, sizeof(GpPointF)*count); + path->pathdata.Types[insert_index] = PathPointTypeStart; + memset(path->pathdata.Types + insert_index + 1, type, count - 1); + + path->newfigure = TRUE; + path->pathdata.Count += count; + path->pathdata.Types[path->pathdata.Count - 1] |= PathPointTypeCloseSubpath; + + return Ok; +} + + /******************************************************************************* * GdipAddPathArc [GDIPLUS.1] * @@ -536,13 +558,7 @@ GpStatus WINGDIPAPI GdipAddPathClosedCurve2(GpPath *path, GDIPCONST GpPointF *po pt[len_pt-1].X = pt[0].X; pt[len_pt-1].Y = pt[0].Y;
- stat = extend_current_figure(path, pt, len_pt, PathPointTypeBezier); - - /* close figure */ - if(stat == Ok){ - path->pathdata.Types[path->pathdata.Count - 1] |= PathPointTypeCloseSubpath; - path->newfigure = TRUE; - } + stat = add_closed_figure(path, pt, len_pt, PathPointTypeBezier);
free(pts); free(pt);