diff options
author | 2015-05-04 12:03:50 -0700 | |
---|---|---|
committer | 2015-05-04 12:03:51 -0700 | |
commit | 64fb51d36df5d4e857c3425fe4cb1b1ecbd169fb (patch) | |
tree | 3e62a0187f6a4f635ba3c5e00ca7486c4fbd2d07 /src/core | |
parent | 07ab9f3beda017d06089797de8c79d833b5a7659 (diff) |
Fix typeface ids on Mac.
The current typeface ids with CoreText rely on ATS (which causes
memory use issues) or font data (which is unreliable, and will not
work with axes and synthetics). This changes the code so that stream
fonts never end up in the cache and always get a unique id, and
system fonts will be given an id as they are used.
Review URL: https://codereview.chromium.org/1125763002
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/SkTypefaceCache.cpp | 17 | ||||
-rw-r--r-- | src/core/SkTypefaceCache.h | 9 |
2 files changed, 0 insertions, 26 deletions
diff --git a/src/core/SkTypefaceCache.cpp b/src/core/SkTypefaceCache.cpp index 8adffe6a3a..f253b60523 100644 --- a/src/core/SkTypefaceCache.cpp +++ b/src/core/SkTypefaceCache.cpp @@ -34,18 +34,6 @@ void SkTypefaceCache::add(SkTypeface* face, const SkFontStyle& requestedStyle) { rec->fRequestedStyle = requestedStyle; } -SkTypeface* SkTypefaceCache::findByID(SkFontID fontID) const { - const Rec* curr = fArray.begin(); - const Rec* stop = fArray.end(); - while (curr < stop) { - if (curr->fFace->uniqueID() == fontID) { - return curr->fFace; - } - curr += 1; - } - return NULL; -} - SkTypeface* SkTypefaceCache::findByProcAndRef(FindProc proc, void* ctx) const { const Rec* curr = fArray.begin(); const Rec* stop = fArray.end(); @@ -100,11 +88,6 @@ void SkTypefaceCache::Add(SkTypeface* face, const SkFontStyle& requestedStyle) { Get().add(face, requestedStyle); } -SkTypeface* SkTypefaceCache::FindByID(SkFontID fontID) { - SkAutoMutexAcquire ama(gMutex); - return Get().findByID(fontID); -} - SkTypeface* SkTypefaceCache::FindByProcAndRef(FindProc proc, void* ctx) { SkAutoMutexAcquire ama(gMutex); SkTypeface* typeface = Get().findByProcAndRef(proc, ctx); diff --git a/src/core/SkTypefaceCache.h b/src/core/SkTypefaceCache.h index c6b433dead..792958679c 100644 --- a/src/core/SkTypefaceCache.h +++ b/src/core/SkTypefaceCache.h @@ -42,14 +42,6 @@ public: void add(SkTypeface*, const SkFontStyle& requested); /** - * Search the cache for a typeface with the specified fontID (uniqueID). - * If one is found, return it (its reference count is unmodified). If none - * is found, return NULL. The reference count is unmodified as it is - * assumed that the stack will contain a ref to the typeface. - */ - SkTypeface* findByID(SkFontID findID) const; - - /** * Iterate through the cache, calling proc(typeface, ctx) with each * typeface. If proc returns true, then we return that typeface (this * ref()s the typeface). If it never returns true, we return NULL. @@ -73,7 +65,6 @@ public: // These are static wrappers around a global instance of a cache. static void Add(SkTypeface*, const SkFontStyle& requested); - static SkTypeface* FindByID(SkFontID fontID); static SkTypeface* FindByProcAndRef(FindProc proc, void* ctx); static void PurgeAll(); |