diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 547f172d987..27294555673 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -322,30 +322,12 @@ GpStatus WINGDIPAPI GdipAddPathBezierI(GpPath *path, INT x1, INT y1, INT x2, GpStatus WINGDIPAPI GdipAddPathBeziers(GpPath *path, GDIPCONST GpPointF *points, INT count) { - INT i, old_count; - TRACE("(%p, %p, %d)\n", path, points, count); if(!path || !points || ((count - 1) % 3)) 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] = PathPointTypeBezier; - } - - path->pathdata.Types[old_count] = - (path->newfigure ? PathPointTypeStart : PathPointTypeLine); - path->newfigure = FALSE; - path->pathdata.Count += count; - - return Ok; + return extend_current_figure(path, points, count, PathPointTypeBezier); } GpStatus WINGDIPAPI GdipAddPathBeziersI(GpPath *path, GDIPCONST GpPoint *points, diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c index d85cf68dfcb..d19c7836fb8 100644 --- a/dlls/gdiplus/tests/graphicspath.c +++ b/dlls/gdiplus/tests/graphicspath.c @@ -365,6 +365,28 @@ static void test_bezier(void) GdipDeletePath(path); } +static void test_beziers(void) +{ + GpStatus status; + GpPath* path; + PointF bezier_points1[] = {{10.0,10.0}, {20.0,10.0}, {20.0,20.0}, {30.0,20.0}}; + PointF bezier_points2[] = {{30.0,20.0}, {40.0,20.0}, {40.0,30.0}, {50.0,30.0}}; + PointF bezier_points3[] = {{50.0,10.0}, {60.0,10.0}, {60.0,20.0}, {70.0,20.0}}; + + GdipCreatePath(FillModeAlternate, &path); + + status = GdipAddPathBeziers(path, bezier_points1, 4); + expect(Ok, status); + status = GdipAddPathBeziers(path, bezier_points2, 4); + expect(Ok, status); + status = GdipAddPathBeziers(path, bezier_points3, 4); + expect(Ok, status); + + ok_path(path, bezier_path, ARRAY_SIZE(bezier_path), FALSE); + + GdipDeletePath(path); +} + static path_test_t arc_path[] = { {600.0, 450.0, PathPointTypeStart, 0, 0}, /*0*/ {600.0, 643.3, PathPointTypeBezier, 0, 0}, /*1*/ @@ -1818,6 +1840,7 @@ START_TEST(graphicspath) test_createpath2(); test_line2(); test_bezier(); + test_beziers(); test_arc(); test_worldbounds(); test_pathpath();