diff options
author | Chris Craik <ccraik@google.com> | 2014-09-08 16:40:21 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2014-09-08 16:44:47 -0700 |
commit | 8a226d24b8b2fde4c855d0051cb7bfc5b5813c36 (patch) | |
tree | dff0340b91172e35a5e2bff67e013e2fd27623ca /libs/hwui/Layer.cpp | |
parent | 95e71085e2d6f9482679a2a5c34d3d7fbc7d39c6 (diff) |
Don't track TextureLayer lifecycles in RenderState
bug:17208461
They are destroyed via finalizer-enqueued destroy method, so it's not
valid to check that they've been destroyed at gl context destruction
time.
Change-Id: I670f69825547facd5f31d44acb406418881fee00
Diffstat (limited to 'libs/hwui/Layer.cpp')
-rw-r--r-- | libs/hwui/Layer.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp index 25caae3a9e0c..91c4aee98d0d 100644 --- a/libs/hwui/Layer.cpp +++ b/libs/hwui/Layer.cpp @@ -29,15 +29,15 @@ namespace android { namespace uirenderer { -Layer::Layer(RenderState& renderState, const uint32_t layerWidth, const uint32_t layerHeight) +Layer::Layer(Type layerType, RenderState& renderState, const uint32_t layerWidth, const uint32_t layerHeight) : caches(Caches::getInstance()) , renderState(renderState) - , texture(caches) { + , texture(caches) + , type(layerType) { mesh = NULL; meshElementCount = 0; cacheable = true; dirty = false; - textureLayer = false; renderTarget = GL_TEXTURE_2D; texture.width = layerWidth; texture.height = layerHeight; @@ -55,11 +55,17 @@ Layer::Layer(RenderState& renderState, const uint32_t layerWidth, const uint32_t caches.resourceCache.incrementRefcount(this); rendererLightPosDirty = true; wasBuildLayered = false; - renderState.registerLayer(this); + if (!isTextureLayer()) { + // track only non-texture layer lifecycles in renderstate, + // because texture layers are destroyed via finalizer + renderState.registerLayer(this); + } } Layer::~Layer() { - renderState.unregisterLayer(this); + if (!isTextureLayer()) { + renderState.unregisterLayer(this); + } SkSafeUnref(colorFilter); removeFbo(); deleteTexture(); |