Optimize saveLayer() when the clip flag is set.
This speeds up applications, especially Launcher.
diff --git a/libs/hwui/GenerationCache.h b/libs/hwui/GenerationCache.h
index 070e33f..35c6bea 100644
--- a/libs/hwui/GenerationCache.h
+++ b/libs/hwui/GenerationCache.h
@@ -65,6 +65,7 @@
void put(K key, V value);
V remove(K key);
V removeOldest();
+ V getValueAt(uint32_t index) const;
uint32_t size() const;
@@ -128,6 +129,11 @@
}
template<typename K, typename V>
+V GenerationCache<K, V>::getValueAt(uint32_t index) const {
+ return mCache.valueAt(index);
+}
+
+template<typename K, typename V>
V GenerationCache<K, V>::get(K key) {
ssize_t index = mCache.indexOfKey(key);
if (index >= 0) {