[10/18] gdiplus: added basic matrix implementation

Evan Stade estade at gmail.com
Wed Jul 11 20:07:48 CDT 2007


Hi,

changelog:
*added matrix.c
*added necessary types

 dlls/gdiplus/Makefile.in       |    1 +
 dlls/gdiplus/gdiplus.spec      |    4 +--
 dlls/gdiplus/gdiplus_private.h |    4 +++
 dlls/gdiplus/matrix.c          |   58 ++++++++++++++++++++++++++++++++++++++++
 include/gdiplusflat.h          |    3 ++
 include/gdiplusgpstubs.h       |    2 +
 6 files changed, 70 insertions(+), 2 deletions(-)

-- 
Evan Stade
-------------- next part --------------
diff --git a/dlls/gdiplus/Makefile.in b/dlls/gdiplus/Makefile.in
index 1194fc0..85c1f27 100644
--- a/dlls/gdiplus/Makefile.in
+++ b/dlls/gdiplus/Makefile.in
@@ -11,6 +11,7 @@ C_SRCS = \
 	gdiplus.c \
 	graphics.c \
 	graphicspath.c \
+	matrix.c \
 	pen.c
 
 @MAKE_DLL_RULES@
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index a805bd8..b349e01 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -95,7 +95,7 @@
 @ stub GdipCreateLineBrushFromRectWithAngle
 @ stub GdipCreateLineBrushFromRectWithAngleI
 @ stub GdipCreateLineBrushI
-@ stub GdipCreateMatrix2
+@ stdcall GdipCreateMatrix2(long long long long long long ptr)
 @ stub GdipCreateMatrix3
 @ stub GdipCreateMatrix3I
 @ stub GdipCreateMatrix
@@ -133,7 +133,7 @@
 @ stub GdipDeleteFont
 @ stub GdipDeleteFontFamily
 @ stdcall GdipDeleteGraphics(ptr)
-@ stub GdipDeleteMatrix
+@ stdcall GdipDeleteMatrix(ptr)
 @ stdcall GdipDeletePath(ptr)
 @ stub GdipDeletePathIter
 @ stdcall GdipDeletePen(ptr)
diff --git a/dlls/gdiplus/gdiplus_private.h b/dlls/gdiplus/gdiplus_private.h
index e37c20e..7b7ec62 100644
--- a/dlls/gdiplus/gdiplus_private.h
+++ b/dlls/gdiplus/gdiplus_private.h
@@ -71,4 +71,8 @@ struct GpPath{
     INT datalen; /* size of the arrays in pathdata */
 };
 
+struct GpMatrix{
+    REAL matrix[6];
+};
+
 #endif
diff --git a/dlls/gdiplus/matrix.c b/dlls/gdiplus/matrix.c
new file mode 100644
index 0000000..919e1d4
--- /dev/null
+++ b/dlls/gdiplus/matrix.c
@@ -0,0 +1,58 @@
+/*
+ * 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 "wingdi.h"
+
+#include "gdiplus.h"
+#include "gdiplus_private.h"
+
+GpStatus WINGDIPAPI GdipCreateMatrix2(REAL m11, REAL m12, REAL m21, REAL m22,
+    REAL dx, REAL dy, GpMatrix **matrix)
+{
+    if(!matrix)
+        return InvalidParameter;
+
+    *matrix = GdipAlloc(sizeof(GpMatrix));
+    if(!*matrix)    return OutOfMemory;
+
+    /* first row */
+    (*matrix)->matrix[0] = m11;
+    (*matrix)->matrix[1] = m12;
+    /* second row */
+    (*matrix)->matrix[2] = m21;
+    (*matrix)->matrix[3] = m22;
+    /* third row */
+    (*matrix)->matrix[4] = dx;
+    (*matrix)->matrix[5] = dy;
+
+    return Ok;
+}
+
+GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix *matrix)
+{
+    if(!matrix)
+        return InvalidParameter;
+
+    GdipFree(matrix);
+
+    return Ok;
+}
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index b5743eb..5a48fdc 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -60,6 +60,9 @@ GpStatus WINGDIPAPI GdipGetPathTypes(GpP
 GpStatus WINGDIPAPI GdipGetPointCount(GpPath*,INT*);
 GpStatus WINGDIPAPI GdipStartPathFigure(GpPath*);
 
+GpStatus WINGDIPAPI GdipCreateMatrix2(REAL,REAL,REAL,REAL,REAL,REAL,GpMatrix**);
+GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix*);
+
 #ifdef __cplusplus
 }
 #endif
diff --git a/include/gdiplusgpstubs.h b/include/gdiplusgpstubs.h
index 8be4e9c..39bca1f 100644
--- a/include/gdiplusgpstubs.h
+++ b/include/gdiplusgpstubs.h
@@ -26,6 +26,7 @@ class GpGraphics {};
 class GpBrush {};
 class GpSolidFill {};
 class GpPath {};
+class GpMatrix {};
 
 #else /* end of c++ declarations */
 
@@ -34,6 +35,7 @@ typedef struct GpPen GpPen;
 typedef struct GpBrush GpBrush;
 typedef struct GpSolidFill GpSolidFill;
 typedef struct GpPath GpPath;
+typedef struct GpMatrix GpMatrix;
 
 #endif /* end of c declarations */
 
-- 
1.4.1


More information about the wine-patches mailing list