gdi32: Only cache the glyph metrics when rendering to a monochrome bitmap or when just retrieving the metrics.

This commit is contained in:
Huw Davies 2007-10-02 11:56:54 +01:00 committed by Alexandre Julliard
parent 5af70f49c6
commit 70c212937a
1 changed files with 13 additions and 7 deletions

View File

@ -3500,7 +3500,7 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format,
DWORD width, height, pitch, needed = 0; DWORD width, height, pitch, needed = 0;
FT_Bitmap ft_bitmap; FT_Bitmap ft_bitmap;
FT_Error err; FT_Error err;
INT left, right, top = 0, bottom = 0; INT left, right, top = 0, bottom = 0, adv, lsb, bbx;
FT_Angle angle = 0; FT_Angle angle = 0;
FT_Int load_flags = FT_LOAD_DEFAULT | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH; FT_Int load_flags = FT_LOAD_DEFAULT | FT_LOAD_IGNORE_GLOBAL_ADVANCE_WIDTH;
float widthRatio = 1.0; float widthRatio = 1.0;
@ -3551,9 +3551,9 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format,
left = (INT)(ft_face->glyph->metrics.horiBearingX * widthRatio) & -64; left = (INT)(ft_face->glyph->metrics.horiBearingX * widthRatio) & -64;
right = (INT)((ft_face->glyph->metrics.horiBearingX + ft_face->glyph->metrics.width) * widthRatio + 63) & -64; right = (INT)((ft_face->glyph->metrics.horiBearingX + ft_face->glyph->metrics.width) * widthRatio + 63) & -64;
FONT_GM(font,glyph_index)->adv = (INT)((ft_face->glyph->metrics.horiAdvance * widthRatio) + 63) >> 6; adv = (INT)((ft_face->glyph->metrics.horiAdvance * widthRatio) + 63) >> 6;
FONT_GM(font,glyph_index)->lsb = left >> 6; lsb = left >> 6;
FONT_GM(font,glyph_index)->bbx = (right - left) >> 6; bbx = (right - left) >> 6;
/* Scaling transform */ /* Scaling transform */
if(font->aveWidth) { if(font->aveWidth) {
@ -3609,7 +3609,7 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format,
top = (ft_face->glyph->metrics.horiBearingY + 63) & -64; top = (ft_face->glyph->metrics.horiBearingY + 63) & -64;
bottom = (ft_face->glyph->metrics.horiBearingY - bottom = (ft_face->glyph->metrics.horiBearingY -
ft_face->glyph->metrics.height) & -64; ft_face->glyph->metrics.height) & -64;
lpgm->gmCellIncX = FONT_GM(font,glyph_index)->adv; lpgm->gmCellIncX = adv;
lpgm->gmCellIncY = 0; lpgm->gmCellIncY = 0;
} else { } else {
INT xc, yc; INT xc, yc;
@ -3650,8 +3650,14 @@ DWORD WineEngGetGlyphOutline(GdiFont *incoming_font, UINT glyph, UINT format,
lpgm->gmptGlyphOrigin.x = left >> 6; lpgm->gmptGlyphOrigin.x = left >> 6;
lpgm->gmptGlyphOrigin.y = top >> 6; lpgm->gmptGlyphOrigin.y = top >> 6;
FONT_GM(font,glyph_index)->gm = *lpgm; if(format == GGO_METRICS || format == GGO_BITMAP)
FONT_GM(font,glyph_index)->init = TRUE; {
FONT_GM(font,glyph_index)->gm = *lpgm;
FONT_GM(font,glyph_index)->adv = adv;
FONT_GM(font,glyph_index)->lsb = lsb;
FONT_GM(font,glyph_index)->bbx = bbx;
FONT_GM(font,glyph_index)->init = TRUE;
}
if(format == GGO_METRICS) if(format == GGO_METRICS)
return 1; /* FIXME */ return 1; /* FIXME */