gdiplus: Implement GdipScalePenTransform().

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2018-10-16 10:04:28 +03:00 committed by Alexandre Julliard
parent b4516a2f1f
commit 417e94f199
2 changed files with 76 additions and 6 deletions

View File

@ -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)

View File

@ -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);