summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Reck <jreck@google.com>2014-08-21 20:26:17 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-08-21 20:26:18 +0000
commit7d3734491516fdda47059f2a36c1de9fa39dd8a9 (patch)
tree62083fddcb4ee769330279b88ccd91b676d0dc4c
parent2b5d920e800d89b695f01bfe704d12f6d53902ec (diff)
parent9eb9f6f8cbbbd87d45da8071aa54cb066a797723 (diff)
downloadframeworks_base-7d3734491516fdda47059f2a36c1de9fa39dd8a9.zip
frameworks_base-7d3734491516fdda47059f2a36c1de9fa39dd8a9.tar.gz
frameworks_base-7d3734491516fdda47059f2a36c1de9fa39dd8a9.tar.bz2
Merge "Don't run animators in buildLayer" into lmp-dev
-rw-r--r--libs/hwui/RenderNode.cpp9
-rw-r--r--libs/hwui/TreeInfo.h8
-rw-r--r--libs/hwui/renderthread/CanvasContext.cpp1
3 files changed, 16 insertions, 2 deletions
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index dca7520..977744f 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -215,7 +215,10 @@ void RenderNode::prepareTreeImpl(TreeInfo& info) {
if (info.mode == TreeInfo::MODE_FULL) {
pushStagingPropertiesChanges(info);
}
- uint32_t animatorDirtyMask = mAnimatorManager.animate(info);
+ uint32_t animatorDirtyMask = 0;
+ if (CC_LIKELY(info.runAnimations)) {
+ animatorDirtyMask = mAnimatorManager.animate(info);
+ }
prepareLayer(info, animatorDirtyMask);
if (info.mode == TreeInfo::MODE_FULL) {
pushStagingDisplayListChanges(info);
@@ -230,7 +233,9 @@ void RenderNode::pushStagingPropertiesChanges(TreeInfo& info) {
// Push the animators first so that setupStartValueIfNecessary() is called
// before properties() is trampled by stagingProperties(), as they are
// required by some animators.
- mAnimatorManager.pushStaging(info);
+ if (CC_LIKELY(info.runAnimations)) {
+ mAnimatorManager.pushStaging(info);
+ }
if (mDirtyPropertyFields) {
mDirtyPropertyFields = 0;
damageSelf(info);
diff --git a/libs/hwui/TreeInfo.h b/libs/hwui/TreeInfo.h
index 331f157..74d52a3 100644
--- a/libs/hwui/TreeInfo.h
+++ b/libs/hwui/TreeInfo.h
@@ -65,6 +65,7 @@ public:
, frameTimeMs(0)
, animationHook(NULL)
, prepareTextures(mode == MODE_FULL)
+ , runAnimations(true)
, damageAccumulator(NULL)
, renderState(renderState)
, renderer(NULL)
@@ -76,6 +77,7 @@ public:
, frameTimeMs(clone.frameTimeMs)
, animationHook(clone.animationHook)
, prepareTextures(mode == MODE_FULL)
+ , runAnimations(clone.runAnimations)
, damageAccumulator(clone.damageAccumulator)
, renderState(clone.renderState)
, renderer(clone.renderer)
@@ -88,6 +90,12 @@ public:
// TODO: Remove this? Currently this is used to signal to stop preparing
// textures if we run out of cache space.
bool prepareTextures;
+ // TODO: buildLayer uses this to suppress running any animations, but this
+ // should probably be refactored somehow. The reason this is done is
+ // because buildLayer is not setup for injecting the animationHook, as well
+ // as this being otherwise wasted work as all the animators will be
+ // re-evaluated when the frame is actually drawn
+ bool runAnimations;
// Must not be null during actual usage
DamageAccumulator* damageAccumulator;
diff --git a/libs/hwui/renderthread/CanvasContext.cpp b/libs/hwui/renderthread/CanvasContext.cpp
index 5922135..4bf5a8a 100644
--- a/libs/hwui/renderthread/CanvasContext.cpp
+++ b/libs/hwui/renderthread/CanvasContext.cpp
@@ -257,6 +257,7 @@ void CanvasContext::buildLayer(RenderNode* node) {
info.frameTimeMs = mRenderThread.timeLord().frameTimeMs();
info.damageAccumulator = &mDamageAccumulator;
info.renderer = mCanvas;
+ info.runAnimations = false;
node->prepareTree(info);
SkRect ignore;
mDamageAccumulator.finish(&ignore);