gdiplus: Stub for GdipFlattenPath with tests.

This commit is contained in:
Nikolay Sivov 2008-08-29 15:47:05 +04:00 committed by Alexandre Julliard
parent f8096d2b84
commit 5c1edcfaad
4 changed files with 90 additions and 1 deletions

View File

@ -233,7 +233,7 @@
@ stdcall GdipFillRegion(ptr ptr ptr) @ stdcall GdipFillRegion(ptr ptr ptr)
@ stdcall GdipFindFirstImageItem(ptr ptr) @ stdcall GdipFindFirstImageItem(ptr ptr)
@ stub GdipFindNextImageItem @ stub GdipFindNextImageItem
@ stub GdipFlattenPath @ stdcall GdipFlattenPath(ptr ptr long)
@ stdcall GdipFlush(ptr long) @ stdcall GdipFlush(ptr long)
@ stdcall GdipFree(ptr) @ stdcall GdipFree(ptr)
@ stub GdipGetAdjustableArrowCapFillState @ stub GdipGetAdjustableArrowCapFillState

View File

@ -816,6 +816,19 @@ GpStatus WINGDIPAPI GdipDeletePath(GpPath *path)
return Ok; return Ok;
} }
GpStatus WINGDIPAPI GdipFlattenPath(GpPath *path, GpMatrix* matrix, REAL flatness)
{
static int calls;
if(!path)
return InvalidParameter;
if(!(calls++))
FIXME("not implemented\n");
return NotImplemented;
}
GpStatus WINGDIPAPI GdipGetPathData(GpPath *path, GpPathData* pathData) GpStatus WINGDIPAPI GdipGetPathData(GpPath *path, GpPathData* pathData)
{ {
TRACE("(%p, %p)\n", path, pathData); TRACE("(%p, %p)\n", path, pathData);

View File

@ -886,6 +886,80 @@ static void test_addpie(void)
GdipDeletePath(path); GdipDeletePath(path);
} }
static path_test_t flattenellipse_path[] = {
{100.0, 25.0,PathPointTypeStart, 0, 0}, /*0*/
{99.0, 30.0, PathPointTypeLine, 0, 1}, /*1*/
{96.0, 34.8, PathPointTypeLine, 0, 1}, /*2*/
{91.5, 39.0, PathPointTypeLine, 0, 1}, /*3*/
{85.5, 42.8, PathPointTypeLine, 0, 1}, /*4*/
{69.5, 48.0, PathPointTypeLine, 0, 1}, /*5*/
{50.0, 50.0, PathPointTypeLine, 0, 1}, /*6*/
{30.5, 48.0, PathPointTypeLine, 0, 1}, /*7*/
{14.8, 42.8, PathPointTypeLine, 0, 1}, /*8*/
{8.5, 39.0, PathPointTypeLine, 0, 1}, /*9*/
{4.0, 34.8, PathPointTypeLine, 0, 1}, /*10*/
{1.0, 30.0, PathPointTypeLine, 0, 1}, /*11*/
{0.0, 25.0, PathPointTypeLine, 0, 1}, /*12*/
{1.0, 20.0, PathPointTypeLine, 0, 1}, /*13*/
{4.0, 15.3, PathPointTypeLine, 0, 1}, /*14*/
{8.5, 11.0, PathPointTypeLine, 0, 1}, /*15*/
{14.8, 7.3, PathPointTypeLine, 0, 1}, /*16*/
{30.5, 2.0, PathPointTypeLine, 0, 1}, /*17*/
{50.0, 0.0, PathPointTypeLine, 0, 1}, /*18*/
{69.5, 2.0, PathPointTypeLine, 0, 1}, /*19*/
{85.5, 7.3, PathPointTypeLine, 0, 1}, /*20*/
{91.5, 11.0, PathPointTypeLine, 0, 1}, /*21*/
{96.0, 15.3, PathPointTypeLine, 0, 1}, /*22*/
{99.0, 20.0, PathPointTypeLine, 0, 1}, /*23*/
{100.0,25.0, PathPointTypeLine | PathPointTypeCloseSubpath, 0, 1} /*24*/
};
static path_test_t flattenarc_path[] = {
{100.0, 25.0,PathPointTypeStart, 0, 0}, /*0*/
{99.0, 30.0, PathPointTypeLine, 0, 1}, /*1*/
{96.0, 34.8, PathPointTypeLine, 0, 1}, /*2*/
{91.5, 39.0, PathPointTypeLine, 0, 1}, /*3*/
{85.5, 42.8, PathPointTypeLine, 0, 1}, /*4*/
{69.5, 48.0, PathPointTypeLine, 0, 1}, /*5*/
{50.0, 50.0, PathPointTypeLine, 0, 1} /*6*/
};
static void test_flatten(void)
{
GpStatus status;
GpPath *path;
GpMatrix *m;
status = GdipCreatePath(FillModeAlternate, &path);
expect(Ok, status);
status = GdipCreateMatrix(&m);
expect(Ok, status);
/* NULL arguments */
status = GdipFlattenPath(NULL, NULL, 0.0);
expect(InvalidParameter, status);
status = GdipFlattenPath(NULL, m, 0.0);
expect(InvalidParameter, status);
status = GdipAddPathEllipse(path, 0.0, 0.0, 100.0, 50.0);
expect(Ok, status);
status = GdipFlattenPath(path, NULL, 1.0);
todo_wine expect(Ok, status);
ok_path(path, flattenellipse_path, sizeof(flattenellipse_path)/sizeof(path_test_t), TRUE);
status = GdipResetPath(path);
expect(Ok, status);
status = GdipAddPathArc(path, 0.0, 0.0, 100.0, 50.0, 0.0, 90.0);
expect(Ok, status);
status = GdipFlattenPath(path, NULL, 1.0);
todo_wine expect(Ok, status);
ok_path(path, flattenarc_path, sizeof(flattenarc_path)/sizeof(path_test_t), TRUE);
GdipDeleteMatrix(m);
GdipDeletePath(path);
}
START_TEST(graphicspath) START_TEST(graphicspath)
{ {
struct GdiplusStartupInput gdiplusStartupInput; struct GdiplusStartupInput gdiplusStartupInput;
@ -913,6 +987,7 @@ START_TEST(graphicspath)
test_addclosedcurve(); test_addclosedcurve();
test_reverse(); test_reverse();
test_addpie(); test_addpie();
test_flatten();
GdiplusShutdown(gdiplusToken); GdiplusShutdown(gdiplusToken);
} }

View File

@ -288,6 +288,7 @@ GpStatus WINGDIPAPI GdipCreatePath2(GDIPCONST GpPointF*,GDIPCONST BYTE*,INT,
GpFillMode,GpPath**); GpFillMode,GpPath**);
GpStatus WINGDIPAPI GdipCreatePath2I(GDIPCONST GpPoint*,GDIPCONST BYTE*,INT,GpFillMode,GpPath**); GpStatus WINGDIPAPI GdipCreatePath2I(GDIPCONST GpPoint*,GDIPCONST BYTE*,INT,GpFillMode,GpPath**);
GpStatus WINGDIPAPI GdipDeletePath(GpPath*); GpStatus WINGDIPAPI GdipDeletePath(GpPath*);
GpStatus WINGDIPAPI GdipFlattenPath(GpPath*,GpMatrix*,REAL);
GpStatus WINGDIPAPI GdipGetPathData(GpPath*,GpPathData*); GpStatus WINGDIPAPI GdipGetPathData(GpPath*,GpPathData*);
GpStatus WINGDIPAPI GdipGetPathFillMode(GpPath*,GpFillMode*); GpStatus WINGDIPAPI GdipGetPathFillMode(GpPath*,GpFillMode*);
GpStatus WINGDIPAPI GdipGetPathLastPoint(GpPath*,GpPointF*); GpStatus WINGDIPAPI GdipGetPathLastPoint(GpPath*,GpPointF*);