diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index 233c10108dd..9492065fc8e 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -454,7 +454,7 @@ @ stdcall GdipPathIterEnumerate(ptr ptr ptr ptr long) @ stdcall GdipPathIterGetCount(ptr ptr) @ stub GdipPathIterGetSubpathCount -@ stub GdipPathIterHasCurve +@ stdcall GdipPathIterHasCurve(ptr ptr) @ stub GdipPathIterIsValid @ stub GdipPathIterNextMarker @ stub GdipPathIterNextMarkerPath diff --git a/dlls/gdiplus/pathiterator.c b/dlls/gdiplus/pathiterator.c index eb2cf3436bb..abb5dbb30f9 100644 --- a/dlls/gdiplus/pathiterator.c +++ b/dlls/gdiplus/pathiterator.c @@ -87,6 +87,24 @@ GpStatus WINGDIPAPI GdipPathIterCopyData(GpPathIterator* iterator, return Ok; } +GpStatus WINGDIPAPI GdipPathIterHasCurve(GpPathIterator* iterator, BOOL* hasCurve) +{ + INT i; + + if(!iterator) + return InvalidParameter; + + *hasCurve = FALSE; + + for(i = 0; i < iterator->pathdata.Count; i++) + if((iterator->pathdata.Types[i] & PathPointTypePathTypeMask) == PathPointTypeBezier){ + *hasCurve = TRUE; + break; + } + + return Ok; +} + GpStatus WINGDIPAPI GdipPathIterNextSubpath(GpPathIterator* iterator, INT *resultCount, INT* startIndex, INT* endIndex, BOOL* isClosed) { diff --git a/dlls/gdiplus/tests/pathiterator.c b/dlls/gdiplus/tests/pathiterator.c index 24c69905471..baeb22ba6f2 100644 --- a/dlls/gdiplus/tests/pathiterator.c +++ b/dlls/gdiplus/tests/pathiterator.c @@ -51,6 +51,45 @@ static void test_constructor_destructor(void) GdipDeletePath(path); } +static void test_hascurve(void) +{ + GpPath *path; + GpPathIterator *iter; + GpStatus stat; + BOOL hasCurve; + + GdipCreatePath(FillModeAlternate, &path); + GdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0); + + stat = GdipCreatePathIter(&iter, path); + expect(Ok, stat); + + /* NULL args + BOOL out argument is local in wrapper class method, + so it always has not-NULL address */ + stat = GdipPathIterHasCurve(NULL, &hasCurve); + expect(InvalidParameter, stat); + + /* valid args */ + stat = GdipPathIterHasCurve(iter, &hasCurve); + expect(Ok, stat); + expect(FALSE, hasCurve); + + GdipDeletePathIter(iter); + + GdipAddPathEllipse(path, 0.0, 0.0, 35.0, 70.0); + + stat = GdipCreatePathIter(&iter, path); + expect(Ok, stat); + + stat = GdipPathIterHasCurve(iter, &hasCurve); + expect(Ok, stat); + expect(TRUE, hasCurve); + + GdipDeletePathIter(iter); + GdipDeletePath(path); +} + START_TEST(pathiterator) { struct GdiplusStartupInput gdiplusStartupInput; @@ -64,6 +103,7 @@ START_TEST(pathiterator) GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); test_constructor_destructor(); + test_hascurve(); GdiplusShutdown(gdiplusToken); } diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index 46b05c59fc8..9ef7ad75b5f 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -285,6 +285,7 @@ GpStatus WINGDIPAPI GdipPathIterNextSubpath(GpPathIterator*,INT*,INT*,INT*,BOOL* GpStatus WINGDIPAPI GdipPathIterRewind(GpPathIterator*); GpStatus WINGDIPAPI GdipPathIterGetCount(GpPathIterator*,INT*); GpStatus WINGDIPAPI GdipPathIterEnumerate(GpPathIterator*,INT*,GpPointF*,BYTE*,INT); +GpStatus WINGDIPAPI GdipPathIterHasCurve(GpPathIterator*,BOOL*); GpStatus WINGDIPAPI GdipCloneCustomLineCap(GpCustomLineCap*,GpCustomLineCap**); GpStatus WINGDIPAPI GdipCreateCustomLineCap(GpPath*,GpPath*,GpLineCap,REAL,