Module: wine Branch: master Commit: 085082897a47fec1113fad66b38d2129c1123acc URL: http://source.winehq.org/git/wine.git/?a=commit;h=085082897a47fec1113fad66b3...
Author: Evan Stade estade@gmail.com Date: Mon Jul 16 19:45:02 2007 -0700
gdiplus: Initial path iterator implementation.
---
dlls/gdiplus/Makefile.in | 1 + dlls/gdiplus/gdiplus.spec | 4 +- dlls/gdiplus/gdiplus_private.h | 7 ++++ dlls/gdiplus/pathiterator.c | 64 ++++++++++++++++++++++++++++++++++++++++ include/gdiplusflat.h | 3 ++ include/gdiplusgpstubs.h | 2 + 6 files changed, 79 insertions(+), 2 deletions(-)
diff --git a/dlls/gdiplus/Makefile.in b/dlls/gdiplus/Makefile.in index 85c1f27..f4bf072 100644 --- a/dlls/gdiplus/Makefile.in +++ b/dlls/gdiplus/Makefile.in @@ -12,6 +12,7 @@ C_SRCS = \ graphics.c \ graphicspath.c \ matrix.c \ + pathiterator.c \ pen.c
@MAKE_DLL_RULES@ diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec index 5f5b3b9..b1d9490 100644 --- a/dlls/gdiplus/gdiplus.spec +++ b/dlls/gdiplus/gdiplus.spec @@ -110,7 +110,7 @@ @ stub GdipCreatePathGradient @ stub GdipCreatePathGradientFromPath @ stub GdipCreatePathGradientI -@ stub GdipCreatePathIter +@ stdcall GdipCreatePathIter(ptr ptr) @ stdcall GdipCreatePen1(long long long ptr) @ stub GdipCreatePen2 @ stub GdipCreateRegion @@ -135,7 +135,7 @@ @ stdcall GdipDeleteGraphics(ptr) @ stdcall GdipDeleteMatrix(ptr) @ stdcall GdipDeletePath(ptr) -@ stub GdipDeletePathIter +@ stdcall GdipDeletePathIter(ptr) @ stdcall GdipDeletePen(ptr) @ stub GdipDeletePrivateFontCollection @ stub GdipDeleteRegion diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h index d7851d6..b0a9dd1 100644 --- a/dlls/gdiplus/gdiplus_private.h +++ b/dlls/gdiplus/gdiplus_private.h @@ -83,4 +83,11 @@ struct GpMatrix{ REAL matrix[6]; };
+struct GpPathIterator{ + GpPathData pathdata; + INT subpath_pos; /* for NextSubpath methods */ + INT marker_pos; /* for NextMarker methods */ + INT pathtype_pos; /* for NextPathType methods */ +}; + #endif diff --git a/dlls/gdiplus/pathiterator.c b/dlls/gdiplus/pathiterator.c new file mode 100644 index 0000000..9d4dc85 --- /dev/null +++ b/dlls/gdiplus/pathiterator.c @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2007 Google (Evan Stade) + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include <stdarg.h> + +#include "windef.h" +#include "winbase.h" + +#include "gdiplus.h" +#include "gdiplus_private.h" + +GpStatus WINGDIPAPI GdipCreatePathIter(GpPathIterator **iterator, GpPath* path) +{ + INT size; + + if(!iterator || !path) + return InvalidParameter; + + size = path->pathdata.Count; + + *iterator = GdipAlloc(sizeof(GpPathIterator)); + if(!*iterator) return OutOfMemory; + + (*iterator)->pathdata.Types = GdipAlloc(size); + (*iterator)->pathdata.Points = GdipAlloc(size * sizeof(PointF)); + + memcpy((*iterator)->pathdata.Types, path->pathdata.Types, size); + memcpy((*iterator)->pathdata.Points, path->pathdata.Points, + size * sizeof(PointF)); + (*iterator)->pathdata.Count = size; + + (*iterator)->subpath_pos = 0; + (*iterator)->marker_pos = 0; + (*iterator)->pathtype_pos = 0; + + return Ok; +} + +GpStatus WINGDIPAPI GdipDeletePathIter(GpPathIterator *iter) +{ + if(!iter) + return InvalidParameter; + + GdipFree(iter->pathdata.Types); + GdipFree(iter->pathdata.Points); + GdipFree(iter); + + return Ok; +} diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h index ffb6007..e6751b1 100644 --- a/include/gdiplusflat.h +++ b/include/gdiplusflat.h @@ -85,6 +85,9 @@ GpStatus WINGDIPAPI GdipCreateMatrix2(REAL,REAL,REAL,REAL,REAL,REAL,GpMatrix**); GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix*); GpStatus WINGDIPAPI GdipTransformMatrixPoints(GpMatrix*,GpPointF*,INT);
+GpStatus WINGDIPAPI GdipCreatePathIter(GpPathIterator**,GpPath*); +GpStatus WINGDIPAPI GdipDeletePathIter(GpPathIterator*); + #ifdef __cplusplus } #endif diff --git a/include/gdiplusgpstubs.h b/include/gdiplusgpstubs.h index d2174bb..e847e0e 100644 --- a/include/gdiplusgpstubs.h +++ b/include/gdiplusgpstubs.h @@ -27,6 +27,7 @@ class GpBrush {}; class GpSolidFill {}; class GpPath {}; class GpMatrix {}; +class GpPathIterator {};
#else /* end of c++ declarations */
@@ -36,6 +37,7 @@ typedef struct GpBrush GpBrush; typedef struct GpSolidFill GpSolidFill; typedef struct GpPath GpPath; typedef struct GpMatrix GpMatrix; +typedef struct GpPathIterator GpPathIterator;
#endif /* end of c declarations */