diff options
author | Chris Craik <ccraik@google.com> | 2015-06-08 16:49:43 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2015-06-12 13:34:58 -0700 |
commit | a766cb2bce5db9108c0266fbebea6aa18d5713ff (patch) | |
tree | 2718003d7dc16d0a5f94aeda1acf40c5eaae8fad /libs/hwui/RenderNode.cpp | |
parent | 4e9d9b2a590105035c29f12ecf0689333e6b55e7 (diff) | |
download | frameworks_base-a766cb2bce5db9108c0266fbebea6aa18d5713ff.zip frameworks_base-a766cb2bce5db9108c0266fbebea6aa18d5713ff.tar.gz frameworks_base-a766cb2bce5db9108c0266fbebea6aa18d5713ff.tar.bz2 |
Put WebViews with on a HW layer if stencil/shader clipping is needed
bug:17322378
Change-Id: I0de574bf116b30e2ad4194366e19d47d49708902
Diffstat (limited to 'libs/hwui/RenderNode.cpp')
-rw-r--r-- | libs/hwui/RenderNode.cpp | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index 75e700a..b4cbc36 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -120,7 +120,10 @@ void RenderNode::prepareTree(TreeInfo& info) { ATRACE_CALL(); LOG_ALWAYS_FATAL_IF(!info.damageAccumulator, "DamageAccumulator missing"); - prepareTreeImpl(info); + // Functors don't correctly handle stencil usage of overdraw debugging - shove 'em in a layer. + bool functorsNeedLayer = Properties::debugOverdraw; + + prepareTreeImpl(info, functorsNeedLayer); } void RenderNode::addAnimator(const sp<BaseRenderNodeAnimator>& animator) { @@ -219,7 +222,15 @@ void RenderNode::pushLayerUpdate(TreeInfo& info) { } } -void RenderNode::prepareTreeImpl(TreeInfo& info) { +/** + * Traverse down the the draw tree to prepare for a frame. + * + * MODE_FULL = UI Thread-driven (thus properties must be synced), otherwise RT driven + * + * While traversing down the tree, functorsNeedLayer flag is set to true if anything that uses the + * stencil buffer may be needed. Views that use a functor to draw will be forced onto a layer. + */ +void RenderNode::prepareTreeImpl(TreeInfo& info, bool functorsNeedLayer) { info.damageAccumulator->pushTransform(this); if (info.mode == TreeInfo::MODE_FULL) { @@ -229,11 +240,17 @@ void RenderNode::prepareTreeImpl(TreeInfo& info) { if (CC_LIKELY(info.runAnimations)) { animatorDirtyMask = mAnimatorManager.animate(info); } + + bool willHaveFunctor = info.mode == TreeInfo::MODE_FULL && mStagingDisplayListData + ? !mStagingDisplayListData->functors.isEmpty() : !mDisplayListData->functors.isEmpty(); + bool childFunctorsNeedLayer = mProperties.prepareForFunctorPresence( + willHaveFunctor, functorsNeedLayer); + prepareLayer(info, animatorDirtyMask); if (info.mode == TreeInfo::MODE_FULL) { pushStagingDisplayListChanges(info); } - prepareSubTree(info, mDisplayListData); + prepareSubTree(info, childFunctorsNeedLayer, mDisplayListData); pushLayerUpdate(info); info.damageAccumulator->popTransform(); @@ -313,7 +330,7 @@ void RenderNode::deleteDisplayListData() { mDisplayListData = nullptr; } -void RenderNode::prepareSubTree(TreeInfo& info, DisplayListData* subtree) { +void RenderNode::prepareSubTree(TreeInfo& info, bool functorsNeedLayer, DisplayListData* subtree) { if (subtree) { TextureCache& cache = Caches::getInstance().textureCache; info.out.hasFunctors |= subtree->functors.size(); @@ -324,7 +341,10 @@ void RenderNode::prepareSubTree(TreeInfo& info, DisplayListData* subtree) { DrawRenderNodeOp* op = subtree->children()[i]; RenderNode* childNode = op->mRenderNode; info.damageAccumulator->pushTransform(&op->mTransformFromParent); - childNode->prepareTreeImpl(info); + bool childFunctorsNeedLayer = functorsNeedLayer + // Recorded with non-rect clip, or canvas-rotated by parent + || op->mRecordedWithPotentialStencilClip; + childNode->prepareTreeImpl(info, childFunctorsNeedLayer); info.damageAccumulator->popTransform(); } } |