Chromium Code Reviews| Index: src/gpu/effects/GrTextureStripAtlas.h |
| diff --git a/src/gpu/effects/GrTextureStripAtlas.h b/src/gpu/effects/GrTextureStripAtlas.h |
| index 80b33bbac4bd7504246d481bea440b1b512aab30..b326a2baa6b9b32f8553acb573999d1c112cc8a4 100644 |
| --- a/src/gpu/effects/GrTextureStripAtlas.h |
| +++ b/src/gpu/effects/GrTextureStripAtlas.h |
| @@ -8,8 +8,8 @@ |
| #ifndef GrTextureStripAtlas_DEFINED |
| #define GrTextureStripAtlas_DEFINED |
| -#include "GrMurmur3HashKey.h" |
| #include "SkBitmap.h" |
| +#include "SkChecksum.h" |
| #include "SkGr.h" |
| #include "SkTDArray.h" |
| #include "SkTDynamicHash.h" |
| @@ -25,11 +25,13 @@ public: |
| * Descriptor struct which we'll use as a hash table key |
| **/ |
| struct Desc { |
| - Desc() { memset(this, 0, sizeof(*this)); } |
| + Desc() { sk_bzero(this, sizeof(*this)); } |
| uint16_t fWidth, fHeight, fRowHeight; |
|
mtklein
2015/07/13 19:26:11
It might be a good idea to explicitly add
uint1
|
| GrPixelConfig fConfig; |
| GrContext* fContext; |
| - const uint32_t* asKey() const { return reinterpret_cast<const uint32_t*>(this); } |
| + bool operator==(const Desc& other) const { |
| + return 0 == memcmp(this, &other, sizeof(Desc)); |
| + } |
| }; |
| /** |
| @@ -138,14 +140,13 @@ private: |
| 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(); } |
| + static const Desc& GetKey(const AtlasEntry& entry) { return entry.fDesc; } |
| + static uint32_t Hash(const Desc& desc) { return SkChecksum::Murmur3(&desc, sizeof(Desc)); } |
| // AtlasEntry proper |
| AtlasEntry() : fAtlas(NULL) {} |
| ~AtlasEntry() { SkDELETE(fAtlas); } |
| - Key fKey; |
| + Desc fDesc; |
| GrTextureStripAtlas* fAtlas; |
| }; |