Bug 1471584 - Micro-optimize text shaping by avoiding an unnecessary virtual method call. r=lsalzman

This commit is contained in:
Jonathan Kew 2018-06-27 16:12:43 +01:00
Родитель 1e3aec53f9
Коммит 899b2539d6
1 изменённых файлов: 6 добавлений и 8 удалений

Просмотреть файл

@ -57,7 +57,7 @@ gfxHarfBuzzShaper::gfxHarfBuzzShaper(gfxFont *aFont)
mNumLongVMetrics(0),
mDefaultVOrg(-1.0),
mUseFontGetGlyph(aFont->ProvidesGetGlyph()),
mUseFontGlyphWidths(false),
mUseFontGlyphWidths(aFont->ProvidesGlyphWidths()),
mInitialized(false),
mVerticalInitialized(false),
mLoadedLocaGlyf(false),
@ -379,13 +379,13 @@ hb_position_t
gfxHarfBuzzShaper::HBGetGlyphHAdvance(hb_font_t *font, void *font_data,
hb_codepoint_t glyph, void *user_data)
{
const gfxHarfBuzzShaper::FontCallbackData *fcd =
const gfxHarfBuzzShaper::FontCallbackData* fcd =
static_cast<const gfxHarfBuzzShaper::FontCallbackData*>(font_data);
gfxFont *gfxfont = fcd->mShaper->GetFont();
if (gfxfont->ProvidesGlyphWidths()) {
return gfxfont->GetGlyphWidth(*fcd->mDrawTarget, glyph);
const gfxHarfBuzzShaper* shaper = fcd->mShaper;
if (shaper->mUseFontGlyphWidths) {
return shaper->GetFont()->GetGlyphWidth(*fcd->mDrawTarget, glyph);
}
return fcd->mShaper->GetGlyphHAdvance(glyph);
return shaper->GetGlyphHAdvance(glyph);
}
/* static */
@ -1211,8 +1211,6 @@ gfxHarfBuzzShaper::Initialize()
mInitialized = true;
mCallbackData.mShaper = this;
mUseFontGlyphWidths = mFont->ProvidesGlyphWidths();
if (!sHBFontFuncs) {
// static function callback pointers, initialized by the first
// harfbuzz shaper used