diff options
Diffstat (limited to 'libs/hwui/PathCache.h')
-rw-r--r-- | libs/hwui/PathCache.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/libs/hwui/PathCache.h b/libs/hwui/PathCache.h index 4904a587f6f3..8a0235b88a64 100644 --- a/libs/hwui/PathCache.h +++ b/libs/hwui/PathCache.h @@ -22,8 +22,6 @@ #include "Debug.h" #include "ShapeCache.h" -#include "utils/Compare.h" - namespace android { namespace uirenderer { @@ -41,18 +39,28 @@ struct PathCacheEntry: public ShapeCacheEntry { path = NULL; } - bool lessThan(const ShapeCacheEntry& r) const { + hash_t hash() const { + uint32_t hash = ShapeCacheEntry::hash(); + hash = JenkinsHashMix(hash, android::hash_type(path)); + return JenkinsHashWhiten(hash); + } + + int compare(const ShapeCacheEntry& r) const { + int deltaInt = ShapeCacheEntry::compare(r); + if (deltaInt != 0) return deltaInt; + const PathCacheEntry& rhs = (const PathCacheEntry&) r; - LTE_INT(path) { - return false; - } - return false; + return path - rhs.path; } SkPath* path; }; // PathCacheEntry +inline hash_t hash_type(const PathCacheEntry& entry) { + return entry.hash(); +} + /** * A simple LRU path cache. The cache has a maximum size expressed in bytes. * Any texture added to the cache causing the cache to grow beyond the maximum |