[PATCH] gdiplus: Implement GdipTranslatePenTransform
Nikolay Sivov
nsivov at codeweavers.com
Sat Mar 24 08:10:12 CDT 2018
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
For https://bugs.winehq.org/show_bug.cgi?id=44770
dlls/gdiplus/pen.c | 7 +------
dlls/gdiplus/tests/pen.c | 32 ++++++++++++++++++++++++++++++++
include/gdiplusflat.h | 1 +
3 files changed, 34 insertions(+), 6 deletions(-)
diff --git a/dlls/gdiplus/pen.c b/dlls/gdiplus/pen.c
index 2c49371bd5..b86808b87e 100644
--- a/dlls/gdiplus/pen.c
+++ b/dlls/gdiplus/pen.c
@@ -460,17 +460,12 @@ GpStatus WINGDIPAPI GdipGetPenTransform(GpPen *pen, GpMatrix *matrix)
GpStatus WINGDIPAPI GdipTranslatePenTransform(GpPen *pen, REAL dx, REAL dy, GpMatrixOrder order)
{
- static int calls;
-
TRACE("(%p,%0.2f,%0.2f,%u)\n", pen, dx, dy, order);
if(!pen)
return InvalidParameter;
- if(!(calls++))
- FIXME("not implemented\n");
-
- return NotImplemented;
+ return GdipTranslateMatrix(&pen->transform, dx, dy, order);
}
GpStatus WINGDIPAPI GdipScalePenTransform(GpPen *pen, REAL sx, REAL sy, GpMatrixOrder order)
diff --git a/dlls/gdiplus/tests/pen.c b/dlls/gdiplus/tests/pen.c
index ded6e642eb..be3d76d655 100644
--- a/dlls/gdiplus/tests/pen.c
+++ b/dlls/gdiplus/tests/pen.c
@@ -431,6 +431,38 @@ static void test_transform(void)
expectf(6.0, values[4]);
expectf(3.0, values[5]);
+ /* Translate */
+ status = GdipTranslatePenTransform(NULL, 1.0, -2.0, MatrixOrderAppend);
+ expect(InvalidParameter, status);
+
+ status = GdipTranslatePenTransform(pen, 1.0, -2.0, MatrixOrderAppend);
+ expect(Ok, status);
+
+ status = GdipGetPenTransform(pen, matrix);
+ expect(Ok, status);
+ status = GdipGetMatrixElements(matrix, values);
+ expect(Ok, status);
+ expectf(3.0, values[0]);
+ expectf(-2.0, values[1]);
+ expectf(5.0, values[2]);
+ expectf(2.0, values[3]);
+ expectf(7.0, values[4]);
+ expectf(1.0, values[5]);
+
+ status = GdipTranslatePenTransform(pen, -3.0, 5.0, MatrixOrderPrepend);
+ expect(Ok, status);
+
+ status = GdipGetPenTransform(pen, matrix);
+ expect(Ok, status);
+ status = GdipGetMatrixElements(matrix, values);
+ expect(Ok, status);
+ expectf(3.0, values[0]);
+ expectf(-2.0, values[1]);
+ expectf(5.0, values[2]);
+ expectf(2.0, values[3]);
+ expectf(23.0, values[4]);
+ expectf(17.0, values[5]);
+
status = GdipResetPenTransform(pen);
expect(Ok, status);
diff --git a/include/gdiplusflat.h b/include/gdiplusflat.h
index 8bfe8b8db9..f766441ea3 100644
--- a/include/gdiplusflat.h
+++ b/include/gdiplusflat.h
@@ -655,6 +655,7 @@ GpStatus WINGDIPAPI GdipGetPenMiterLimit(GpPen*,REAL*);
GpStatus WINGDIPAPI GdipGetPenStartCap(GpPen*,GpLineCap*);
GpStatus WINGDIPAPI GdipGetPenUnit(GpPen*,GpUnit*);
GpStatus WINGDIPAPI GdipGetPenWidth(GpPen*,REAL*);
+GpStatus WINGDIPAPI GdipTranslatePenTransform(GpPen*,REAL,REAL,GpMatrixOrder);
/* Region */
GpStatus WINGDIPAPI GdipCloneRegion(GpRegion *, GpRegion **);
--
2.16.2
More information about the wine-devel
mailing list