gdiplus: Clear new multi-point paths that end with Start.

Signed-off-by: Jeff Smith <whydoubt@gmail.com>
Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
feature/deterministic
Jeff Smith 2020-04-13 22:50:51 -05:00 committed by Alexandre Julliard
parent a55feef63a
commit efd5f670bd
2 changed files with 13 additions and 3 deletions

View File

@ -1228,6 +1228,9 @@ GpStatus WINGDIPAPI GdipCreatePath2(GDIPCONST GpPointF* points,
*path = heap_alloc_zero(sizeof(GpPath));
if(!*path) return OutOfMemory;
if(count > 1 && (types[count-1] & PathPointTypePathTypeMask) == PathPointTypeStart)
count = 0;
for(i = 1; i < count; i++) {
if((types[i] & PathPointTypePathTypeMask) == PathPointTypeBezier) {
if(i+2 < count &&

View File

@ -181,8 +181,8 @@ static void test_createpath2(void)
GpPathData data;
INT i, count, expect_count;
PointF test_line_points[] = {{1.0,1.0}, {2.0,1.0}};
BYTE test_line_types[] = {PathPointTypeStart, PathPointTypeLine};
PointF test_line_points[] = {{1.0,1.0}, {2.0,1.0}, {2.0,2.0}};
BYTE test_line_types[] = {PathPointTypeStart, PathPointTypeLine, PathPointTypeStart};
PointF test_bez_points[] = {{1.0,1.0}, {2.0,1.0}, {3.0,1.0}, {4.0,1.0},
{5.0,1.0}, {6.0,1.0}, {7.0,1.0}};
@ -235,8 +235,15 @@ static void test_createpath2(void)
status = GdipCreatePath2(test_line_points, test_line_types, 2, FillModeAlternate, NULL);
expect(InvalidParameter, status);
/* Multi-point paths should not end with Start */
status = GdipCreatePath2(test_line_points, test_line_types, 3, FillModeAlternate, &path);
expect(Ok, status);
status = GdipGetPointCount(path, &count);
expect(Ok, status);
expect(0, count);
GdipDeletePath(path);
/* Zero-length line points do not get altered */
path = NULL;
test_line_points[1].X = test_line_points[0].X;
test_line_points[1].Y = test_line_points[0].Y;
status = GdipCreatePath2(test_line_points, test_line_types, 2, FillModeAlternate, &path);