Jeff Smith : gdiplus: Reuse point when calling GdipAddPathLine on open figure.
Alexandre Julliard
julliard at winehq.org
Thu Apr 16 16:45:13 CDT 2020
Module: wine
Branch: master
Commit: f54bf06a2a593825e228db0e2a316df66d233af8
URL: https://source.winehq.org/git/wine.git/?a=commit;h=f54bf06a2a593825e228db0e2a316df66d233af8
Author: Jeff Smith <whydoubt at gmail.com>
Date: Wed Apr 15 15:07:09 2020 -0500
gdiplus: Reuse point when calling GdipAddPathLine 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 | 24 ++++++------------------
dlls/gdiplus/tests/graphicspath.c | 5 ++++-
2 files changed, 10 insertions(+), 19 deletions(-)
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c
index 2729455567..083b79b932 100644
--- a/dlls/gdiplus/graphicspath.c
+++ b/dlls/gdiplus/graphicspath.c
@@ -717,31 +717,19 @@ GpStatus WINGDIPAPI GdipAddPathLine2I(GpPath *path, GDIPCONST GpPoint *points, I
*/
GpStatus WINGDIPAPI GdipAddPathLine(GpPath *path, REAL x1, REAL y1, REAL x2, REAL y2)
{
- INT old_count;
+ PointF points[2];
TRACE("(%p, %.2f, %.2f, %.2f, %.2f)\n", path, x1, y1, x2, y2);
if(!path)
return InvalidParameter;
- if(!lengthen_path(path, 2))
- return OutOfMemory;
-
- old_count = path->pathdata.Count;
-
- path->pathdata.Points[old_count].X = x1;
- path->pathdata.Points[old_count].Y = y1;
- path->pathdata.Points[old_count + 1].X = x2;
- path->pathdata.Points[old_count + 1].Y = y2;
-
- path->pathdata.Types[old_count] =
- (path->newfigure ? PathPointTypeStart : PathPointTypeLine);
- path->pathdata.Types[old_count + 1] = PathPointTypeLine;
-
- path->newfigure = FALSE;
- path->pathdata.Count += 2;
+ points[0].X = x1;
+ points[0].Y = y1;
+ points[1].X = x2;
+ points[1].Y = y2;
- return Ok;
+ return extend_current_figure(path, points, 2, PathPointTypeLine);
}
/*************************************************************************
diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c
index d19c7836fb..1af53762e4 100644
--- a/dlls/gdiplus/tests/graphicspath.c
+++ b/dlls/gdiplus/tests/graphicspath.c
@@ -722,7 +722,8 @@ static path_test_t linei_path[] = {
{15.00, 15.00, PathPointTypeLine, 0, 0}, /*9*/
{26.00, 28.00, PathPointTypeLine | PathPointTypeCloseSubpath, 0, 0}, /*10*/
{35.00, 35.00, PathPointTypeStart, 0, 0}, /*11*/
- {36.00, 38.00, PathPointTypeLine, 0, 0} /*12*/
+ {36.00, 38.00, PathPointTypeLine, 0, 0}, /*12*/
+ {39.00, 40.00, PathPointTypeLine, 0, 0} /*13*/
};
static void test_linei(void)
@@ -739,6 +740,8 @@ static void test_linei(void)
GdipClosePathFigure(path);
status = GdipAddPathLineI(path, 35.0, 35.0, 36.0, 38.0);
expect(Ok, status);
+ status = GdipAddPathLineI(path, 36, 38, 39, 40);
+ expect(Ok, status);
ok_path(path, linei_path, ARRAY_SIZE(linei_path), FALSE);
More information about the wine-cvs
mailing list