From 417e94f19936c738a274a2ae879fc6c17db113e1 Mon Sep 17 00:00:00 2001 From: Nikolay Sivov Date: Tue, 16 Oct 2018 10:04:28 +0300 Subject: [PATCH] gdiplus: Implement GdipScalePenTransform(). Signed-off-by: Nikolay Sivov Signed-off-by: Vincent Povirk Signed-off-by: Alexandre Julliard --- dlls/gdiplus/pen.c | 7 +--- dlls/gdiplus/tests/pen.c | 75 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 76 insertions(+), 6 deletions(-) diff --git a/dlls/gdiplus/pen.c b/dlls/gdiplus/pen.c index b86808b87e6..1f18f3f5a37 100644 --- a/dlls/gdiplus/pen.c +++ b/dlls/gdiplus/pen.c @@ -470,17 +470,12 @@ GpStatus WINGDIPAPI GdipTranslatePenTransform(GpPen *pen, REAL dx, REAL dy, GpMa GpStatus WINGDIPAPI GdipScalePenTransform(GpPen *pen, REAL sx, REAL sy, GpMatrixOrder order) { - static int calls; - TRACE("(%p,%0.2f,%0.2f,%u)\n", pen, sx, sy, order); if(!pen) return InvalidParameter; - if(!(calls++)) - FIXME("(%p, %.2f, %.2f, %d) stub\n", pen, sx, sy, order); - - return NotImplemented; + return GdipScaleMatrix(&pen->transform, sx, sy, order); } GpStatus WINGDIPAPI GdipRotatePenTransform(GpPen *pen, REAL angle, GpMatrixOrder order) diff --git a/dlls/gdiplus/tests/pen.c b/dlls/gdiplus/tests/pen.c index be3d76d6551..6f69c3b8b46 100644 --- a/dlls/gdiplus/tests/pen.c +++ b/dlls/gdiplus/tests/pen.c @@ -389,6 +389,22 @@ todo_wine { GdipDeletePen(pen); } +static void get_pen_transform(GpPen *pen, REAL *values) +{ + GpMatrix *matrix; + GpStatus status; + + status = GdipCreateMatrix(&matrix); + expect(Ok, status); + + status = GdipGetPenTransform(pen, matrix); + expect(Ok, status); + status = GdipGetMatrixElements(matrix, values); + expect(Ok, status); + + GdipDeleteMatrix(matrix); +} + static void test_transform(void) { GpStatus status; @@ -478,6 +494,65 @@ static void test_transform(void) expectf(0.0, values[4]); expectf(0.0, values[5]); + /* Scale */ + status = GdipScalePenTransform(NULL, 1.0, 1.0, MatrixOrderPrepend); + expect(InvalidParameter, status); + + status = GdipScalePenTransform(pen, 1.0, 1.0, MatrixOrderPrepend); + expect(Ok, status); + + get_pen_transform(pen, values); + expectf(1.0, values[0]); + expectf(0.0, values[1]); + expectf(0.0, values[2]); + expectf(1.0, values[3]); + expectf(0.0, values[4]); + expectf(0.0, values[5]); + + status = GdipScalePenTransform(pen, 2.0, -10.0, MatrixOrderPrepend); + expect(Ok, status); + + get_pen_transform(pen, values); + expectf(2.0, values[0]); + expectf(0.0, values[1]); + expectf(0.0, values[2]); + expectf(-10.0, values[3]); + expectf(0.0, values[4]); + expectf(0.0, values[5]); + + status = GdipScalePenTransform(pen, 2.0, -10.0, MatrixOrderAppend); + expect(Ok, status); + + get_pen_transform(pen, values); + expectf(4.0, values[0]); + expectf(0.0, values[1]); + expectf(0.0, values[2]); + expectf(100.0, values[3]); + expectf(0.0, values[4]); + expectf(0.0, values[5]); + + status = GdipTranslatePenTransform(pen, 1.0, -2.0, MatrixOrderAppend); + expect(Ok, status); + + get_pen_transform(pen, values); + expectf(4.0, values[0]); + expectf(0.0, values[1]); + expectf(0.0, values[2]); + expectf(100.0, values[3]); + expectf(1.0, values[4]); + expectf(-2.0, values[5]); + + status = GdipScalePenTransform(pen, 2.0, -10.0, MatrixOrderPrepend); + expect(Ok, status); + + get_pen_transform(pen, values); + expectf(8.0, values[0]); + expectf(0.0, values[1]); + expectf(0.0, values[2]); + expectf(-1000.0, values[3]); + expectf(1.0, values[4]); + expectf(-2.0, values[5]); + GdipDeletePen(pen); GdipDeleteMatrix(matrix);