Index: src/gpu/text/GrBatchFontCache.h |
diff --git a/src/gpu/text/GrBatchFontCache.h b/src/gpu/text/GrBatchFontCache.h |
index 8e420cd146bda39cbdf39dfee028c4304d53e116..aa29747df59dfa63b2af18e934401d5885e95639 100644 |
--- a/src/gpu/text/GrBatchFontCache.h |
+++ b/src/gpu/text/GrBatchFontCache.h |
@@ -24,12 +24,9 @@ class GrGpu; |
*/ |
class GrBatchTextStrike : public SkNVRefCnt<GrBatchTextStrike> { |
public: |
- GrBatchTextStrike(GrBatchFontCache*, const GrFontDescKey* fontScalerKey); |
+ GrBatchTextStrike(GrBatchFontCache*, const SkDescriptor& fontScalerKey); |
~GrBatchTextStrike(); |
- const GrFontDescKey* getFontScalerKey() const { return fFontScalerKey; } |
- GrBatchFontCache* getBatchFontCache() const { return fBatchFontCache; } |
- |
inline GrGlyph* getGlyph(const SkGlyph& skGlyph, GrGlyph::PackedID packed, |
GrFontScaler* scaler) { |
GrGlyph* glyph = fCache.find(packed); |
@@ -75,16 +72,15 @@ public: |
// If a TextStrike is abandoned by the cache, then the caller must get a new strike |
bool isAbandoned() const { return fIsAbandoned; } |
- static const GrFontDescKey& GetKey(const GrBatchTextStrike& ts) { |
- return *(ts.fFontScalerKey); |
- } |
- static uint32_t Hash(const GrFontDescKey& key) { |
- return key.getHash(); |
+ static const SkDescriptor& GetKey(const GrBatchTextStrike& ts) { |
+ return *ts.fFontScalerKey.getDesc(); |
} |
+ static uint32_t Hash(const SkDescriptor& desc) { return desc.getChecksum(); } |
+ |
private: |
SkTDynamicHash<GrGlyph, GrGlyph::PackedID> fCache; |
- SkAutoTUnref<const GrFontDescKey> fFontScalerKey; |
+ SkAutoDescriptor fFontScalerKey; |
SkVarAlloc fPool; |
GrBatchFontCache* fBatchFontCache; |
@@ -113,7 +109,7 @@ public: |
// Therefore, the caller must check GrBatchTextStrike::isAbandoned() if there are other |
// interactions with the cache since the strike was received. |
inline GrBatchTextStrike* getStrike(GrFontScaler* scaler) { |
- GrBatchTextStrike* strike = fCache.find(*(scaler->getKey())); |
+ GrBatchTextStrike* strike = fCache.find(scaler->getKey()); |
if (nullptr == strike) { |
strike = this->generateStrike(scaler); |
} |
@@ -221,8 +217,9 @@ private: |
static void HandleEviction(GrBatchAtlas::AtlasID, void*); |
+ using StrikeHash = SkTDynamicHash<GrBatchTextStrike, SkDescriptor>; |
GrContext* fContext; |
- SkTDynamicHash<GrBatchTextStrike, GrFontDescKey> fCache; |
+ StrikeHash fCache; |
GrBatchAtlas* fAtlases[kMaskFormatCount]; |
GrBatchTextStrike* fPreserveStrike; |
GrBatchAtlasConfig fAtlasConfigs[kMaskFormatCount]; |