From 6944803ccc2422e83608a4281b421145b74de819 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Fri, 18 Jul 2014 10:37:57 +0200 Subject: [PATCH] d2d1: Implement D2D1MakeRotateMatrix(). --- dlls/d2d1/d2d1.spec | 2 +- dlls/d2d1/factory.c | 19 +++++++++++++++++++ include/d2d1.idl | 1 + 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/dlls/d2d1/d2d1.spec b/dlls/d2d1/d2d1.spec index b1bfe9b146f..26d17c687dc 100644 --- a/dlls/d2d1/d2d1.spec +++ b/dlls/d2d1/d2d1.spec @@ -1,5 +1,5 @@ @ stdcall D2D1CreateFactory(long ptr ptr ptr) -@ stub D2D1MakeRotateMatrix +@ stdcall D2D1MakeRotateMatrix(float float float ptr) @ stub D2D1MakeSkewMatrix @ stub D2D1IsMatrixInvertible @ stub D2D1InvertMatrix diff --git a/dlls/d2d1/factory.c b/dlls/d2d1/factory.c index 1003f0d22f2..0bc465e104c 100644 --- a/dlls/d2d1/factory.c +++ b/dlls/d2d1/factory.c @@ -264,3 +264,22 @@ HRESULT WINAPI D2D1CreateFactory(D2D1_FACTORY_TYPE factory_type, REFIID iid, return hr; } + +void WINAPI D2D1MakeRotateMatrix(float angle, D2D1_POINT_2F center, D2D1_MATRIX_3X2_F *matrix) +{ + float theta, sin_theta, cos_theta; + + TRACE("angle %.8e, center {%.8e, %.8e}, matrix %p.\n", angle, center.x, center.y, matrix); + + theta = angle * (M_PI / 180.0f); + sin_theta = sinf(theta); + cos_theta = cosf(theta); + + /* translate(center) * rotate(theta) * translate(-center) */ + matrix->_11 = cos_theta; + matrix->_12 = sin_theta; + matrix->_21 = -sin_theta; + matrix->_22 = cos_theta; + matrix->_31 = center.x - center.x * cos_theta + center.y * sin_theta; + matrix->_32 = center.y - center.x * sin_theta - center.y * cos_theta; +} diff --git a/include/d2d1.idl b/include/d2d1.idl index a6d0d367f49..46373388518 100644 --- a/include/d2d1.idl +++ b/include/d2d1.idl @@ -1248,3 +1248,4 @@ interface ID2D1Factory : IUnknown [local] HRESULT __stdcall D2D1CreateFactory(D2D1_FACTORY_TYPE factory_type, REFIID iid, const D2D1_FACTORY_OPTIONS *factory_options, void **factory); +[local] void __stdcall D2D1MakeRotateMatrix(float angle, D2D1_POINT_2F center, D2D1_MATRIX_3X2_F *matrix);