diff options
author | robertphillips <robertphillips@google.com> | 2014-07-20 09:40:00 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-07-20 09:40:00 -0700 |
commit | 3d533ac917eaadf2fb3561f57d7266d8c0e665fd (patch) | |
tree | e1a710cf8756032da254ec484a4bb6128e61086d /src/gpu/effects/GrTextureStripAtlas.h | |
parent | 249171e7d29b5559f3eefe9dbd437030bfad3fda (diff) |
Replace GrTHash with SkTDynamicHash
Mike: SkTDynamicHash changes
Brian: Ganesh changes
This removes three instances of GrTHash leaving the ones in GrTextStrike.h
R=mtklein@google.com, bsalomon@google.com
Author: robertphillips@google.com
Review URL: https://codereview.chromium.org/402693003
Diffstat (limited to 'src/gpu/effects/GrTextureStripAtlas.h')
-rw-r--r-- | src/gpu/effects/GrTextureStripAtlas.h | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/src/gpu/effects/GrTextureStripAtlas.h b/src/gpu/effects/GrTextureStripAtlas.h index 5227cc38bd..6d2fb8fdf8 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 |