diff options
author | 2012-11-28 17:35:51 -0800 | |
---|---|---|
committer | 2012-11-29 11:44:02 -0800 | |
commit | 059e12ccd20f5c249724a8362d6bac325334ea76 (patch) | |
tree | 7b15fa6bc6d2963715ea298a51cca3909c1e50c9 /libs/hwui/PathCache.h | |
parent | c653df46436a796556da2633f90353900344ce39 (diff) |
Use LruCache instead of GenerationCache in libhwui
Change-Id: Ic26ddc7151eb5462bcd243b21daf7187ed6d3bec
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 |