Commit 0a81a346 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

gdiplus: Avoid GdipCloneMatrix calls for the graphics transformation matrix.

parent 250ce222
......@@ -455,7 +455,7 @@ GpStatus WINGDIPAPI GdipGetLogFontA(GpFont *font, GpGraphics *graphics,
GpStatus WINGDIPAPI GdipGetLogFontW(GpFont *font, GpGraphics *graphics, LOGFONTW *lf)
{
REAL angle, rel_height, height;
GpMatrix *matrix;
GpMatrix matrix;
GpPointF pt[3];
TRACE("(%p, %p, %p)\n", font, graphics, lf);
......@@ -463,13 +463,13 @@ GpStatus WINGDIPAPI GdipGetLogFontW(GpFont *font, GpGraphics *graphics, LOGFONTW
if (!font || !graphics || !lf)
return InvalidParameter;
GdipCloneMatrix(graphics->worldtrans, &matrix);
matrix = graphics->worldtrans;
if (font->unit == UnitPixel)
{
height = units_to_pixels(font->emSize, graphics->unit, graphics->yres);
if (graphics->unit != UnitDisplay)
GdipScaleMatrix(matrix, graphics->scale, graphics->scale, MatrixOrderAppend);
GdipScaleMatrix(&matrix, graphics->scale, graphics->scale, MatrixOrderAppend);
}
else
{
......@@ -485,11 +485,10 @@ GpStatus WINGDIPAPI GdipGetLogFontW(GpFont *font, GpGraphics *graphics, LOGFONTW
pt[1].Y = 0.0;
pt[2].X = 0.0;
pt[2].Y = 1.0;
GdipTransformMatrixPoints(matrix, pt, 3);
GdipTransformMatrixPoints(&matrix, pt, 3);
angle = -gdiplus_atan2((pt[1].Y - pt[0].Y), (pt[1].X - pt[0].X));
rel_height = sqrt((pt[2].Y - pt[0].Y) * (pt[2].Y - pt[0].Y)+
(pt[2].X - pt[0].X) * (pt[2].X - pt[0].X));
GdipDeleteMatrix(matrix);
lf->lfHeight = -gdip_round(height * rel_height);
lf->lfWidth = 0;
......
......@@ -125,6 +125,10 @@ extern GpStatus convert_pixels(INT width, INT height,
INT dst_stride, BYTE *dst_bits, PixelFormat dst_format,
INT src_stride, const BYTE *src_bits, PixelFormat src_format, ColorPalette *palette) DECLSPEC_HIDDEN;
struct GpMatrix{
REAL matrix[6];
};
struct GpPen{
UINT style;
GpUnit unit;
......@@ -158,7 +162,7 @@ struct GpGraphics{
GpUnit unit; /* page unit */
REAL scale; /* page scale */
REAL xres, yres;
GpMatrix * worldtrans; /* world transform */
GpMatrix worldtrans; /* world transform */
BOOL busy; /* hdc handle obtained by GdipGetDC */
GpRegion *clip;
UINT textcontrast; /* not used yet. get/set only */
......@@ -240,10 +244,6 @@ struct GpPath{
INT datalen; /* size of the arrays in pathdata */
};
struct GpMatrix{
REAL matrix[6];
};
struct GpPathIterator{
GpPathData pathdata;
INT subpath_pos; /* for NextSubpath methods */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment