Nikolay Sivov : gdiplus: Implemented GdipGetPathData with test.
Alexandre Julliard
julliard at winehq.org
Fri Jun 20 06:22:46 CDT 2008
Module: wine
Branch: master
Commit: 3bacdaf664593b720afeb55a94225aab5aa04c80
URL: http://source.winehq.org/git/wine.git/?a=commit;h=3bacdaf664593b720afeb55a94225aab5aa04c80
Author: Nikolay Sivov <bunglehead at gmail.com>
Date: Wed Jun 18 11:33:06 2008 +0400
gdiplus: Implemented GdipGetPathData with test.
---
dlls/gdiplus/gdiplus.spec | 2 +-
dlls/gdiplus/graphicspath.c | 22 ++++++++++++++++++++++
dlls/gdiplus/tests/graphicspath.c | 23 +++++++++++++++++++++++
include/gdiplusflat.h | 1 +
4 files changed, 47 insertions(+), 1 deletions(-)
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index 3d01c16..23346fc 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -323,7 +323,7 @@
@ stub GdipGetNearestColor
@ stdcall GdipGetPageScale(ptr ptr)
@ stdcall GdipGetPageUnit(ptr ptr)
-@ stub GdipGetPathData
+@ stdcall GdipGetPathData(ptr ptr)
@ stdcall GdipGetPathFillMode(ptr ptr)
@ stub GdipGetPathGradientBlend
@ stub GdipGetPathGradientBlendCount
diff --git a/dlls/gdiplus/graphicspath.c b/dlls/gdiplus/graphicspath.c
index 3782ca7..24f25e1 100644
--- a/dlls/gdiplus/graphicspath.c
+++ b/dlls/gdiplus/graphicspath.c
@@ -479,6 +479,28 @@ GpStatus WINGDIPAPI GdipDeletePath(GpPath *path)
return Ok;
}
+GpStatus WINGDIPAPI GdipGetPathData(GpPath *path, GpPathData* pathData)
+{
+ if(!path || !pathData)
+ return InvalidParameter;
+
+ pathData->Count = path->pathdata.Count;
+
+ pathData->Points = GdipAlloc(sizeof(PointF) * pathData->Count);
+ if(!pathData->Points)
+ return OutOfMemory;
+
+ pathData->Types = GdipAlloc(pathData->Count);
+ if(!pathData->Points)
+ return OutOfMemory;
+
+ /* copy data */
+ memcpy(pathData->Points, path->pathdata.Points, sizeof(PointF) * pathData->Count);
+ memcpy(pathData->Types , path->pathdata.Types , pathData->Count);
+
+ return Ok;
+}
+
GpStatus WINGDIPAPI GdipGetPathFillMode(GpPath *path, GpFillMode *fillmode)
{
if(!path || !fillmode)
diff --git a/dlls/gdiplus/tests/graphicspath.c b/dlls/gdiplus/tests/graphicspath.c
index 6436b1a..672f6da 100644
--- a/dlls/gdiplus/tests/graphicspath.c
+++ b/dlls/gdiplus/tests/graphicspath.c
@@ -149,6 +149,28 @@ static void test_constructor_destructor(void)
expect(Ok, status);
}
+static void test_getpathdata(void)
+{
+ GpPath *path;
+ GpPathData data;
+ GpStatus status;
+
+ GdipCreatePath(FillModeAlternate, &path);
+ status = GdipAddPathLine(path, 5.0, 5.0, 100.0, 50.0);
+ expect(Ok, status);
+
+ status = GdipGetPathData(path, &data);
+ expect(Ok, status);
+ expect((data.Count == 2), TRUE);
+ expect((data.Points[0].X == 5.0) && (data.Points[0].Y == 5.0) &&
+ (data.Points[1].X == 100.0) && (data.Points[1].Y == 50.0), TRUE);
+ expect((data.Types[0] == PathPointTypeStart) && (data.Types[1] == PathPointTypeLine), TRUE);
+
+ GdipFree(data.Points);
+ GdipFree(data.Types);
+ GdipDeletePath(path);
+}
+
static path_test_t line2_path[] = {
{0.0, 50.0, PathPointTypeStart, 0, 0}, /*0*/
{5.0, 45.0, PathPointTypeLine, 0, 0}, /*1*/
@@ -605,6 +627,7 @@ START_TEST(graphicspath)
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
test_constructor_destructor();
+ test_getpathdata();
test_line2();
test_arc();
test_worldbounds();
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 152b6da..58659fe 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -225,6 +225,7 @@ GpStatus WINGDIPAPI GdipCreatePath2(GDIPCONST GpPointF*,GDIPCONST BYTE*,INT,
GpFillMode,GpPath**);
GpStatus WINGDIPAPI GdipCreatePath2I(GDIPCONST GpPoint*,GDIPCONST BYTE*,INT,GpFillMode,GpPath**);
GpStatus WINGDIPAPI GdipDeletePath(GpPath*);
+GpStatus WINGDIPAPI GdipGetPathData(GpPath*,GpPathData*);
GpStatus WINGDIPAPI GdipGetPathFillMode(GpPath*,GpFillMode*);
GpStatus WINGDIPAPI GdipGetPathPoints(GpPath*,GpPointF*,INT);
GpStatus WINGDIPAPI GdipGetPathPointsI(GpPath*,GpPoint*,INT);
More information about the wine-cvs
mailing list