diff options
Diffstat (limited to 'libs/hwui/Layer.cpp')
-rw-r--r-- | libs/hwui/Layer.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp index 9aa29ca..05259ff 100644 --- a/libs/hwui/Layer.cpp +++ b/libs/hwui/Layer.cpp @@ -69,17 +69,25 @@ Layer::Layer(Type layerType, RenderState& renderState, const uint32_t layerWidth } Layer::~Layer() { - renderState.requireGLContext(); renderState.unregisterLayer(this); SkSafeUnref(colorFilter); - removeFbo(); - deleteTexture(); + + if (stencil || fbo || texture.id) { + renderState.requireGLContext(); + removeFbo(); + deleteTexture(); + } delete[] mesh; delete deferredList; delete renderer; } +void Layer::onGlContextLost() { + removeFbo(); + deleteTexture(); +} + uint32_t Layer::computeIdealWidth(uint32_t layerWidth) { return uint32_t(ceilf(layerWidth / float(LAYER_SIZE)) * LAYER_SIZE); } |