summaryrefslogtreecommitdiff
path: root/libs/hwui/RenderNode.cpp
diff options
context:
space:
mode:
authorDoris Liu <tianliu@google.com>2016-05-17 16:50:31 -0700
committerDoris Liu <tianliu@google.com>2016-06-09 10:27:59 -0700
commit718cd3eb70703c43f29ca37907bbf0e153d8cca0 (patch)
treecf1d4ce2d7c0a2ca19289257d3a8538ecfbaf8cb /libs/hwui/RenderNode.cpp
parenta2da20d3344010b8f3ca6cc5fea265984662959c (diff)
Handle hidden RT VectorDrawable animators
This CL changes the target of VD specific animators to VectorDrawable, instead of RenderNode. The benefit of doing so is that animators can now detect whether the animation is meaningful by checking whether their VD target is in the display list. If not, that means the VD is not drawing for the current frame, in which case we can be smarter and more power efficient by removing the animator from the list and posting a delayed onFinished listener callback. By setting VD as the animation target, when an ImageView decides to update its drawable from one AVD to something else, we'll be able to detect that the previous AVD is no longer in the display list, and stop providing animation pulse to the stale AVD, which is something we couldn't do previously. This change also handles the case where one AVD instance could be drawn in two different views. Bug: 27441375 Change-Id: Iaad1ed09cfd526276b95db0dd695275c28e074e8
Diffstat (limited to 'libs/hwui/RenderNode.cpp')
-rw-r--r--libs/hwui/RenderNode.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp
index 6e848fddf48f..0f6c43e9a2c6 100644
--- a/libs/hwui/RenderNode.cpp
+++ b/libs/hwui/RenderNode.cpp
@@ -419,6 +419,14 @@ void RenderNode::prepareTreeImpl(TreeInfo& info, bool functorsNeedLayer) {
prepareSubTree(info, childFunctorsNeedLayer, mDisplayList);
pushLayerUpdate(info);
+ for (auto& vectorDrawable : mDisplayList->getVectorDrawables()) {
+ // If any vector drawable in the display list needs update, damage the node.
+ if (vectorDrawable->isDirty()) {
+ damageSelf(info);
+ }
+ vectorDrawable->setPropertyChangeWillBeConsumed(true);
+ }
+
info.damageAccumulator->popTransform();
}
@@ -477,8 +485,8 @@ void RenderNode::syncDisplayList(TreeObserver* observer) {
for (auto& iter : mDisplayList->getFunctors()) {
(*iter.functor)(DrawGlInfo::kModeSync, nullptr);
}
- for (size_t i = 0; i < mDisplayList->getPushStagingFunctors().size(); i++) {
- (*mDisplayList->getPushStagingFunctors()[i])();
+ for (auto& vectorDrawable : mDisplayList->getVectorDrawables()) {
+ vectorDrawable->syncProperties();
}
}
}