diff options
author | John Reck <jreck@google.com> | 2019-03-07 17:01:08 -0800 |
---|---|---|
committer | John Reck <jreck@google.com> | 2019-03-07 17:03:48 -0800 |
commit | f1aa7909e6496da4a1ae9ccfcbab5db843d329c3 (patch) | |
tree | 95a611c7a0055078596c206835d426db22a4f5ee /libs/hwui/RenderNode.cpp | |
parent | 4348a4d7078dd4a2d786464db170f817ee19f6b1 (diff) |
Fix damage tracking for RenderNode drawn twice
Bug: 127866048
Test: CustomRenderer demo
Change-Id: I431a7284b1d0a026e06500a78f41830a268235a5
Diffstat (limited to 'libs/hwui/RenderNode.cpp')
-rw-r--r-- | libs/hwui/RenderNode.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index 1ff7ffe6bf87..e0ed3e4940a8 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -134,6 +134,7 @@ void RenderNode::removeAnimator(const sp<BaseRenderNodeAnimator>& animator) { void RenderNode::damageSelf(TreeInfo& info) { if (isRenderable()) { + mDamageGenerationId = info.damageGenerationId; if (properties().getClipDamageToBounds()) { info.damageAccumulator->dirty(0, 0, properties().getWidth(), properties().getHeight()); } else { @@ -199,6 +200,12 @@ void RenderNode::pushLayerUpdate(TreeInfo& info) { * stencil buffer may be needed. Views that use a functor to draw will be forced onto a layer. */ void RenderNode::prepareTreeImpl(TreeObserver& observer, TreeInfo& info, bool functorsNeedLayer) { + if (mDamageGenerationId == info.damageGenerationId) { + // We hit the same node a second time in the same tree. We don't know the minimal + // damage rect anymore, so just push the biggest we can onto our parent's transform + // We push directly onto parent in case we are clipped to bounds but have moved position. + info.damageAccumulator->dirty(DIRTY_MIN, DIRTY_MIN, DIRTY_MAX, DIRTY_MAX); + } info.damageAccumulator->pushTransform(this); if (info.mode == TreeInfo::MODE_FULL) { |