summaryrefslogtreecommitdiff
path: root/libs/hwui/Layer.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2015-01-29 12:53:38 -0800
committerJohn Reck <jreck@google.com>2015-01-29 12:53:38 -0800
commit49bc4acfadf9c5b1e520217278ccb38010d38c89 (patch)
tree2731146935070300785f256599ed69a83a9afdab /libs/hwui/Layer.cpp
parent293b7b4fe510bf7df879e89bf748c0b8695f4310 (diff)
parentfe5ac4fc31ee671721f98cf28cf1bd32ac119998 (diff)
resolved conflicts for merge of fe5ac4fc to master
Change-Id: I6c0cc82db14b56297586469f940e408c0e218b3b
Diffstat (limited to 'libs/hwui/Layer.cpp')
-rw-r--r--libs/hwui/Layer.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp
index ee6154f2e5a1..7a4b830326a3 100644
--- a/libs/hwui/Layer.cpp
+++ b/libs/hwui/Layer.cpp
@@ -68,15 +68,23 @@ 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;
}
+void Layer::onGlContextLost() {
+ removeFbo();
+ deleteTexture();
+}
+
uint32_t Layer::computeIdealWidth(uint32_t layerWidth) {
return uint32_t(ceilf(layerWidth / float(LAYER_SIZE)) * LAYER_SIZE);
}