diff options
Diffstat (limited to 'libs/hwui')
-rw-r--r-- | libs/hwui/Layer.cpp | 12 | ||||
-rw-r--r-- | libs/hwui/Layer.h | 2 | ||||
-rw-r--r-- | libs/hwui/LayerRenderer.cpp | 8 | ||||
-rw-r--r-- | libs/hwui/LayerRenderer.h | 4 | ||||
-rw-r--r-- | libs/hwui/Texture.h | 2 |
5 files changed, 13 insertions, 15 deletions
diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp index fb525ee..882e4bb 100644 --- a/libs/hwui/Layer.cpp +++ b/libs/hwui/Layer.cpp @@ -19,6 +19,7 @@ #include <utils/Log.h> #include "Layer.h" +#include "LayerRenderer.h" #include "OpenGLRenderer.h" #include "Caches.h" @@ -46,14 +47,15 @@ Layer::~Layer() { if (mesh) delete mesh; if (meshIndices) delete meshIndices; if (colorFilter) Caches::getInstance().resourceCache.decrementRefcount(colorFilter); - if (fbo) Caches::getInstance().fboCache.put(fbo); + removeFbo(); deleteTexture(); } -void Layer::freeResourcesLocked() { - if (colorFilter) { - Caches::getInstance().resourceCache.decrementRefcountLocked(colorFilter); - colorFilter = NULL; +void Layer::removeFbo() { + if (fbo) { + LayerRenderer::flushLayer(this); + Caches::getInstance().fboCache.put(fbo); + fbo = 0; } } diff --git a/libs/hwui/Layer.h b/libs/hwui/Layer.h index 9b6205d..69be317 100644 --- a/libs/hwui/Layer.h +++ b/libs/hwui/Layer.h @@ -48,7 +48,7 @@ struct Layer { Layer(const uint32_t layerWidth, const uint32_t layerHeight); ~Layer(); - void freeResourcesLocked(); + void removeFbo(); /** * Sets this layer's region to a rectangle. Computes the appropriate diff --git a/libs/hwui/LayerRenderer.cpp b/libs/hwui/LayerRenderer.cpp index 799aea3..f2e7f66 100644 --- a/libs/hwui/LayerRenderer.cpp +++ b/libs/hwui/LayerRenderer.cpp @@ -299,13 +299,6 @@ void LayerRenderer::destroyLayer(Layer* layer) { LAYER_RENDERER_LOGD("Recycling layer, %dx%d fbo = %d", layer->getWidth(), layer->getHeight(), layer->getFbo()); - GLuint fbo = layer->getFbo(); - if (fbo) { - flushLayer(layer); - Caches::getInstance().fboCache.put(fbo); - layer->setFbo(0); - } - if (!Caches::getInstance().layerCache.put(layer)) { LAYER_RENDERER_LOGD(" Destroyed!"); Caches::getInstance().resourceCache.decrementRefcount(layer); @@ -314,6 +307,7 @@ void LayerRenderer::destroyLayer(Layer* layer) { #if DEBUG_LAYER_RENDERER Caches::getInstance().layerCache.dump(); #endif + layer->removeFbo(); layer->region.clear(); } } diff --git a/libs/hwui/LayerRenderer.h b/libs/hwui/LayerRenderer.h index 392f863..acedbcc 100644 --- a/libs/hwui/LayerRenderer.h +++ b/libs/hwui/LayerRenderer.h @@ -60,6 +60,8 @@ public: ANDROID_API static void destroyLayerDeferred(Layer* layer); ANDROID_API static bool copyLayer(Layer* layer, SkBitmap* bitmap); + static void flushLayer(Layer* layer); + protected: virtual bool hasLayer(); virtual Region* getRegion(); @@ -69,8 +71,6 @@ protected: private: void generateMesh(); - static void flushLayer(Layer* layer); - Layer* mLayer; }; // class LayerRenderer diff --git a/libs/hwui/Texture.h b/libs/hwui/Texture.h index 1adf2c7..03e2172 100644 --- a/libs/hwui/Texture.h +++ b/libs/hwui/Texture.h @@ -38,6 +38,8 @@ struct Texture { firstFilter = true; firstWrap = true; + + id = 0; } void setWrap(GLenum wrap, bool bindTexture = false, bool force = false, |