[PATCH] gdiplus: Implement GdipRotatePenTransform().
Nikolay Sivov
nsivov at codeweavers.com
Tue Oct 23 16:04:18 CDT 2018
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/gdiplus/pen.c | 7 +------
dlls/gdiplus/tests/pen.c | 38 ++++++++++++++++++++++++++++++++++++++
include/gdiplusflat.h | 1 +
3 files changed, 40 insertions(+), 6 deletions(-)
diff --git a/dlls/gdiplus/pen.c b/dlls/gdiplus/pen.c
index ad45bcb5d5..8bcb91819a 100644
--- a/dlls/gdiplus/pen.c
+++ b/dlls/gdiplus/pen.c
@@ -480,17 +480,12 @@ GpStatus WINGDIPAPI GdipScalePenTransform(GpPen *pen, REAL sx, REAL sy, GpMatrix
GpStatus WINGDIPAPI GdipRotatePenTransform(GpPen *pen, REAL angle, GpMatrixOrder order)
{
- static int calls;
-
TRACE("(%p,%0.2f,%u)\n", pen, angle, order);
if(!pen)
return InvalidParameter;
- if(!(calls++))
- FIXME("not implemented\n");
-
- return NotImplemented;
+ return GdipRotateMatrix(&pen->transform, angle, order);
}
GpStatus WINGDIPAPI GdipMultiplyPenTransform(GpPen *pen, GDIPCONST GpMatrix *matrix,
diff --git a/dlls/gdiplus/tests/pen.c b/dlls/gdiplus/tests/pen.c
index 530967afb2..ceab92acff 100644
--- a/dlls/gdiplus/tests/pen.c
+++ b/dlls/gdiplus/tests/pen.c
@@ -588,6 +588,44 @@ static void test_transform(void)
expectf(-15.0, values[4]);
expectf(-76.0, values[5]);
+ /* Rotate */
+ status = GdipResetPenTransform(pen);
+ expect(Ok, status);
+
+ status = GdipSetMatrixElements(matrix, 2.0, 1.0, 1.0, 4.0, 1.0, 2.0);
+ expect(Ok, status);
+
+ status = GdipSetPenTransform(pen, matrix);
+ expect(Ok, status);
+
+ status = GdipRotatePenTransform(NULL, 10.0, MatrixOrderPrepend);
+ expect(InvalidParameter, status);
+
+ status = GdipRotatePenTransform(pen, 45.0, MatrixOrderPrepend);
+ expect(Ok, status);
+
+ get_pen_transform(pen, values);
+ expectf(2.12, values[0]);
+ expectf(3.54, values[1]);
+ expectf(-0.71, values[2]);
+ expectf(2.12, values[3]);
+ expectf(1.0, values[4]);
+ expectf(2.0, values[5]);
+
+ status = GdipScalePenTransform(pen, 2.0, -10.0, MatrixOrderAppend);
+ expect(Ok, status);
+
+ status = GdipRotatePenTransform(pen, 180.0, MatrixOrderAppend);
+ expect(Ok, status);
+
+ get_pen_transform(pen, values);
+ expectf(-4.24, values[0]);
+ expectf(35.36, values[1]);
+ expectf(1.41, values[2]);
+ expectf(21.21, values[3]);
+ expectf(-2.0, values[4]);
+ expectf(20.0, values[5]);
+
GdipDeletePen(pen);
GdipDeleteMatrix(matrix);
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 5593ac51b6..ad944d6a34 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -631,6 +631,7 @@ GpStatus WINGDIPAPI GdipGetPenMode(GpPen*,GpPenAlignment*);
GpStatus WINGDIPAPI GdipGetPenTransform(GpPen *, GpMatrix *);
GpStatus WINGDIPAPI GdipMultiplyPenTransform(GpPen *,GDIPCONST GpMatrix *,GpMatrixOrder);
GpStatus WINGDIPAPI GdipResetPenTransform(GpPen*);
+GpStatus WINGDIPAPI GdipRotatePenTransform(GpPen*,REAL,GpMatrixOrder);
GpStatus WINGDIPAPI GdipScalePenTransform(GpPen*,REAL,REAL,GpMatrixOrder);
GpStatus WINGDIPAPI GdipSetPenBrushFill(GpPen*,GpBrush*);
GpStatus WINGDIPAPI GdipSetPenColor(GpPen*,ARGB);
--
2.19.1
More information about the wine-devel
mailing list