d2d1: Implement D2D1MakeRotateMatrix().

oldstable
Henri Verbeet 2014-07-18 10:37:57 +02:00 committed by Alexandre Julliard
parent c903192243
commit 6944803ccc
3 changed files with 21 additions and 1 deletions

View File

@ -1,5 +1,5 @@
@ stdcall D2D1CreateFactory(long ptr ptr ptr)
@ stub D2D1MakeRotateMatrix
@ stdcall D2D1MakeRotateMatrix(float float float ptr)
@ stub D2D1MakeSkewMatrix
@ stub D2D1IsMatrixInvertible
@ stub D2D1InvertMatrix

View File

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

View File

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