gdiplus: Reuse point when calling GdipAddPathBeziers on open figure.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=48877
Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Jeff Smith 2020-04-15 15:07:08 -05:00 committed by Alexandre Julliard
parent 1a3a8a0016
commit a7e6cb4a25
2 changed files with 24 additions and 19 deletions

View File

@ -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,

View File

@ -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();