gdiplus: implemented GdipPathIterNextMarkerPath with tests
Nikolay Sivov
bunglehead at gmail.com
Tue Aug 19 02:53:22 CDT 2008
Changelog:
- Implemented GdipPathIterNextMarkerPath with tests
---
dlls/gdiplus/gdiplus.spec | 2 +-
dlls/gdiplus/pathiterator.c | 24 ++++++++++
dlls/gdiplus/tests/pathiterator.c | 84 +++++++++++++++++++++++++++++++++++++
include/gdiplusflat.h | 1 +
4 files changed, 110 insertions(+), 1 deletions(-)
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index d3eaeb6..a00140f 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -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)
diff --git a/dlls/gdiplus/pathiterator.c b/dlls/gdiplus/pathiterator.c
index afb4f34..d6a6850 100644
--- a/dlls/gdiplus/pathiterator.c
+++ b/dlls/gdiplus/pathiterator.c
@@ -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)
{
diff --git a/dlls/gdiplus/tests/pathiterator.c b/dlls/gdiplus/tests/pathiterator.c
index 9cbed13..6995b18 100644
--- a/dlls/gdiplus/tests/pathiterator.c
+++ b/dlls/gdiplus/tests/pathiterator.c
@@ -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();
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 3fc7657..ed97542 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -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*);
--
1.4.4.4
More information about the wine-patches
mailing list