[6/7] gdiplus: Implemented GdipGetPathData with test
Nikolay Sivov
bunglehead at gmail.com
Wed Jun 25 10:31:03 CDT 2008
Paul Vriens wrote:
> Nikolay Sivov wrote:
>> Changelog:
>> - 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 70864ba..ed02a77 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 4cbd33a..284b64c 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 5ce32b2..e4f5d62 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);
>
> Hi,
>
> We seem to have numerous failures (and even more serious, test
> crashes) with these tests on Windows. I did check a few things myself
> but I'm lacking the knowledge to look further in to this.
>
> Running the tests on Wine succeeds for me, when I however run the same
> graphicspath tests on Wine with a native gdiplus.dll (through
> winetricks) this test is also crashing.
>
Not fails but crashes? There could be problem with memory freeing I
think. I'll take a look at it. Thanks.
More information about the wine-devel
mailing list