gdiplus: Implemented GdipPathIterNextMarkerPath with tests.
This commit is contained in:
parent
9c62181a38
commit
af4562c34d
|
@ -457,7 +457,7 @@
|
|||
@ stdcall GdipPathIterHasCurve(ptr ptr)
|
||||
@ stdcall GdipPathIterIsValid(ptr ptr)
|
||||
@ stdcall GdipPathIterNextMarker(ptr ptr ptr ptr)
|
||||
@ stub GdipPathIterNextMarkerPath
|
||||
@ stdcall GdipPathIterNextMarkerPath(ptr ptr ptr)
|
||||
@ stub GdipPathIterNextPathType
|
||||
@ stdcall GdipPathIterNextSubpath(ptr ptr ptr ptr ptr)
|
||||
@ stdcall GdipPathIterNextSubpathPath(ptr ptr ptr ptr)
|
||||
|
|
|
@ -153,6 +153,30 @@ GpStatus WINGDIPAPI GdipPathIterNextMarker(GpPathIterator* iterator, INT *result
|
|||
return Ok;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipPathIterNextMarkerPath(GpPathIterator* iterator, INT* result,
|
||||
GpPath* path)
|
||||
{
|
||||
INT start, end;
|
||||
|
||||
if(!iterator || !result)
|
||||
return InvalidParameter;
|
||||
|
||||
GdipPathIterNextMarker(iterator, result, &start, &end);
|
||||
/* return path */
|
||||
if(((*result) > 0) && path){
|
||||
GdipResetPath(path);
|
||||
|
||||
if(!lengthen_path(path, *result))
|
||||
return OutOfMemory;
|
||||
|
||||
memcpy(path->pathdata.Points, &(iterator->pathdata.Points[start]), sizeof(GpPointF)*(*result));
|
||||
memcpy(path->pathdata.Types, &(iterator->pathdata.Types[start]), sizeof(BYTE)*(*result));
|
||||
path->pathdata.Count = *result;
|
||||
}
|
||||
|
||||
return Ok;
|
||||
}
|
||||
|
||||
GpStatus WINGDIPAPI GdipPathIterNextSubpath(GpPathIterator* iterator,
|
||||
INT *resultCount, INT* startIndex, INT* endIndex, BOOL* isClosed)
|
||||
{
|
||||
|
|
|
@ -171,6 +171,89 @@ static void test_nextmarker(void)
|
|||
GdipDeletePath(path);
|
||||
}
|
||||
|
||||
static void test_nextmarkerpath(void)
|
||||
{
|
||||
GpPath *path, *retpath;
|
||||
GpPathIterator *iter;
|
||||
GpStatus stat;
|
||||
INT result, count;
|
||||
|
||||
GdipCreatePath(FillModeAlternate, &path);
|
||||
|
||||
/* NULL */
|
||||
stat = GdipPathIterNextMarkerPath(NULL, NULL, NULL);
|
||||
expect(InvalidParameter, stat);
|
||||
stat = GdipPathIterNextMarkerPath(NULL, &result, NULL);
|
||||
expect(InvalidParameter, stat);
|
||||
stat = GdipPathIterNextMarkerPath(NULL, &result, path);
|
||||
expect(InvalidParameter, stat);
|
||||
|
||||
GdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
|
||||
|
||||
/* no markers */
|
||||
GdipCreatePath(FillModeAlternate, &retpath);
|
||||
GdipCreatePathIter(&iter, path);
|
||||
result = -1;
|
||||
stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
|
||||
expect(Ok, stat);
|
||||
expect(4, result);
|
||||
count = -1;
|
||||
GdipGetPointCount(retpath, &count);
|
||||
expect(4, count);
|
||||
result = -1;
|
||||
stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
|
||||
expect(Ok, stat);
|
||||
expect(0, result);
|
||||
count = -1;
|
||||
GdipGetPointCount(retpath, &count);
|
||||
expect(4, count);
|
||||
GdipDeletePathIter(iter);
|
||||
GdipDeletePath(retpath);
|
||||
|
||||
/* one marker */
|
||||
GdipSetPathMarker(path);
|
||||
GdipCreatePath(FillModeAlternate, &retpath);
|
||||
GdipCreatePathIter(&iter, path);
|
||||
result = -1;
|
||||
stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
|
||||
expect(Ok, stat);
|
||||
expect(4, result);
|
||||
count = -1;
|
||||
GdipGetPointCount(retpath, &count);
|
||||
expect(4, count);
|
||||
result = -1;
|
||||
stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
|
||||
expect(Ok, stat);
|
||||
expect(0, result);
|
||||
count = -1;
|
||||
GdipGetPointCount(retpath, &count);
|
||||
expect(4, count);
|
||||
GdipDeletePathIter(iter);
|
||||
GdipDeletePath(retpath);
|
||||
|
||||
/* two markers */
|
||||
GdipAddPathLine(path, 0.0, 0.0, 10.0, 30.0);
|
||||
GdipSetPathMarker(path);
|
||||
GdipCreatePath(FillModeAlternate, &retpath);
|
||||
GdipCreatePathIter(&iter, path);
|
||||
result = -1;
|
||||
stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
|
||||
expect(Ok, stat);
|
||||
expect(4, result);
|
||||
result = -1;
|
||||
stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
|
||||
expect(Ok, stat);
|
||||
expect(2, result);
|
||||
result = -1;
|
||||
stat = GdipPathIterNextMarkerPath(iter, &result, retpath);
|
||||
expect(Ok, stat);
|
||||
expect(0, result);
|
||||
GdipDeletePathIter(iter);
|
||||
GdipDeletePath(retpath);
|
||||
|
||||
GdipDeletePath(path);
|
||||
}
|
||||
|
||||
static void test_getsubpathcount(void)
|
||||
{
|
||||
GpPath *path;
|
||||
|
@ -408,6 +491,7 @@ START_TEST(pathiterator)
|
|||
test_constructor_destructor();
|
||||
test_hascurve();
|
||||
test_nextmarker();
|
||||
test_nextmarkerpath();
|
||||
test_getsubpathcount();
|
||||
test_isvalid();
|
||||
test_nextsubpathpath();
|
||||
|
|
|
@ -328,6 +328,7 @@ GpStatus WINGDIPAPI GdipDeletePathIter(GpPathIterator*);
|
|||
GpStatus WINGDIPAPI GdipPathIterCopyData(GpPathIterator*,INT*,GpPointF*,BYTE*,
|
||||
INT,INT);
|
||||
GpStatus WINGDIPAPI GdipPathIterNextMarker(GpPathIterator*,INT*,INT*,INT*);
|
||||
GpStatus WINGDIPAPI GdipPathIterNextMarkerPath(GpPathIterator*,INT*,GpPath*);
|
||||
GpStatus WINGDIPAPI GdipPathIterNextSubpath(GpPathIterator*,INT*,INT*,INT*,BOOL*);
|
||||
GpStatus WINGDIPAPI GdipPathIterNextSubpathPath(GpPathIterator*,INT*,GpPath*,BOOL*);
|
||||
GpStatus WINGDIPAPI GdipPathIterRewind(GpPathIterator*);
|
||||
|
|
Loading…
Reference in New Issue