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

Unified Diff: src/core/SkImageFilter.cpp

Issue 376183004: Slim Skia down to just one murmur3 implementation. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: fix types 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/SkChecksum.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkImageFilter.cpp
diff --git a/src/core/SkImageFilter.cpp b/src/core/SkImageFilter.cpp
index 64603b4cb5244b423ccdf32c28c7b7bd7519a617..8a0e734b245fd7562c4d6135d8cce9e8a308be3c 100644
--- a/src/core/SkImageFilter.cpp
+++ b/src/core/SkImageFilter.cpp
@@ -8,6 +8,7 @@
#include "SkImageFilter.h"
#include "SkBitmap.h"
+#include "SkChecksum.h"
#include "SkDevice.h"
#include "SkReadBuffer.h"
#include "SkWriteBuffer.h"
@@ -334,31 +335,6 @@ bool SkImageFilter::getInputResultGPU(SkImageFilter::Proxy* proxy,
}
#endif
-static uint32_t compute_hash(const uint32_t* data, int count) {
- uint32_t hash = 0;
-
- for (int i = 0; i < count; ++i) {
- uint32_t k = data[i];
- k *= 0xcc9e2d51;
- k = (k << 15) | (k >> 17);
- k *= 0x1b873593;
-
- hash ^= k;
- hash = (hash << 13) | (hash >> 19);
- hash *= 5;
- hash += 0xe6546b64;
- }
-
- // hash ^= size;
- hash ^= hash >> 16;
- hash *= 0x85ebca6b;
- hash ^= hash >> 13;
- hash *= 0xc2b2ae35;
- hash ^= hash >> 16;
-
- return hash;
-}
-
class CacheImpl : public SkImageFilter::Cache {
public:
explicit CacheImpl(int minChildren) : fMinChildren(minChildren) {
@@ -381,7 +357,7 @@ private:
return v.fKey;
}
static uint32_t Hash(Key key) {
- return compute_hash(reinterpret_cast<const uint32_t*>(&key), sizeof(Key) / sizeof(uint32_t));
+ return SkChecksum::Murmur3(reinterpret_cast<const uint32_t*>(&key), sizeof(Key));
}
};
SkTDynamicHash<Value, Key> fData;
« no previous file with comments | « src/core/SkChecksum.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698