[4/5] gdiplus: GdipGetPathLastPoint implementation

Nikolay Sivov bunglehead at gmail.com
Sun Jun 29 04:02:20 CDT 2008


Changelog:
    - GdipGetPathLastPoint implementation

---
 dlls/gdiplus/gdiplus.spec         |    2 +-
 dlls/gdiplus/graphicspath.c       |   14 ++++++++++++++
 dlls/gdiplus/tests/graphicspath.c |   26 ++++++++++++++++++++++++++
 include/gdiplusflat.h             |    1 +
 4 files changed, 42 insertions(+), 1 deletions(-)

diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index 7e127d7..5ed1768 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -342,7 +342,7 @@
 @ stdcall GdipGetPathGradientSurroundColorsWithCount(ptr ptr ptr)
 @ stub GdipGetPathGradientTransform
 @ stub GdipGetPathGradientWrapMode
-@ stub GdipGetPathLastPoint
+@ stdcall GdipGetPathLastPoint(ptr ptr)
 @ stdcall GdipGetPathPoints(ptr ptr long)
 @ stdcall GdipGetPathPointsI(ptr ptr long)
 @ stdcall GdipGetPathTypes(ptr ptr long)
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c
index 1da6866..d067f79 100644
--- a/dlls/gdiplus/graphicspath.c
+++ b/dlls/gdiplus/graphicspath.c
@@ -551,6 +551,20 @@ GpStatus WINGDIPAPI GdipGetPathFillMode(GpPath *path, GpFillMode *fillmode)
     return Ok;
 }
 
+GpStatus WINGDIPAPI GdipGetPathLastPoint(GpPath* path, GpPointF* lastPoint)
+{
+    INT count;
+
+    if(!path || !lastPoint)
+        return InvalidParameter;
+
+    count = path->pathdata.Count;
+    if(count > 0)
+        *lastPoint = path->pathdata.Points[count-1];
+
+    return Ok;        
+}
+
 GpStatus WINGDIPAPI GdipGetPathPoints(GpPath *path, GpPointF* points, INT count)
 {
     if(!path)
diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c
index 9f65898..d2161ad 100644
--- a/dlls/gdiplus/tests/graphicspath.c
+++ b/dlls/gdiplus/tests/graphicspath.c
@@ -668,6 +668,31 @@ static void test_rect(void)
     GdipDeletePath(path);
 }
 
+static void test_lastpoint(void)
+{
+    GpStatus status;
+    GpPath *path;
+    GpPointF ptf;
+
+    GdipCreatePath(FillModeAlternate, &path);
+    status = GdipAddPathRectangle(path, 5.0, 5.0, 100.0, 50.0);
+    expect(Ok, status);
+    
+    /* invalid args */    
+    status = GdipGetPathLastPoint(NULL, &ptf);
+    expect(InvalidParameter, status);
+    status = GdipGetPathLastPoint(path, NULL);
+    expect(InvalidParameter, status);
+    status = GdipGetPathLastPoint(NULL, NULL);
+    expect(InvalidParameter, status);
+
+    status = GdipGetPathLastPoint(path, &ptf);
+    expect(Ok, status);
+    expect(TRUE, (ptf.X == 5.0) && (ptf.Y == 55.0));
+
+    GdipDeletePath(path);         
+}
+
 START_TEST(graphicspath)
 {
     struct GdiplusStartupInput gdiplusStartupInput;
@@ -690,6 +715,7 @@ START_TEST(graphicspath)
     test_linei();
     test_rect();
     test_polygon();
+    test_lastpoint();
 
     GdiplusShutdown(gdiplusToken);
 }
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 0903637..61b115a 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -238,6 +238,7 @@ GpStatus WINGDIPAPI GdipCreatePath2I(GDIPCONST GpPoint*,GDIPCONST BYTE*,INT,GpFi
 GpStatus WINGDIPAPI GdipDeletePath(GpPath*);
 GpStatus WINGDIPAPI GdipGetPathData(GpPath*,GpPathData*);
 GpStatus WINGDIPAPI GdipGetPathFillMode(GpPath*,GpFillMode*);
+GpStatus WINGDIPAPI GdipGetPathLastPoint(GpPath*,GpPointF*);
 GpStatus WINGDIPAPI GdipGetPathPoints(GpPath*,GpPointF*,INT);
 GpStatus WINGDIPAPI GdipGetPathPointsI(GpPath*,GpPoint*,INT);
 GpStatus WINGDIPAPI GdipGetPathTypes(GpPath*,BYTE*,INT);
-- 
1.4.4.4






More information about the wine-patches mailing list