Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/gdiplus/graphicspath.c | 15 +++++---------- dlls/gdiplus/tests/graphicspath.c | 5 ++++- 2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index cabe8d4bd4..66a99bf2ce 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -725,28 +725,23 @@ 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; + GpStatus status;
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; + status = extend_current_figure(path, 2, x1, y1, &old_count); + if(status != Ok) + return status;
- 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; + path->pathdata.Count = old_count + 2;
return Ok; } 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);