diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index 9473f1b937d..d380d74c4c8 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -10,8 +10,8 @@ @ stdcall GdipAddPathClosedCurveI(ptr ptr long) @ stdcall GdipAddPathCurve2(ptr ptr long long) @ stdcall GdipAddPathCurve2I(ptr ptr long long) -@ stub GdipAddPathCurve3 -@ stub GdipAddPathCurve3I +@ stdcall GdipAddPathCurve3(ptr ptr long long long long) +@ stdcall GdipAddPathCurve3I(ptr ptr long long long long) @ stdcall GdipAddPathCurve(ptr ptr long) @ stdcall GdipAddPathCurveI(ptr ptr long) @ stdcall GdipAddPathEllipse(ptr long long long long) diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c index 20a3b2cb855..042d4a2f51e 100644 --- a/dlls/gdiplus/graphicspath.c +++ b/dlls/gdiplus/graphicspath.c @@ -524,6 +524,28 @@ GpStatus WINGDIPAPI GdipAddPathCurve2I(GpPath *path, GDIPCONST GpPoint *points, return stat; } +GpStatus WINGDIPAPI GdipAddPathCurve3(GpPath *path, GDIPCONST GpPointF *points, + INT count, INT offset, INT nseg, REAL tension) +{ + TRACE("(%p, %p, %d, %d, %d, %.2f)\n", path, points, count, offset, nseg, tension); + + if(!path || !points || offset + 1 >= count || count - offset < nseg + 1) + return InvalidParameter; + + return GdipAddPathCurve2(path, &points[offset], nseg + 1, tension); +} + +GpStatus WINGDIPAPI GdipAddPathCurve3I(GpPath *path, GDIPCONST GpPoint *points, + INT count, INT offset, INT nseg, REAL tension) +{ + TRACE("(%p, %p, %d, %d, %d, %.2f)\n", path, points, count, offset, nseg, tension); + + if(!path || !points || offset + 1 >= count || count - offset < nseg + 1) + return InvalidParameter; + + return GdipAddPathCurve2I(path, &points[offset], nseg + 1, tension); +} + GpStatus WINGDIPAPI GdipAddPathEllipse(GpPath *path, REAL x, REAL y, REAL width, REAL height) { diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c index 168c4b57ec6..416d80caa90 100644 --- a/dlls/gdiplus/tests/graphicspath.c +++ b/dlls/gdiplus/tests/graphicspath.c @@ -726,6 +726,15 @@ static path_test_t addcurve_path2[] = { {23.3, 13.3, PathPointTypeBezier, 0, 0}, /*10*/ {30.0, 10.0, PathPointTypeBezier, 0, 0} /*11*/ }; +static path_test_t addcurve_path3[] = { + {10.0, 10.0, PathPointTypeStart, 0, 0}, /*0*/ + {13.3, 16.7, PathPointTypeBezier, 0, 1}, /*1*/ + {3.3, 20.0, PathPointTypeBezier, 0, 0}, /*2*/ + {10.0, 20.0, PathPointTypeBezier, 0, 0}, /*3*/ + {16.7, 20.0, PathPointTypeBezier, 0, 0}, /*4*/ + {23.3, 13.3, PathPointTypeBezier, 0, 0}, /*5*/ + {30.0, 10.0, PathPointTypeBezier, 0, 0} /*6*/ + }; static void test_addcurve(void) { GpStatus status; @@ -765,6 +774,37 @@ static void test_addcurve(void) status = GdipAddPathCurve2(path, points, 4, 1.0); expect(Ok, status); ok_path(path, addcurve_path2, sizeof(addcurve_path2)/sizeof(path_test_t), FALSE); + + /* NULL args */ + GdipResetPath(path); + status = GdipAddPathCurve3(NULL, NULL, 0, 0, 0, 0.0); + expect(InvalidParameter, status); + status = GdipAddPathCurve3(path, NULL, 0, 0, 0, 0.0); + expect(InvalidParameter, status); + /* wrong count, offset.. */ + status = GdipAddPathCurve3(path, points, 0, 0, 0, 0.0); + expect(InvalidParameter, status); + status = GdipAddPathCurve3(path, points, 4, 0, 0, 0.0); + expect(InvalidParameter, status); + status = GdipAddPathCurve3(path, points, 4, 0, 4, 0.0); + expect(InvalidParameter, status); + status = GdipAddPathCurve3(path, points, 4, 1, 3, 0.0); + expect(InvalidParameter, status); + status = GdipAddPathCurve3(path, points, 4, 1, 0, 0.0); + expect(InvalidParameter, status); + status = GdipAddPathCurve3(path, points, 4, 3, 1, 0.0); + expect(InvalidParameter, status); + + /* use all points */ + status = GdipAddPathCurve3(path, points, 4, 0, 3, 1.0); + expect(Ok, status); + ok_path(path, addcurve_path, sizeof(addcurve_path)/sizeof(path_test_t), FALSE); + GdipResetPath(path); + + status = GdipAddPathCurve3(path, points, 4, 1, 2, 1.0); + expect(Ok, status); + ok_path(path, addcurve_path3, sizeof(addcurve_path3)/sizeof(path_test_t), FALSE); + GdipDeletePath(path); } diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 216b2f39eb9..1a39dee4055 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -256,6 +256,8 @@ GpStatus WINGDIPAPI GdipAddPathCurve(GpPath*,GDIPCONST GpPointF*,INT); GpStatus WINGDIPAPI GdipAddPathCurveI(GpPath*,GDIPCONST GpPoint*,INT); GpStatus WINGDIPAPI GdipAddPathCurve2(GpPath*,GDIPCONST GpPointF*,INT,REAL); GpStatus WINGDIPAPI GdipAddPathCurve2I(GpPath*,GDIPCONST GpPoint*,INT,REAL); +GpStatus WINGDIPAPI GdipAddPathCurve3(GpPath*,GDIPCONST GpPointF*,INT,INT,INT,REAL); +GpStatus WINGDIPAPI GdipAddPathCurve3I(GpPath*,GDIPCONST GpPoint*,INT,INT,INT,REAL); GpStatus WINGDIPAPI GdipAddPathEllipse(GpPath*,REAL,REAL,REAL,REAL); GpStatus WINGDIPAPI GdipAddPathEllipseI(GpPath*,INT,INT,INT,INT); GpStatus WINGDIPAPI GdipAddPathLine(GpPath*,REAL,REAL,REAL,REAL);