From 13d879bc05b98cfac2cdd13d43bdd071ac37fd01 Mon Sep 17 00:00:00 2001 From: qiubowen Date: Mon, 22 Jan 2024 19:46:22 +0800 Subject: Fix the problem that mDamageGenerationId is a random value 1. mDamageGenerationId is a random value when initialized. When this random value happens to be equal to info.damageGenerationId, the dirty range will reach the maximum DIRTY_MAX. 2. When info.damageGenerationId is equal to 0, which is when the first frame of the APP is drawn, there is no need to reach the maximum DIRTY_MAX in the dirty range. Bug: 321612817 Test: build Change-Id: Iab6a04170926d10cdf2a62ae0fbf9cbe5eeb8bbf Signed-off-by: qiubowen --- libs/hwui/RenderNode.cpp | 2 +- libs/hwui/RenderNode.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'libs/hwui') diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index 1dd22cf43c5c..a733d1772757 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -218,7 +218,7 @@ 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) { + if (mDamageGenerationId == info.damageGenerationId && mDamageGenerationId != 0) { // 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. diff --git a/libs/hwui/RenderNode.h b/libs/hwui/RenderNode.h index 572635a9bd45..4d03bf189a84 100644 --- a/libs/hwui/RenderNode.h +++ b/libs/hwui/RenderNode.h @@ -263,7 +263,7 @@ private: DisplayList mDisplayList; DisplayList mStagingDisplayList; - int64_t mDamageGenerationId; + int64_t mDamageGenerationId = 0; friend class AnimatorManager; AnimatorManager mAnimatorManager; -- cgit v1.2.3-59-g8ed1b