diff options
author | Ben Wagner <bungeman@google.com> | 2016-10-17 16:55:53 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2016-10-17 21:22:35 +0000 |
commit | fa1a45ee1317ce603be78e96cdeb6d5ea1b91b30 (patch) | |
tree | e3afb42b8b87b66e4a44e8faaca7fcd3431effeb /src | |
parent | 29121ebd9e4673d7ca6ac1ba3dd905fbdc9d50aa (diff) |
Remove aux procs from SkGlyphCache.
Doesn't appear that anyone is using these anymore. The last user was
removed with https://codereview.chromium.org/1985163002/ landed as
https://skia.googlesource.com/skia/+/c2878e23d405e7ae77f6110602ad75ce1f6b941c
Change-Id: I224354cd0d1ecbbb1100aa1e4b415d48637a51f3
Reviewed-on: https://skia-review.googlesource.com/3582
Commit-Queue: Ben Wagner <bungeman@google.com>
Reviewed-by: Herb Derby <herb@google.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/core/SkGlyphCache.cpp | 50 | ||||
-rw-r--r-- | src/core/SkGlyphCache.h | 24 |
2 files changed, 0 insertions, 74 deletions
diff --git a/src/core/SkGlyphCache.cpp b/src/core/SkGlyphCache.cpp index a8eaa667a5..0ea4190f48 100644 --- a/src/core/SkGlyphCache.cpp +++ b/src/core/SkGlyphCache.cpp @@ -51,8 +51,6 @@ SkGlyphCache::SkGlyphCache(SkTypeface* typeface, const SkDescriptor* desc, SkSca fScalerContext->getFontMetrics(&fFontMetrics); fMemoryUsed = sizeof(*this); - - fAuxProcList = nullptr; } SkGlyphCache::~SkGlyphCache() { @@ -62,7 +60,6 @@ SkGlyphCache::~SkGlyphCache() { } } ); SkDescriptor::Free(fDesc); delete fScalerContext; - this->invokeAndRemoveAuxProcs(); } SkGlyphCache::CharGlyphRec* SkGlyphCache::getCharGlyphRec(PackedUnicharID packedUnicharID) { @@ -426,53 +423,6 @@ void SkGlyphCache::dump() const { } /////////////////////////////////////////////////////////////////////////////// - -bool SkGlyphCache::getAuxProcData(void (*proc)(void*), void** dataPtr) const { - const AuxProcRec* rec = fAuxProcList; - while (rec) { - if (rec->fProc == proc) { - if (dataPtr) { - *dataPtr = rec->fData; - } - return true; - } - rec = rec->fNext; - } - return false; -} - -void SkGlyphCache::setAuxProc(void (*proc)(void*), void* data) { - if (proc == nullptr) { - return; - } - - AuxProcRec* rec = fAuxProcList; - while (rec) { - if (rec->fProc == proc) { - rec->fData = data; - return; - } - rec = rec->fNext; - } - // not found, create a new rec - rec = new AuxProcRec; - rec->fProc = proc; - rec->fData = data; - rec->fNext = fAuxProcList; - fAuxProcList = rec; -} - -void SkGlyphCache::invokeAndRemoveAuxProcs() { - AuxProcRec* rec = fAuxProcList; - while (rec) { - rec->fProc(rec->fData); - AuxProcRec* next = rec->fNext; - delete rec; - rec = next; - } -} - -/////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// size_t SkGlyphCache_Globals::getTotalMemoryUsed() const { diff --git a/src/core/SkGlyphCache.h b/src/core/SkGlyphCache.h index 84a32eb3ef..f2a6b758fc 100644 --- a/src/core/SkGlyphCache.h +++ b/src/core/SkGlyphCache.h @@ -109,20 +109,6 @@ public: void dump() const; - /** AuxProc/Data allow a client to associate data with this cache entry. Multiple clients can - use this, as their data is keyed with a function pointer. In addition to serving as a - key, the function pointer is called with the data when the glyphcache object is deleted, - so the client can cleanup their data as well. - NOTE: the auxProc must not try to access this glyphcache in any way, since it may be in - the process of being deleted. - */ - - //! If the proc is found, return true and set *dataPtr to its data - bool getAuxProcData(void (*auxProc)(void*), void** dataPtr) const; - - //! Add a proc/data pair to the glyphcache. proc should be non-null - void setAuxProc(void (*auxProc)(void*), void* auxData); - SkScalerContext* getScalerContext() const { return fScalerContext; } /** Find a matching cache entry, and call proc() with it. If none is found create a new one. @@ -208,12 +194,6 @@ private: PackedGlyphID fPackedGlyphID; }; - struct AuxProcRec { - AuxProcRec* fNext; - void (*fProc)(void*); - void* fData; - }; - // SkGlyphCache takes ownership of the scalercontext. SkGlyphCache(SkTypeface*, const SkDescriptor*, SkScalerContext*); ~SkGlyphCache(); @@ -235,8 +215,6 @@ private: // The id arg is a combined id generated by MakeID. CharGlyphRec* getCharGlyphRec(PackedUnicharID id); - void invokeAndRemoveAuxProcs(); - static void OffsetResults(const SkGlyph::Intercept* intercept, SkScalar scale, SkScalar xPos, SkScalar* array, int* count); static void AddInterval(SkScalar val, SkGlyph::Intercept* intercept); @@ -266,8 +244,6 @@ private: // used to track (approx) how much ram is tied-up in this cache size_t fMemoryUsed; - - AuxProcRec* fAuxProcList; }; class SkAutoGlyphCache : public std::unique_ptr<SkGlyphCache, SkGlyphCache::AttachCacheFunctor> { |