From: Bartosz Kosiorek gang65@poczta.onet.pl
--- dlls/gdiplus/graphics.c | 32 ++++++++++++++++++++++++-------- 1 file changed, 24 insertions(+), 8 deletions(-)
diff --git a/dlls/gdiplus/graphics.c b/dlls/gdiplus/graphics.c index 835c2889bd1..6a045017730 100644 --- a/dlls/gdiplus/graphics.c +++ b/dlls/gdiplus/graphics.c @@ -1617,6 +1617,26 @@ static GpStatus brush_fill_pixels(GpGraphics *graphics, GpBrush *brush, } }
+/* Creates rotated and translated identity matrix. + * Equvalent (but much faster) of the: + * GdipSetMatrixElements(&matrix, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0); + * GdipRotateMatrix(&matrix, angle, MatrixOrderAppend); + * GdipTranslateMatrix(&matrix, dx, dy, MatrixOrderAppend); */ +inline void create_rotated_translated_identity_matrix(GpMatrix *matrix, REAL angle, REAL dx, REAL dy) +{ + REAL cos_theta, sin_theta; + + cos_theta = cos(angle); + sin_theta = sin(angle); + + matrix->matrix[0] = cos_theta; + matrix->matrix[1] = sin_theta; + matrix->matrix[2] = -sin_theta; + matrix->matrix[3] = cos_theta; + matrix->matrix[4] = dx; + matrix->matrix[5] = dy; +} + /* Draws the linecap the specified color and size on the hdc. The linecap is in * direction of the line from x1, y1 to x2, y2 and is anchored on x2, y2. Probably * should not be called on an hdc that has a path you care about. */ @@ -1795,12 +1815,8 @@ static void draw_cap(GpGraphics *graphics, COLORREF color, GpLineCap cap, REAL s goto custend;
memcpy(custptf, custom->pathdata.Points, count * sizeof(PointF)); - - GdipSetMatrixElements(&matrix, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0); + create_rotated_translated_identity_matrix(&matrix, (theta - M_PI_2), x2, y2); GdipScaleMatrix(&matrix, size, size, MatrixOrderAppend); - GdipRotateMatrix(&matrix, (180.0 / M_PI) * (theta - M_PI_2), - MatrixOrderAppend); - GdipTranslateMatrix(&matrix, x2, y2, MatrixOrderAppend); GdipTransformMatrixPoints(&matrix, custptf, count);
gdip_transform_points(graphics, WineCoordinateSpaceGdiDevice, CoordinateSpaceWorld, custptf, count); @@ -7255,9 +7271,9 @@ static GpStatus GDI32_GdipDrawDriverString(GpGraphics *graphics, GDIPCONST UINT1 memcpy(real_positions, positions, sizeof(PointF) * length);
gdip_transform_points(graphics, WineCoordinateSpaceGdiDevice, CoordinateSpaceWorld, real_positions, length); - - GdipSetMatrixElements(&rotation, 1.0, 0.0, 0.0, 1.0, 0.0, 0.0); - GdipRotateMatrix(&rotation, lfw.lfEscapement / 10.0, MatrixOrderAppend); + create_rotated_translated_identity_matrix(&rotation, + (0.1 * lfw.lfEscapement) * M_PI / 180.0, + 0.0, 0.0); GdipTransformMatrixPoints(&rotation, real_positions, length);
for (i = 0; i < (length - 1); i++)
This merge request was closed by Bartosz Kosiorek.