Evan Stade : gdiplus: Added GdipRotateMatrix.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jul 20 06:02:30 CDT 2007


Module: wine
Branch: master
Commit: eb478be84cfed37ad2bc6e8466a6b2f3ebee2d9e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=eb478be84cfed37ad2bc6e8466a6b2f3ebee2d9e

Author: Evan Stade <estade at gmail.com>
Date:   Thu Jul 19 18:22:26 2007 -0700

gdiplus: Added GdipRotateMatrix.

---

 dlls/gdiplus/gdiplus.spec |    2 +-
 dlls/gdiplus/matrix.c     |   28 ++++++++++++++++++++++++++++
 include/gdiplusflat.h     |    1 +
 3 files changed, 30 insertions(+), 1 deletions(-)

diff --git a/dlls/gdiplus/gdiplus.spec b/dlls/gdiplus/gdiplus.spec
index 60e623c..e4166e7 100644
--- a/dlls/gdiplus/gdiplus.spec
+++ b/dlls/gdiplus/gdiplus.spec
@@ -466,7 +466,7 @@
 @ stdcall GdipRestoreGraphics(ptr long)
 @ stub GdipReversePath
 @ stub GdipRotateLineTransform
-@ stub GdipRotateMatrix
+@ stdcall GdipRotateMatrix(ptr long long)
 @ stub GdipRotatePathGradientTransform
 @ stub GdipRotatePenTransform
 @ stub GdipRotateTextureTransform
diff --git a/dlls/gdiplus/matrix.c b/dlls/gdiplus/matrix.c
index 9d3a78f..928b5fe 100644
--- a/dlls/gdiplus/matrix.c
+++ b/dlls/gdiplus/matrix.c
@@ -17,6 +17,7 @@
  */
 
 #include <stdarg.h>
+#include <math.h>
 
 #include "windef.h"
 #include "winbase.h"
@@ -93,6 +94,33 @@ GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix *matrix, GpMatrix* matrix2,
     return Ok;
 }
 
+GpStatus WINGDIPAPI GdipRotateMatrix(GpMatrix *matrix, REAL angle,
+    GpMatrixOrder order)
+{
+    REAL cos_theta, sin_theta, rotate[6];
+
+    if(!matrix)
+        return InvalidParameter;
+
+    angle = deg2rad(angle);
+    cos_theta = cos(angle);
+    sin_theta = sin(angle);
+
+    rotate[0] = cos_theta;
+    rotate[1] = sin_theta;
+    rotate[2] = -sin_theta;
+    rotate[3] = cos_theta;
+    rotate[4] = 0.0;
+    rotate[5] = 0.0;
+
+    if(order == MatrixOrderAppend)
+        matrix_multiply(matrix->matrix, rotate, matrix->matrix);
+    else
+        matrix_multiply(rotate, matrix->matrix, matrix->matrix);
+
+    return Ok;
+}
+
 GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix *matrix, REAL scaleX, REAL scaleY,
     GpMatrixOrder order)
 {
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 09e5a09..b0c9840 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -88,6 +88,7 @@ GpStatus WINGDIPAPI GdipTransformPath(GpPath*,GpMatrix*);
 GpStatus WINGDIPAPI GdipCreateMatrix2(REAL,REAL,REAL,REAL,REAL,REAL,GpMatrix**);
 GpStatus WINGDIPAPI GdipDeleteMatrix(GpMatrix*);
 GpStatus WINGDIPAPI GdipMultiplyMatrix(GpMatrix*,GpMatrix*,GpMatrixOrder);
+GpStatus WINGDIPAPI GdipRotateMatrix(GpMatrix*,REAL,GpMatrixOrder);
 GpStatus WINGDIPAPI GdipScaleMatrix(GpMatrix*,REAL,REAL,GpMatrixOrder);
 GpStatus WINGDIPAPI GdipTransformMatrixPoints(GpMatrix*,GpPointF*,INT);
 GpStatus WINGDIPAPI GdipTranslateMatrix(GpMatrix*,REAL,REAL,GpMatrixOrder);




More information about the wine-cvs mailing list