[PATCH v2 4/6] gdiplus: Reuse point when calling GdipAddPathLine2 on open figure.
Jeff Smith
whydoubt at gmail.com
Wed Apr 15 15:07:10 CDT 2020
Signed-off-by: Jeff Smith <whydoubt at gmail.com>
---
dlls/gdiplus/graphicspath.c | 22 +---------------------
dlls/gdiplus/tests/graphicspath.c | 8 ++++++++
2 files changed, 9 insertions(+), 21 deletions(-)
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c
index 083b79b932..04806a95af 100644
--- a/dlls/gdiplus/graphicspath.c
+++ b/dlls/gdiplus/graphicspath.c
@@ -637,32 +637,12 @@ GpStatus WINGDIPAPI GdipAddPathEllipseI(GpPath *path, INT x, INT y, INT width,
GpStatus WINGDIPAPI GdipAddPathLine2(GpPath *path, GDIPCONST GpPointF *points,
INT count)
{
- INT i, old_count;
-
TRACE("(%p, %p, %d)\n", path, points, count);
if(!path || !points || count < 1)
return InvalidParameter;
- if(!lengthen_path(path, count))
- return OutOfMemory;
-
- old_count = path->pathdata.Count;
-
- for(i = 0; i < count; i++){
- path->pathdata.Points[old_count + i].X = points[i].X;
- path->pathdata.Points[old_count + i].Y = points[i].Y;
- path->pathdata.Types[old_count + i] = PathPointTypeLine;
- }
-
- if(path->newfigure){
- path->pathdata.Types[old_count] = PathPointTypeStart;
- path->newfigure = FALSE;
- }
-
- path->pathdata.Count += count;
-
- return Ok;
+ return extend_current_figure(path, points, count, PathPointTypeLine);
}
GpStatus WINGDIPAPI GdipAddPathLine2I(GpPath *path, GDIPCONST GpPoint *points, INT count)
diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c
index 1af53762e4..b3ee72f29b 100644
--- a/dlls/gdiplus/tests/graphicspath.c
+++ b/dlls/gdiplus/tests/graphicspath.c
@@ -329,6 +329,14 @@ static void test_line2(void)
ok_path(path, line2_path, ARRAY_SIZE(line2_path), FALSE);
+ GdipResetPath(path);
+ status = GdipAddPathLine2(path, line2_points, 3);
+ expect(Ok, status);
+ status = GdipAddPathLine2(path, &(line2_points[2]), 3);
+ expect(Ok, status);
+
+ ok_path(path, line2_path, 5, FALSE);
+
GdipDeletePath(path);
}
--
2.23.0
More information about the wine-devel
mailing list