gdiplus: Implementation of GdipPathIterGetSubpathCount with tests.

This commit is contained in:
Nikolay Sivov 2008-07-05 13:02:51 +04:00 committed by Alexandre Julliard
parent 0a9937c534
commit 20501e4ca8
4 changed files with 62 additions and 1 deletions

View File

@ -453,7 +453,7 @@
@ stdcall GdipPathIterCopyData(ptr ptr ptr ptr long long) @ stdcall GdipPathIterCopyData(ptr ptr ptr ptr long long)
@ stdcall GdipPathIterEnumerate(ptr ptr ptr ptr long) @ stdcall GdipPathIterEnumerate(ptr ptr ptr ptr long)
@ stdcall GdipPathIterGetCount(ptr ptr) @ stdcall GdipPathIterGetCount(ptr ptr)
@ stub GdipPathIterGetSubpathCount @ stdcall GdipPathIterGetSubpathCount(ptr ptr)
@ stdcall GdipPathIterHasCurve(ptr ptr) @ stdcall GdipPathIterHasCurve(ptr ptr)
@ stub GdipPathIterIsValid @ stub GdipPathIterIsValid
@ stdcall GdipPathIterNextMarker(ptr ptr ptr ptr) @ stdcall GdipPathIterNextMarker(ptr ptr ptr ptr)

View File

@ -105,6 +105,22 @@ GpStatus WINGDIPAPI GdipPathIterHasCurve(GpPathIterator* iterator, BOOL* hasCurv
return Ok; return Ok;
} }
GpStatus WINGDIPAPI GdipPathIterGetSubpathCount(GpPathIterator* iterator, INT* count)
{
INT i;
if(!iterator || !count)
return InvalidParameter;
*count = 0;
for(i = 0; i < iterator->pathdata.Count; i++){
if(iterator->pathdata.Types[i] == PathPointTypeStart)
(*count)++;
}
return Ok;
}
GpStatus WINGDIPAPI GdipPathIterNextMarker(GpPathIterator* iterator, INT *resultCount, GpStatus WINGDIPAPI GdipPathIterNextMarker(GpPathIterator* iterator, INT *resultCount,
INT* startIndex, INT* endIndex) INT* startIndex, INT* endIndex)
{ {

View File

@ -146,6 +146,49 @@ static void test_nextmarker(void)
GdipDeletePath(path); GdipDeletePath(path);
} }
static void test_getsubpathcount(void)
{
GpPath *path;
GpPathIterator *iter;
GpStatus stat;
INT count;
/* NULL args */
stat = GdipPathIterGetSubpathCount(NULL, NULL);
expect(InvalidParameter, stat);
stat = GdipPathIterGetSubpathCount(NULL, &count);
expect(InvalidParameter, stat);
GdipCreatePath(FillModeAlternate, &path);
/* empty path */
GdipCreatePathIter(&iter, path);
stat = GdipPathIterGetSubpathCount(iter, &count);
expect(Ok, stat);
expect(0, count);
GdipDeletePathIter(iter);
GdipAddPathLine(path, 5.0, 5.0, 100.0, 50.0);
/* open figure */
GdipCreatePathIter(&iter, path);
stat = GdipPathIterGetSubpathCount(iter, &count);
expect(Ok, stat);
expect(1, count);
GdipDeletePathIter(iter);
/* manually start new figure */
GdipStartPathFigure(path);
GdipAddPathLine(path, 50.0, 50.0, 110.0, 40.0);
GdipCreatePathIter(&iter, path);
stat = GdipPathIterGetSubpathCount(iter, &count);
expect(Ok, stat);
expect(2, count);
GdipDeletePathIter(iter);
GdipDeletePath(path);
}
START_TEST(pathiterator) START_TEST(pathiterator)
{ {
struct GdiplusStartupInput gdiplusStartupInput; struct GdiplusStartupInput gdiplusStartupInput;
@ -161,6 +204,7 @@ START_TEST(pathiterator)
test_constructor_destructor(); test_constructor_destructor();
test_hascurve(); test_hascurve();
test_nextmarker(); test_nextmarker();
test_getsubpathcount();
GdiplusShutdown(gdiplusToken); GdiplusShutdown(gdiplusToken);
} }

View File

@ -285,6 +285,7 @@ GpStatus WINGDIPAPI GdipPathIterNextMarker(GpPathIterator*,INT*,INT*,INT*);
GpStatus WINGDIPAPI GdipPathIterNextSubpath(GpPathIterator*,INT*,INT*,INT*,BOOL*); GpStatus WINGDIPAPI GdipPathIterNextSubpath(GpPathIterator*,INT*,INT*,INT*,BOOL*);
GpStatus WINGDIPAPI GdipPathIterRewind(GpPathIterator*); GpStatus WINGDIPAPI GdipPathIterRewind(GpPathIterator*);
GpStatus WINGDIPAPI GdipPathIterGetCount(GpPathIterator*,INT*); GpStatus WINGDIPAPI GdipPathIterGetCount(GpPathIterator*,INT*);
GpStatus WINGDIPAPI GdipPathIterGetSubpathCount(GpPathIterator*,INT*);
GpStatus WINGDIPAPI GdipPathIterEnumerate(GpPathIterator*,INT*,GpPointF*,BYTE*,INT); GpStatus WINGDIPAPI GdipPathIterEnumerate(GpPathIterator*,INT*,GpPointF*,BYTE*,INT);
GpStatus WINGDIPAPI GdipPathIterHasCurve(GpPathIterator*,BOOL*); GpStatus WINGDIPAPI GdipPathIterHasCurve(GpPathIterator*,BOOL*);