summaryrefslogtreecommitdiffstats
path: root/libs/hwui/Layer.cpp
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2014-10-31 23:00:44 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2014-10-31 23:00:44 +0000
commita51fba0bf037844bcb911e69e8af733e6d2cccf6 (patch)
tree1b6027c164bfebbb15618ae82233833a4c807397 /libs/hwui/Layer.cpp
parent18163616c80aa30f4b7389838d8658812615080c (diff)
parenta8d83d639a5687b2ab5689db4ea61e2a6cce66f4 (diff)
downloadframeworks_base-a51fba0bf037844bcb911e69e8af733e6d2cccf6.zip
frameworks_base-a51fba0bf037844bcb911e69e8af733e6d2cccf6.tar.gz
frameworks_base-a51fba0bf037844bcb911e69e8af733e6d2cccf6.tar.bz2
am a8d83d63: Merge "Layer changes" into lmp-mr1-dev
* commit 'a8d83d639a5687b2ab5689db4ea61e2a6cce66f4': Layer changes
Diffstat (limited to 'libs/hwui/Layer.cpp')
-rw-r--r--libs/hwui/Layer.cpp19
1 files changed, 10 insertions, 9 deletions
diff --git a/libs/hwui/Layer.cpp b/libs/hwui/Layer.cpp
index b5089aa..b95636b 100644
--- a/libs/hwui/Layer.cpp
+++ b/libs/hwui/Layer.cpp
@@ -35,6 +35,9 @@ Layer::Layer(Type layerType, RenderState& renderState, const uint32_t layerWidth
, renderState(renderState)
, texture(caches)
, type(layerType) {
+ // TODO: This is a violation of Android's typical ref counting, but it
+ // preserves the old inc/dec ref locations. This should be changed...
+ incStrong(0);
mesh = NULL;
meshElementCount = 0;
cacheable = true;
@@ -53,20 +56,14 @@ Layer::Layer(Type layerType, RenderState& renderState, const uint32_t layerWidth
forceFilter = false;
deferredList = NULL;
convexMask = NULL;
- caches.resourceCache.incrementRefcount(this);
rendererLightPosDirty = true;
wasBuildLayered = false;
- if (!isTextureLayer()) {
- // track only non-texture layer lifecycles in renderstate,
- // because texture layers are destroyed via finalizer
- renderState.registerLayer(this);
- }
+ renderState.registerLayer(this);
}
Layer::~Layer() {
- if (!isTextureLayer()) {
- renderState.unregisterLayer(this);
- }
+ renderState.requireGLContext();
+ renderState.unregisterLayer(this);
SkSafeUnref(colorFilter);
removeFbo();
deleteTexture();
@@ -292,5 +289,9 @@ void Layer::render(const OpenGLRenderer& rootRenderer) {
renderNode = NULL;
}
+void Layer::postDecStrong() {
+ renderState.postDecStrong(this);
+}
+
}; // namespace uirenderer
}; // namespace android