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

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

Issue 1233933002: Get rid of GrMurmur3Hash (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: tidy Created 5 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/gpu/GrMurmur3HashKey.h ('k') | src/gpu/effects/GrTextureStripAtlas.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/effects/GrTextureStripAtlas.h
diff --git a/src/gpu/effects/GrTextureStripAtlas.h b/src/gpu/effects/GrTextureStripAtlas.h
index 80b33bbac4bd7504246d481bea440b1b512aab30..3b18706b693d8afebbcaf95a04cbf468c8981d71 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,14 @@ public:
* Descriptor struct which we'll use as a hash table key
**/
struct Desc {
- Desc() { memset(this, 0, sizeof(*this)); }
- uint16_t fWidth, fHeight, fRowHeight;
- GrPixelConfig fConfig;
+ Desc() { sk_bzero(this, sizeof(*this)); }
GrContext* fContext;
- const uint32_t* asKey() const { return reinterpret_cast<const uint32_t*>(this); }
+ GrPixelConfig fConfig;
+ uint16_t fWidth, fHeight, fRowHeight;
+ uint16_t fUnusedPadding;
+ bool operator==(const Desc& other) const {
+ return 0 == memcmp(this, &other, sizeof(Desc));
+ }
};
/**
@@ -138,14 +141,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;
};
« no previous file with comments | « src/gpu/GrMurmur3HashKey.h ('k') | src/gpu/effects/GrTextureStripAtlas.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698