summaryrefslogtreecommitdiffstats
path: root/libs/hwui/LayerCache.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'libs/hwui/LayerCache.cpp')
-rw-r--r--libs/hwui/LayerCache.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/libs/hwui/LayerCache.cpp b/libs/hwui/LayerCache.cpp
index 36083af..0af0177 100644
--- a/libs/hwui/LayerCache.cpp
+++ b/libs/hwui/LayerCache.cpp
@@ -68,7 +68,9 @@ void LayerCache::setMaxSize(uint32_t maxSize) {
void LayerCache::deleteLayer(Layer* layer) {
if (layer) {
+ LAYER_LOGD("Destroying layer %dx%d", layer->getWidth(), layer->getHeight());
mSize -= layer->getWidth() * layer->getHeight() * 4;
+ layer->deleteFbo();
layer->deleteTexture();
delete layer;
}
@@ -111,17 +113,21 @@ Layer* LayerCache::get(const uint32_t width, const uint32_t height) {
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
#if DEBUG_LAYERS
- size_t size = mCache.size();
- for (size_t i = 0; i < size; i++) {
- const LayerEntry& entry = mCache.itemAt(i);
- LAYER_LOGD(" Layer size %dx%d", entry.mWidth, entry.mHeight);
- }
+ dump();
#endif
}
return layer;
}
+void LayerCache::dump() {
+ size_t size = mCache.size();
+ for (size_t i = 0; i < size; i++) {
+ const LayerEntry& entry = mCache.itemAt(i);
+ LAYER_LOGD(" Layer size %dx%d", entry.mWidth, entry.mHeight);
+ }
+}
+
bool LayerCache::resize(Layer* layer, const uint32_t width, const uint32_t height) {
// TODO: We should be smarter and see if we have a texture of the appropriate
// size already in the cache, and reuse it instead of creating a new one