Automatically cleanup textures that don't fit in the cache.
Change-Id: I4f29ed96ea11118b391fb957e1e4d1b8fcef1537
diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp
index a72045b..db8c863 100644
--- a/libs/hwui/OpenGLRenderer.cpp
+++ b/libs/hwui/OpenGLRenderer.cpp
@@ -436,6 +436,8 @@
}
const Texture* texture = mTextureCache.get(bitmap);
+ const AutoTexture autoCleanup(texture);
+
drawTextureRect(left, top, right, bottom, texture, paint);
}
@@ -449,6 +451,8 @@
}
const Texture* texture = mTextureCache.get(bitmap);
+ const AutoTexture autoCleanup(texture);
+
drawTextureRect(r.left, r.top, r.right, r.bottom, texture, paint);
}
@@ -461,6 +465,7 @@
}
const Texture* texture = mTextureCache.get(bitmap);
+ const AutoTexture autoCleanup(texture);
const float width = texture->width;
const float height = texture->height;
@@ -484,6 +489,7 @@
}
const Texture* texture = mTextureCache.get(bitmap);
+ const AutoTexture autoCleanup(texture);
int alpha;
SkXfermode::Mode mode;
@@ -610,7 +616,8 @@
GLuint textureUnit = 0;
glActiveTexture(gTextureUnits[textureUnit]);
- PathTexture* texture = mPathCache.get(path, paint);
+ const PathTexture* texture = mPathCache.get(path, paint);
+ const AutoTexture autoCleanup(texture);
int alpha;
SkXfermode::Mode mode;