Signed-off-by: Jeff Smith whydoubt@gmail.com --- dlls/gdiplus/graphicspath.c | 18 +++++++----------- dlls/gdiplus/tests/graphicspath.c | 8 ++++++++ 2 files changed, 15 insertions(+), 11 deletions(-)
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 66a99bf2ce..12ecd344cb 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -645,29 +645,25 @@ GpStatus WINGDIPAPI GdipAddPathLine2(GpPath *path, GDIPCONST GpPointF *points, INT count) { INT i, old_count; + GpStatus status;
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; + status = extend_current_figure(path, count, points[0].X, points[0].Y, &old_count); + if(status != Ok) + return status;
- for(i = 0; i < count; i++){ + for(i = 1; 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; + path->newfigure = FALSE; + path->pathdata.Count = old_count + count;
return Ok; } 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); }