gdi32: Try to avoid not necessary glyph transformations.

Dmitry Timoshkov dmitry at codeweavers.com
Sat Nov 1 04:44:05 CDT 2008


This speeds up a lot font rendering with simple scaling DC transformation,
and should fix the regression reported in the bug 14983.
---
 dlls/gdi32/freetype.c |   13 ++++++++++---
 1 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/dlls/gdi32/freetype.c b/dlls/gdi32/freetype.c
index 2e64038..9e3ec02 100644
--- a/dlls/gdi32/freetype.c
+++ b/dlls/gdi32/freetype.c
@@ -3321,6 +3321,14 @@ GdiFont *WineEngCreateFontInstance(DC *dc, HFONT hfont)
         dcmat.eM21 = dcmat.eM12 = 0;
     }
 
+    /* Try to avoid not necessary glyph transformations */
+    if (dcmat.eM21 == 0.0 && dcmat.eM12 == 0.0 && dcmat.eM11 == dcmat.eM22)
+    {
+        lf.lfHeight *= fabs(dcmat.eM11);
+        lf.lfWidth *= fabs(dcmat.eM11);
+        dcmat.eM11 = dcmat.eM22 = 1.0;
+    }
+
     TRACE("DC transform %f %f %f %f\n", dcmat.eM11, dcmat.eM12,
                                         dcmat.eM21, dcmat.eM22);
 
@@ -4606,9 +4614,8 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format,
 	    ft_bitmap.pixel_mode = ft_pixel_mode_mono;
 	    ft_bitmap.buffer = buf;
 
-		if(needsTransform) {
-			pFT_Outline_Transform(&ft_face->glyph->outline, &transMat);
-	    }
+	    if(needsTransform)
+		pFT_Outline_Transform(&ft_face->glyph->outline, &transMat);
 
 	    pFT_Outline_Translate(&ft_face->glyph->outline, -left, -bottom );
 
-- 
1.6.0.3




More information about the wine-patches mailing list