| Index: src/core/SkScaledImageCache.cpp
|
| diff --git a/src/core/SkScaledImageCache.cpp b/src/core/SkScaledImageCache.cpp
|
| index 1e7f51dd9e851d94a6c387e258f3512637c85e3f..eda4871711157cc2d64478867b774868fe7fb58d 100644
|
| --- a/src/core/SkScaledImageCache.cpp
|
| +++ b/src/core/SkScaledImageCache.cpp
|
| @@ -5,7 +5,6 @@
|
| * found in the LICENSE file.
|
| */
|
|
|
| -#include "SkChecksum.h"
|
| #include "SkScaledImageCache.h"
|
| #include "SkMipMap.h"
|
| #include "SkPixelRef.h"
|
| @@ -28,6 +27,32 @@
|
|
|
| static inline SkScaledImageCache::Rec* id_to_rec(SkScaledImageCache::ID* id) {
|
| return reinterpret_cast<SkScaledImageCache::Rec*>(id);
|
| +}
|
| +
|
| + // Implemented from en.wikipedia.org/wiki/MurmurHash.
|
| +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;
|
| }
|
|
|
| struct SkScaledImageCache::Key {
|
| @@ -39,7 +64,7 @@
|
| , fScaleX(scaleX)
|
| , fScaleY(scaleY)
|
| , fBounds(bounds) {
|
| - fHash = SkChecksum::Murmur3(&fGenID, 28);
|
| + fHash = compute_hash(&fGenID, 7);
|
| }
|
|
|
| bool operator<(const Key& other) const {
|
|
|