Reduce overhead of SkFontHost_FreeType::onFilterRec.
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
diff --git a/src/ports/SkFontHost_FreeType.cpp b/src/ports/SkFontHost_FreeType.cpp
index 459abbc..167c38b 100644
--- a/src/ports/SkFontHost_FreeType.cpp
+++ b/src/ports/SkFontHost_FreeType.cpp
@@ -697,11 +697,15 @@
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();