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>
This commit is contained in:
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)); *path = heap_alloc_zero(sizeof(GpPath));
if(!*path) return OutOfMemory; if(!*path) return OutOfMemory;
if(count > 1 && (types[count-1] & PathPointTypePathTypeMask) == PathPointTypeStart)
count = 0;
for(i = 1; i < count; i++) { for(i = 1; i < count; i++) {
if((types[i] & PathPointTypePathTypeMask) == PathPointTypeBezier) { if((types[i] & PathPointTypePathTypeMask) == PathPointTypeBezier) {
if(i+2 < count && if(i+2 < count &&

View File

@ -181,8 +181,8 @@ static void test_createpath2(void)
GpPathData data; GpPathData data;
INT i, count, expect_count; INT i, count, expect_count;
PointF test_line_points[] = {{1.0,1.0}, {2.0,1.0}}; PointF test_line_points[] = {{1.0,1.0}, {2.0,1.0}, {2.0,2.0}};
BYTE test_line_types[] = {PathPointTypeStart, PathPointTypeLine}; 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}, 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}}; {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); status = GdipCreatePath2(test_line_points, test_line_types, 2, FillModeAlternate, NULL);
expect(InvalidParameter, status); 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 */ /* Zero-length line points do not get altered */
path = NULL;
test_line_points[1].X = test_line_points[0].X; test_line_points[1].X = test_line_points[0].X;
test_line_points[1].Y = test_line_points[0].Y; test_line_points[1].Y = test_line_points[0].Y;
status = GdipCreatePath2(test_line_points, test_line_types, 2, FillModeAlternate, &path); status = GdipCreatePath2(test_line_points, test_line_types, 2, FillModeAlternate, &path);