Nikolay Sivov : gdiplus: Implement GdipScalePenTransform().

Alexandre Julliard julliard at winehq.org
Sun Mar 3 13:21:29 CST 2019


Module: wine
Branch: oldstable
Commit: 588ed43d945c5d74cc5c62c531b6d34e325cfbd8
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=588ed43d945c5d74cc5c62c531b6d34e325cfbd8

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Tue Oct 16 10:04:28 2018 +0300

gdiplus: Implement GdipScalePenTransform().

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Vincent Povirk <vincent at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
(cherry picked from commit 417e94f19936c738a274a2ae879fc6c17db113e1)
Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>

---

 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 b86808b..1f18f3f 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 be3d76d6..6f69c3b 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);




More information about the wine-cvs mailing list