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

Unified Diff: src/gpu/effects/GrTextureStripAtlas.h

Issue 402693003: Replace GrTHash with SkTDynamicHash (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Fix compiler complaints 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
Index: src/gpu/effects/GrTextureStripAtlas.h
diff --git a/src/gpu/effects/GrTextureStripAtlas.h b/src/gpu/effects/GrTextureStripAtlas.h
index 5227cc38bd720078f32f24d7962d73a49ae50d5b..6d2fb8fdf8daef78da47b5560a0901d7fdde7cd0 100644
--- a/src/gpu/effects/GrTextureStripAtlas.h
+++ b/src/gpu/effects/GrTextureStripAtlas.h
@@ -9,10 +9,10 @@
#define GrTextureStripAtlas_DEFINED
#include "GrBinHashKey.h"
-#include "GrTHashTable.h"
#include "SkBitmap.h"
#include "SkGr.h"
#include "SkTDArray.h"
+#include "SkTDynamicHash.h"
#include "SkTypes.h"
/**
@@ -135,23 +135,24 @@ private:
static void CleanUp(const GrContext* context, void* info);
// Hash table entry for atlases
- class AtlasEntry;
- class AtlasHashKey : public GrBinHashKey<sizeof(GrTextureStripAtlas::Desc)> {
- public:
- static bool Equals(const AtlasEntry& entry, const AtlasHashKey& key);
- static bool LessThan(const AtlasEntry& entry, const AtlasHashKey& key);
- };
class AtlasEntry : public ::SkNoncopyable {
public:
+ // for SkTDynamicHash
+ class Key : public GrMurmur3HashKey<sizeof(GrTextureStripAtlas::Desc)> {};
+ static const Key& GetKey(const AtlasEntry& entry) { return entry.fKey; }
+ static uint32_t Hash(const Key& key) { return key.getHash(); }
+
+ // AtlasEntry proper
AtlasEntry() : fAtlas(NULL) {}
~AtlasEntry() { SkDELETE(fAtlas); }
- AtlasHashKey fKey;
+ Key fKey;
GrTextureStripAtlas* fAtlas;
};
- static GrTHashTable<AtlasEntry, AtlasHashKey, 8>* gAtlasCache;
+ class Hash;
+ static Hash* gAtlasCache;
- static GrTHashTable<AtlasEntry, AtlasHashKey, 8>* GetCache();
+ static Hash* GetCache();
// We increment gCacheCount for each atlas
static int32_t gCacheCount;
@@ -181,14 +182,4 @@ private:
SkTDArray<AtlasRow*> fKeyTable;
};
-inline bool GrTextureStripAtlas::AtlasHashKey::Equals(const AtlasEntry& entry,
- const AtlasHashKey& key) {
- return entry.fKey == key;
-}
-
-inline bool GrTextureStripAtlas::AtlasHashKey::LessThan(const AtlasEntry& entry,
- const AtlasHashKey& key) {
- return entry.fKey < key;
-}
-
#endif

Powered by Google App Engine
This is Rietveld 408576698