Commit 7cddc579 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

gdiplus: Added GdipAddPathCurve3/GdipAddPathCurve3I with tests.

parent 48e213b4
......@@ -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)
......
......@@ -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)
{
......
......@@ -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);
}
......
......@@ -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);
......
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