Nikolay Sivov : gdiplus: GdipGetPathLastPoint implementation.
Alexandre Julliard
julliard at winehq.org
Tue Jul 1 08:27:44 CDT 2008
Module: wine
Branch: master
Commit: 5863eabdfa7fe0af78b9154d073f09faf4b3e8d1
URL: http://source.winehq.org/git/wine.git/?a=commit;h=5863eabdfa7fe0af78b9154d073f09faf4b3e8d1
Author: Nikolay Sivov <bunglehead at gmail.com>
Date: Sun Jun 29 13:02:20 2008 +0400
gdiplus: 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 5cbc5ba..8b23d2d 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..6e5747f 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 286cba6..9f9af9c 100644
--- a/dlls/gdiplus/tests/graphicspath.c
+++ b/dlls/gdiplus/tests/graphicspath.c
@@ -671,6 +671,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;
@@ -693,6 +718,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 87135e3..5caeb72 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);
More information about the wine-cvs
mailing list