mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-02 10:00:54 +00:00
bug 564309 - cache non-antialiased font to fix MathML perf regression on Windows. r=roc
This commit is contained in:
parent
2061850a0a
commit
901d200bbe
@ -948,6 +948,10 @@ protected:
|
||||
// the AA setting requested for this font - may affect glyph bounds
|
||||
AntialiasOption mAntialiasOption;
|
||||
|
||||
// a copy of the font without antialiasing, if needed for separate
|
||||
// measurement by mathml code
|
||||
nsAutoPtr<gfxFont> mNonAAFont;
|
||||
|
||||
nsAutoPtr<gfxFontShaper> mShaper;
|
||||
|
||||
// some fonts have bad metrics, this method sanitize them.
|
||||
|
@ -1074,16 +1074,18 @@ gfxFont::Measure(gfxTextRun *aTextRun,
|
||||
// If aBoundingBoxType is TIGHT_HINTED_OUTLINE_EXTENTS
|
||||
// and the underlying cairo font may be antialiased,
|
||||
// we need to create a copy in order to avoid getting cached extents.
|
||||
// This is inefficient, but only used by MathML layout at present.
|
||||
// This is only used by MathML layout at present.
|
||||
if (aBoundingBoxType == TIGHT_HINTED_OUTLINE_EXTENTS &&
|
||||
mAntialiasOption != kAntialiasNone) {
|
||||
nsAutoPtr<gfxFont> tempFont(CopyWithAntialiasOption(kAntialiasNone));
|
||||
if (!mNonAAFont) {
|
||||
mNonAAFont = CopyWithAntialiasOption(kAntialiasNone);
|
||||
}
|
||||
// if font subclass doesn't implement CopyWithAntialiasOption(),
|
||||
// it will return null and we'll proceed to use the existing font
|
||||
if (tempFont) {
|
||||
return tempFont->Measure(aTextRun, aStart, aEnd,
|
||||
TIGHT_HINTED_OUTLINE_EXTENTS,
|
||||
aRefContext, aSpacing);
|
||||
if (mNonAAFont) {
|
||||
return mNonAAFont->Measure(aTextRun, aStart, aEnd,
|
||||
TIGHT_HINTED_OUTLINE_EXTENTS,
|
||||
aRefContext, aSpacing);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user