diff options
author | bungeman <bungeman@google.com> | 2016-07-13 05:16:58 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-07-13 05:16:58 -0700 |
commit | e3aea10428d1597838fd563c92340beaf969a9b4 (patch) | |
tree | c9afef7b181fbfdb9897c72b4fe61cd44f34d692 /src/ports | |
parent | ba3880fa6d47d467bfcf4db80c553f051336e406 (diff) |
Remove user specified typeface id.
Now that there may be multiple font managers in a process the typeface
ids must be unique across all typefaces, not just unique within a font
manager. If two typefaces have the same id there will be issues in the
glyph cache. All existing font managers were already doing this by
calling SkFontCache::NewFontID, so centralize this in SkTypeface.
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2147733002
Review-Url: https://codereview.chromium.org/2147733002
Diffstat (limited to 'src/ports')
-rw-r--r-- | src/ports/SkFontConfigTypeface.h | 4 | ||||
-rw-r--r-- | src/ports/SkFontHost_FreeType_common.h | 4 | ||||
-rw-r--r-- | src/ports/SkFontHost_mac.cpp | 2 | ||||
-rw-r--r-- | src/ports/SkFontHost_win.cpp | 2 | ||||
-rw-r--r-- | src/ports/SkFontMgr_android.cpp | 2 | ||||
-rw-r--r-- | src/ports/SkFontMgr_custom.cpp | 2 | ||||
-rw-r--r-- | src/ports/SkFontMgr_fontconfig.cpp | 3 | ||||
-rw-r--r-- | src/ports/SkTypeface_win_dw.h | 7 |
8 files changed, 12 insertions, 14 deletions
diff --git a/src/ports/SkFontConfigTypeface.h b/src/ports/SkFontConfigTypeface.h index eb5db94fdf..590c6fac89 100644 --- a/src/ports/SkFontConfigTypeface.h +++ b/src/ports/SkFontConfigTypeface.h @@ -50,14 +50,14 @@ protected: const SkFontConfigInterface::FontIdentity& fi, const SkString& familyName, const SkFontStyle& style) - : INHERITED(style, SkTypefaceCache::NewFontID(), false) + : INHERITED(style, false) , fFCI(SkRef(fci)) , fIdentity(fi) , fFamilyName(familyName) , fLocalStream(nullptr) {} SkTypeface_FCI(const SkFontStyle& style, bool fixedWidth, SkStreamAsset* localStream, int index) - : INHERITED(style, SkTypefaceCache::NewFontID(), fixedWidth) + : INHERITED(style, fixedWidth) , fLocalStream(localStream) { fIdentity.fTTCIndex = index; diff --git a/src/ports/SkFontHost_FreeType_common.h b/src/ports/SkFontHost_FreeType_common.h index 6d050cdd99..3801453e22 100644 --- a/src/ports/SkFontHost_FreeType_common.h +++ b/src/ports/SkFontHost_FreeType_common.h @@ -71,8 +71,8 @@ public: }; protected: - SkTypeface_FreeType(const SkFontStyle& style, SkFontID uniqueID, bool isFixedPitch) - : INHERITED(style, uniqueID, isFixedPitch) + SkTypeface_FreeType(const SkFontStyle& style, bool isFixedPitch) + : INHERITED(style, isFixedPitch) {} virtual SkScalerContext* onCreateScalerContext(const SkScalerContextEffects&, diff --git a/src/ports/SkFontHost_mac.cpp b/src/ports/SkFontHost_mac.cpp index c129a6b24b..55eec33502 100644 --- a/src/ports/SkFontHost_mac.cpp +++ b/src/ports/SkFontHost_mac.cpp @@ -436,7 +436,7 @@ public: SkTypeface_Mac(CTFontRef fontRef, CFTypeRef resourceRef, const SkFontStyle& fs, bool isFixedPitch, bool isLocalStream) - : SkTypeface(fs, SkTypefaceCache::NewFontID(), isFixedPitch) + : SkTypeface(fs, isFixedPitch) , fFontRef(fontRef) // caller has already called CFRetain for us , fOriginatingCFTypeRef(resourceRef) // caller has already called CFRetain for us , fHasColorGlyphs(SkToBool(CTFontGetSymbolicTraits(fFontRef) & SkCTFontColorGlyphsTrait)) diff --git a/src/ports/SkFontHost_win.cpp b/src/ports/SkFontHost_win.cpp index 25038dcf38..34d05068f5 100644 --- a/src/ports/SkFontHost_win.cpp +++ b/src/ports/SkFontHost_win.cpp @@ -206,7 +206,7 @@ static unsigned calculateUPEM(HDC hdc, const LOGFONT& lf) { class LogFontTypeface : public SkTypeface { public: LogFontTypeface(const SkFontStyle& style, const LOGFONT& lf, bool serializeAsStream) - : SkTypeface(style, SkTypefaceCache::NewFontID(), false) + : SkTypeface(style, false) , fLogFont(lf) , fSerializeAsStream(serializeAsStream) { diff --git a/src/ports/SkFontMgr_android.cpp b/src/ports/SkFontMgr_android.cpp index 2e619af0fb..a8d5b12a43 100644 --- a/src/ports/SkFontMgr_android.cpp +++ b/src/ports/SkFontMgr_android.cpp @@ -35,7 +35,7 @@ public: SkTypeface_Android(const SkFontStyle& style, bool isFixedPitch, const SkString& familyName) - : INHERITED(style, SkTypefaceCache::NewFontID(), isFixedPitch) + : INHERITED(style, isFixedPitch) , fFamilyName(familyName) { } diff --git a/src/ports/SkFontMgr_custom.cpp b/src/ports/SkFontMgr_custom.cpp index 0fc5180dd4..a05cc9b650 100644 --- a/src/ports/SkFontMgr_custom.cpp +++ b/src/ports/SkFontMgr_custom.cpp @@ -30,7 +30,7 @@ class SkTypeface_Custom : public SkTypeface_FreeType { public: SkTypeface_Custom(const SkFontStyle& style, bool isFixedPitch, bool sysFont, const SkString familyName, int index) - : INHERITED(style, SkTypefaceCache::NewFontID(), isFixedPitch) + : INHERITED(style, isFixedPitch) , fIsSysFont(sysFont), fFamilyName(familyName), fIndex(index) { } diff --git a/src/ports/SkFontMgr_fontconfig.cpp b/src/ports/SkFontMgr_fontconfig.cpp index 610a3001fb..0876fb6325 100644 --- a/src/ports/SkFontMgr_fontconfig.cpp +++ b/src/ports/SkFontMgr_fontconfig.cpp @@ -405,7 +405,7 @@ class SkTypeface_stream : public SkTypeface_FreeType { public: /** @param data takes ownership of the font data.*/ SkTypeface_stream(SkFontData* data, const SkFontStyle& style, bool fixedWidth) - : INHERITED(style, SkTypefaceCache::NewFontID(), fixedWidth) + : INHERITED(style, fixedWidth) , fData(data) { }; @@ -493,7 +493,6 @@ private: /** @param pattern takes ownership of the reference. */ SkTypeface_fontconfig(FcPattern* pattern) : INHERITED(skfontstyle_from_fcpattern(pattern), - SkTypefaceCache::NewFontID(), FC_PROPORTIONAL != get_int(pattern, FC_SPACING, FC_PROPORTIONAL)) , fPattern(pattern) { }; diff --git a/src/ports/SkTypeface_win_dw.h b/src/ports/SkTypeface_win_dw.h index 11b3fb5ffc..1119841e00 100644 --- a/src/ports/SkTypeface_win_dw.h +++ b/src/ports/SkTypeface_win_dw.h @@ -39,14 +39,14 @@ static SkFontStyle get_style(IDWriteFont* font) { class DWriteFontTypeface : public SkTypeface { private: - DWriteFontTypeface(const SkFontStyle& style, SkFontID fontID, + DWriteFontTypeface(const SkFontStyle& style, IDWriteFactory* factory, IDWriteFontFace* fontFace, IDWriteFont* font, IDWriteFontFamily* fontFamily, IDWriteFontFileLoader* fontFileLoader = nullptr, IDWriteFontCollectionLoader* fontCollectionLoader = nullptr) - : SkTypeface(style, fontID, false) + : SkTypeface(style, false) , fFactory(SkRefComPtr(factory)) , fDWriteFontCollectionLoader(SkSafeRefComPtr(fontCollectionLoader)) , fDWriteFontFileLoader(SkSafeRefComPtr(fontFileLoader)) @@ -80,8 +80,7 @@ public: IDWriteFontFamily* fontFamily, IDWriteFontFileLoader* fontFileLoader = nullptr, IDWriteFontCollectionLoader* fontCollectionLoader = nullptr) { - SkFontID fontID = SkTypefaceCache::NewFontID(); - return new DWriteFontTypeface(get_style(font), fontID, factory, fontFace, font, fontFamily, + return new DWriteFontTypeface(get_style(font), factory, fontFace, font, fontFamily, fontFileLoader, fontCollectionLoader); } |