Commit a7e6cb4a authored by Jeff Smith's avatar Jeff Smith Committed by Alexandre Julliard

gdiplus: Reuse point when calling GdipAddPathBeziers on open figure.

parent 1a3a8a00
...@@ -322,30 +322,12 @@ GpStatus WINGDIPAPI GdipAddPathBezierI(GpPath *path, INT x1, INT y1, INT x2, ...@@ -322,30 +322,12 @@ GpStatus WINGDIPAPI GdipAddPathBezierI(GpPath *path, INT x1, INT y1, INT x2,
GpStatus WINGDIPAPI GdipAddPathBeziers(GpPath *path, GDIPCONST GpPointF *points, GpStatus WINGDIPAPI GdipAddPathBeziers(GpPath *path, GDIPCONST GpPointF *points,
INT count) INT count)
{ {
INT i, old_count;
TRACE("(%p, %p, %d)\n", path, points, count); TRACE("(%p, %p, %d)\n", path, points, count);
if(!path || !points || ((count - 1) % 3)) if(!path || !points || ((count - 1) % 3))
return InvalidParameter; return InvalidParameter;
if(!lengthen_path(path, count)) return extend_current_figure(path, points, count, PathPointTypeBezier);
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;
} }
GpStatus WINGDIPAPI GdipAddPathBeziersI(GpPath *path, GDIPCONST GpPoint *points, GpStatus WINGDIPAPI GdipAddPathBeziersI(GpPath *path, GDIPCONST GpPoint *points,
......
...@@ -365,6 +365,28 @@ static void test_bezier(void) ...@@ -365,6 +365,28 @@ static void test_bezier(void)
GdipDeletePath(path); 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[] = { static path_test_t arc_path[] = {
{600.0, 450.0, PathPointTypeStart, 0, 0}, /*0*/ {600.0, 450.0, PathPointTypeStart, 0, 0}, /*0*/
{600.0, 643.3, PathPointTypeBezier, 0, 0}, /*1*/ {600.0, 643.3, PathPointTypeBezier, 0, 0}, /*1*/
...@@ -1818,6 +1840,7 @@ START_TEST(graphicspath) ...@@ -1818,6 +1840,7 @@ START_TEST(graphicspath)
test_createpath2(); test_createpath2();
test_line2(); test_line2();
test_bezier(); test_bezier();
test_beziers();
test_arc(); test_arc();
test_worldbounds(); test_worldbounds();
test_pathpath(); test_pathpath();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment