Jeff Smith : gdiplus: Reuse point when calling GdipAddPathLine2 on open figure.
Alexandre Julliard
julliard at winehq.org
Thu Apr 16 16:45:13 CDT 2020
Module: wine
Branch: master
Commit: c5ae902946d34078a64e6ae065ba8d57e45ec02a
URL: https://source.winehq.org/git/wine.git/?a=commit;h=c5ae902946d34078a64e6ae065ba8d57e45ec02a
Author: Jeff Smith <whydoubt at gmail.com>
Date: Wed Apr 15 15:07:10 2020 -0500
gdiplus: Reuse point when calling GdipAddPathLine2 on open figure.
Signed-off-by: Jeff Smith <whydoubt at gmail.com>
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
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);
}
More information about the wine-cvs
mailing list