Fix gradients rendering and destructor crashes.
This changes binds all textures to GL_TEXTURE0, this will have
to be changed when combining shader capabilities.
Change-Id: I02df4f5ba41e9b01ffa52fd7c26b41477c7ed18f
diff --git a/libs/hwui/GenerationCache.h b/libs/hwui/GenerationCache.h
index 5c1b5e1..45b3ffa 100644
--- a/libs/hwui/GenerationCache.h
+++ b/libs/hwui/GenerationCache.h
@@ -34,13 +34,12 @@
struct Entry: public LightRefBase<Entry<EntryKey, EntryValue> > {
Entry() { }
Entry(const Entry<EntryKey, EntryValue>& e):
- key(e.key), value(e.value), index(e.index), parent(e.parent), child(e.child) { }
+ key(e.key), value(e.value), parent(e.parent), child(e.child) { }
Entry(sp<Entry<EntryKey, EntryValue> > e):
- key(e->key), value(e->value), index(e->index), parent(e->parent), child(e->child) { }
+ key(e->key), value(e->value), parent(e->parent), child(e->child) { }
EntryKey key;
EntryValue value;
- ssize_t index;
sp<Entry<EntryKey, EntryValue> > parent;
sp<Entry<EntryKey, EntryValue> > child;
@@ -156,7 +155,7 @@
void GenerationCache<K, V>::addToCache(sp<Entry<K, V> > entry, K key, V value) {
entry->key = key;
entry->value = value;
- entry->index = mCache.add(key, entry);
+ mCache.add(key, entry);
attachToCache(entry);
}
@@ -185,7 +184,10 @@
template<typename K, typename V>
V GenerationCache<K, V>::removeOldest() {
if (mOldest.get()) {
- return removeAt(mOldest->index);
+ ssize_t index = mCache.indexOfKey(mOldest->key);
+ if (index >= 0) {
+ return removeAt(index);
+ }
}
return NULL;