Nikolay Sivov : gdiplus: Implemented GdipPathIterHasCurve with tests.

Alexandre Julliard julliard at winehq.org
Fri Jul 4 13:59:20 CDT 2008


Module: wine
Branch: master
Commit: c47b16765711dd8551eb00b0fb219ec3508803b3
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=c47b16765711dd8551eb00b0fb219ec3508803b3

Author: Nikolay Sivov <bunglehead at gmail.com>
Date:   Thu Jul  3 18:34:36 2008 +0400

gdiplus: Implemented GdipPathIterHasCurve with tests.

---

 dlls/gdiplus/gdiplus.spec         |    2 +-
 dlls/gdiplus/pathiterator.c       |   18 ++++++++++++++++
 dlls/gdiplus/tests/pathiterator.c |   40 +++++++++++++++++++++++++++++++++++++
 include/gdiplusflat.h             |    1 +
 4 files changed, 60 insertions(+), 1 deletions(-)

diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index 233c101..9492065 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 eb2cf34..abb5dbb 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 24c6990..baeb22b 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 46b05c5..9ef7ad7 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,




More information about the wine-cvs mailing list