The current code is using AutoFTAccess just to access the FT_Library.
However, it does not need to resolve the FT_Face, just the FT_Library.
This unecessary overhead and is removed by this change.
The longer term solution is for SkFontMgr to initialize FreeType.
Review URL: https://codereview.chromium.org/
835583003
rec->fTextSize = SkIntToScalar(1 << 14);
}
- AutoFTAccess fta(this);
- if (!gFTLibrary->isLCDSupported() && isLCD(*rec)) {
- // If the runtime Freetype library doesn't support LCD mode, we disable
- // it here.
- rec->fMaskFormat = SkMask::kA8_Format;
+ {
+ // TODO: re-work so that FreeType is set-up and selected by the SkFontMgr.
+ SkAutoMutexAcquire ama(gFTMutex);
+ ref_ft_library();
+ if (!gFTLibrary->isLCDSupported() && isLCD(*rec)) {
+ // If the runtime Freetype library doesn't support LCD, disable it here.
+ rec->fMaskFormat = SkMask::kA8_Format;
+ }
+ unref_ft_library();
}
SkPaint::Hinting h = rec->getHinting();