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

Unified Diff: src/gpu/GrTextStrike.h

Issue 390103002: Replace use of GrTHashTable in GrFontCache with SkTDynamicHash. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove deleteAll(); use iterator instead. Created 6 years, 5 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 | « src/core/SkDescriptor.h ('k') | src/gpu/GrTextStrike.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/GrTextStrike.h
diff --git a/src/gpu/GrTextStrike.h b/src/gpu/GrTextStrike.h
index f7dec955a4df5b121805a31036df35b1c891e98d..89b054291d72ea4578ad768b1afbf583ff054c50 100644
--- a/src/gpu/GrTextStrike.h
+++ b/src/gpu/GrTextStrike.h
@@ -13,7 +13,7 @@
#include "GrAllocPool.h"
#include "GrFontScaler.h"
-#include "GrTHashTable.h"
+#include "SkTDynamicHash.h"
#include "GrGlyph.h"
#include "GrDrawTarget.h"
#include "GrAtlas.h"
@@ -39,22 +39,25 @@ public:
bool addGlyphToAtlas(GrGlyph*, GrFontScaler*);
// testing
- int countGlyphs() const { return fCache.getArray().count(); }
- const GrGlyph* glyphAt(int index) const {
- return fCache.getArray()[index];
- }
+ int countGlyphs() const { return fCache.count(); }
// remove any references to this plot
void removePlot(const GrPlot* plot);
+ static const GrFontDescKey& GetKey(const GrTextStrike& ts) {
+ return *(ts.fFontScalerKey);
+ }
+ static uint32_t Hash(const GrFontDescKey& key) {
+ return key.getHash();
+ }
+
public:
// for easy removal from list
GrTextStrike* fPrev;
GrTextStrike* fNext;
private:
- class Key;
- GrTHashTable<GrGlyph, Key, 7> fCache;
+ SkTDynamicHash<GrGlyph, GrGlyph::PackedID> fCache;
const GrFontDescKey* fFontScalerKey;
GrTAllocPool<GrGlyph> fPool;
@@ -83,10 +86,7 @@ public:
bool freeUnusedPlot(GrTextStrike* preserveStrike);
// testing
- int countStrikes() const { return fCache.getArray().count(); }
- const GrTextStrike* strikeAt(int index) const {
- return fCache.getArray()[index];
- }
+ int countStrikes() const { return fCache.count(); }
GrTextStrike* getHeadStrike() const { return fHead; }
void updateTextures() {
@@ -117,8 +117,7 @@ public:
private:
friend class GrFontPurgeListener;
- class Key;
- GrTHashTable<GrTextStrike, Key, 8> fCache;
+ SkTDynamicHash<GrTextStrike, GrFontDescKey> fCache;
// for LRU
GrTextStrike* fHead;
GrTextStrike* fTail;
@@ -126,7 +125,7 @@ private:
GrGpu* fGpu;
GrAtlas* fAtlases[kAtlasCount];
- GrTextStrike* generateStrike(GrFontScaler*, const Key&);
+ GrTextStrike* generateStrike(GrFontScaler*);
inline void detachStrikeFromList(GrTextStrike*);
void purgeStrike(GrTextStrike* strike);
};
« no previous file with comments | « src/core/SkDescriptor.h ('k') | src/gpu/GrTextStrike.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698