Loading core/java/android/view/GLES20Canvas.java +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ class GLES20Canvas extends HardwareCanvas { // The native renderer will be destroyed when this object dies. // DO NOT overwrite this reference once it is set. @SuppressWarnings("unused") @SuppressWarnings({"unused", "FieldCanBeLocal"}) private CanvasFinalizer mFinalizer; private int mWidth; Loading core/java/android/view/GLES20RenderLayer.java +0 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.graphics.Canvas; * {@link Canvas} that can be used to render into an FBO using OpenGL. */ class GLES20RenderLayer extends GLES20Layer { private int mLayerWidth; private int mLayerHeight; Loading libs/hwui/LayerCache.cpp +9 −5 Original line number Diff line number Diff line Loading @@ -112,15 +112,19 @@ Layer* LayerCache::get(const uint32_t width, const uint32_t height) { glPixelStorei(GL_UNPACK_ALIGNMENT, 4); #if DEBUG_LAYERS 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); } #endif } return layer; } bool LayerCache::resize(Layer* layer, const uint32_t width, const uint32_t height) { Loading libs/hwui/LayerCache.h +5 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,11 @@ public: */ uint32_t getSize(); /** * Prints out the content of the cache. */ void dump(); private: void deleteLayer(Layer* layer); Loading libs/hwui/LayerRenderer.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -167,7 +167,7 @@ void LayerRenderer::generateMesh() { /////////////////////////////////////////////////////////////////////////////// Layer* LayerRenderer::createLayer(uint32_t width, uint32_t height, bool isOpaque) { LAYER_RENDERER_LOGD("Creating new layer %dx%d", width, height); LAYER_RENDERER_LOGD("Requesting new render layer %dx%d", width, height); GLuint fbo = Caches::getInstance().fboCache.get(); if (!fbo) { Loading Loading @@ -288,16 +288,22 @@ void LayerRenderer::updateTextureLayer(Layer* layer, uint32_t width, uint32_t he void LayerRenderer::destroyLayer(Layer* layer) { if (layer) { LAYER_RENDERER_LOGD("Destroying layer, fbo = %d", layer->getFbo()); LAYER_RENDERER_LOGD("Recycling layer, %dx%d fbo = %d", layer->getWidth(), layer->getHeight(), layer->getFbo()); if (layer->getFbo()) { Caches::getInstance().fboCache.put(layer->getFbo()); } if (!Caches::getInstance().layerCache.put(layer)) { LAYER_RENDERER_LOGD(" Destroyed!"); layer->deleteTexture(); delete layer; } else { LAYER_RENDERER_LOGD(" Cached!"); #if DEBUG_LAYERS Caches::getInstance().layerCache.dump(); #endif layer->region.clear(); } } Loading Loading
core/java/android/view/GLES20Canvas.java +1 −1 Original line number Diff line number Diff line Loading @@ -51,7 +51,7 @@ class GLES20Canvas extends HardwareCanvas { // The native renderer will be destroyed when this object dies. // DO NOT overwrite this reference once it is set. @SuppressWarnings("unused") @SuppressWarnings({"unused", "FieldCanBeLocal"}) private CanvasFinalizer mFinalizer; private int mWidth; Loading
core/java/android/view/GLES20RenderLayer.java +0 −1 Original line number Diff line number Diff line Loading @@ -24,7 +24,6 @@ import android.graphics.Canvas; * {@link Canvas} that can be used to render into an FBO using OpenGL. */ class GLES20RenderLayer extends GLES20Layer { private int mLayerWidth; private int mLayerHeight; Loading
libs/hwui/LayerCache.cpp +9 −5 Original line number Diff line number Diff line Loading @@ -112,15 +112,19 @@ Layer* LayerCache::get(const uint32_t width, const uint32_t height) { glPixelStorei(GL_UNPACK_ALIGNMENT, 4); #if DEBUG_LAYERS 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); } #endif } return layer; } bool LayerCache::resize(Layer* layer, const uint32_t width, const uint32_t height) { Loading
libs/hwui/LayerCache.h +5 −0 Original line number Diff line number Diff line Loading @@ -101,6 +101,11 @@ public: */ uint32_t getSize(); /** * Prints out the content of the cache. */ void dump(); private: void deleteLayer(Layer* layer); Loading
libs/hwui/LayerRenderer.cpp +8 −2 Original line number Diff line number Diff line Loading @@ -167,7 +167,7 @@ void LayerRenderer::generateMesh() { /////////////////////////////////////////////////////////////////////////////// Layer* LayerRenderer::createLayer(uint32_t width, uint32_t height, bool isOpaque) { LAYER_RENDERER_LOGD("Creating new layer %dx%d", width, height); LAYER_RENDERER_LOGD("Requesting new render layer %dx%d", width, height); GLuint fbo = Caches::getInstance().fboCache.get(); if (!fbo) { Loading Loading @@ -288,16 +288,22 @@ void LayerRenderer::updateTextureLayer(Layer* layer, uint32_t width, uint32_t he void LayerRenderer::destroyLayer(Layer* layer) { if (layer) { LAYER_RENDERER_LOGD("Destroying layer, fbo = %d", layer->getFbo()); LAYER_RENDERER_LOGD("Recycling layer, %dx%d fbo = %d", layer->getWidth(), layer->getHeight(), layer->getFbo()); if (layer->getFbo()) { Caches::getInstance().fboCache.put(layer->getFbo()); } if (!Caches::getInstance().layerCache.put(layer)) { LAYER_RENDERER_LOGD(" Destroyed!"); layer->deleteTexture(); delete layer; } else { LAYER_RENDERER_LOGD(" Cached!"); #if DEBUG_LAYERS Caches::getInstance().layerCache.dump(); #endif layer->region.clear(); } } Loading