Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1591)

Unified Diff: src/gpu/text/GrBatchFontCache.h

Issue 1988833003: Remove GrFontDescKey. (Closed) Base URL: https://chromium.googlesource.com/skia.git@fontscaler
Patch Set: update Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/gpu/text/GrBatchFontCache.cpp » ('j') | src/gpu/text/GrBatchFontCache.cpp » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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];
« no previous file with comments | « no previous file | src/gpu/text/GrBatchFontCache.cpp » ('j') | src/gpu/text/GrBatchFontCache.cpp » ('J')

Powered by Google App Engine
This is Rietveld 408576698