gdiplus: Added GdipMultiplyMatrix.
diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index 9bc5122..21e3828 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -424,7 +424,7 @@
@ stub GdipMeasureDriverString
@ stub GdipMeasureString
@ stub GdipMultiplyLineTransform
-@ stub GdipMultiplyMatrix
+@ stdcall GdipMultiplyMatrix(ptr ptr long)
@ stub GdipMultiplyPathGradientTransform
@ stub GdipMultiplyPenTransform
@ stub GdipMultiplyTextureTransform
diff --git a/dlls/gdiplus/matrix.c b/dlls/gdiplus/matrix.c
index 909bfee..c8eb689 100644
--- a/dlls/gdiplus/matrix.c
+++ b/dlls/gdiplus/matrix.c
@@ -25,6 +25,28 @@
#include "gdiplus.h"
#include "gdiplus_private.h"
+/* Multiplies two matrices of the form
+ *
+ * idx:0 idx:1 0
+ * idx:2 idx:3 0
+ * idx:4 idx:5 1
+ *
+ * and puts the output in out.
+ * */
+static void matrix_multiply(GDIPCONST REAL * left, GDIPCONST REAL * right, REAL * out)
+{
+ REAL temp[6];
+ int i, odd;
+
+ for(i = 0; i < 6; i++){
+ odd = i % 2;
+ temp[i] = left[i - odd] * right[odd] + left[i - odd + 1] * right[odd + 2] +
+ (i >= 4 ? right[odd + 4] : 0.0);
+ }
+
+ memcpy(out, temp, 6 * sizeof(REAL));
+}
+
GpStatus WINGDIPAPI GdipCreateMatrix2(REAL m11, REAL m12, REAL m21, REAL m22,
REAL dx, REAL dy, GpMatrix **matrix)
{
@@ -57,6 +79,20 @@
return Ok;
}
+GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix *matrix, GpMatrix* matrix2,
+ GpMatrixOrder order)
+{
+ if(!matrix || !matrix2)
+ return InvalidParameter;
+
+ if(order == MatrixOrderAppend)
+ matrix_multiply(matrix->matrix, matrix2->matrix, matrix->matrix);
+ else
+ matrix_multiply(matrix2->matrix, matrix->matrix, matrix->matrix);
+
+ return Ok;
+}
+
GpStatus WINGDIPAPI GdipTransformMatrixPoints(GpMatrix *matrix, GpPointF *pts,
INT count)
{
diff --git a/include/gdiplusenums.h b/include/gdiplusenums.h
index 4f5b193..eb807ce 100644
--- a/include/gdiplusenums.h
+++ b/include/gdiplusenums.h
@@ -151,6 +151,12 @@
DashStyleCustom
};
+enum MatrixOrder
+{
+ MatrixOrderPrepend = 0,
+ MatrixOrderAppend = 1
+};
+
#ifndef __cplusplus
typedef enum Unit Unit;
@@ -166,6 +172,7 @@
typedef enum PixelOffsetMode PixelOffsetMode;
typedef enum DashCap DashCap;
typedef enum DashStyle DashStyle;
+typedef enum MatrixOrder MatrixOrder;
#endif /* end of c typedefs */
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index a358a1e..e3ab4e0 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -87,6 +87,7 @@
GpStatus WINGDIPAPI GdipCreateMatrix2(REAL,REAL,REAL,REAL,REAL,REAL,GpMatrix**);
GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix*);
+GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix*,GpMatrix*,GpMatrixOrder);
GpStatus WINGDIPAPI GdipTransformMatrixPoints(GpMatrix*,GpPointF*,INT);
GpStatus WINGDIPAPI GdipCreatePathIter(GpPathIterator**,GpPath*);
diff --git a/include/gdiplusgpstubs.h b/include/gdiplusgpstubs.h
index 7cb1888..8bb5bb6 100644
--- a/include/gdiplusgpstubs.h
+++ b/include/gdiplusgpstubs.h
@@ -52,5 +52,6 @@
typedef LineJoin GpLineJoin;
typedef DashCap GpDashCap;
typedef DashStyle GpDashStyle;
+typedef MatrixOrder GpMatrixOrder;
#endif