diff options
author | Chris Craik <ccraik@google.com> | 2013-06-17 13:52:06 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2013-06-17 13:52:06 -0700 |
commit | d72b73cea49f29c41661e55eb6bfdbc04f09d809 (patch) | |
tree | e6782e49ac767cd62e22ca8e44f18eb3977bb1e6 /libs/hwui | |
parent | 4aaf8b3d4b160aea5ceb5ccf799e44c1d5a3f14b (diff) | |
download | frameworks_base-d72b73cea49f29c41661e55eb6bfdbc04f09d809.zip frameworks_base-d72b73cea49f29c41661e55eb6bfdbc04f09d809.tar.gz frameworks_base-d72b73cea49f29c41661e55eb6bfdbc04f09d809.tar.bz2 |
Better handle op size edge cases
bug:9464358
Previously, empty and unknown sized ops are assumed to fully cover
their clip. This is now corrected such that empty sized ops are
pre-rejected before defer. Additionally, unknown sized ops disable
overdraw avoidance.
Change-Id: Icf2ce24f98be5ea6299e24ffcf826790373564a1
Diffstat (limited to 'libs/hwui')
-rw-r--r-- | libs/hwui/DeferredDisplayList.cpp | 1 | ||||
-rw-r--r-- | libs/hwui/DisplayListOp.h | 5 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 6 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.h | 3 |
4 files changed, 10 insertions, 5 deletions
diff --git a/libs/hwui/DeferredDisplayList.cpp b/libs/hwui/DeferredDisplayList.cpp index f19d610..b3d2aec 100644 --- a/libs/hwui/DeferredDisplayList.cpp +++ b/libs/hwui/DeferredDisplayList.cpp @@ -470,6 +470,7 @@ void DeferredDisplayList::addDrawOp(OpenGLRenderer& renderer, DrawOp* op) { deferInfo.mergeable &= !recordingComplexClip(); if (CC_LIKELY(mAvoidOverdraw) && mBatches.size() && + op->state.mClipSideFlags != kClipSide_ConservativeFull && deferInfo.opaqueOverBounds && op->state.mBounds.contains(mBounds)) { // avoid overdraw by resetting drawing state + discarding drawing ops discardDrawingBatches(mBatches.size() - 1); diff --git a/libs/hwui/DisplayListOp.h b/libs/hwui/DisplayListOp.h index 290e4fa..6b7bac0 100644 --- a/libs/hwui/DisplayListOp.h +++ b/libs/hwui/DisplayListOp.h @@ -129,7 +129,10 @@ public: return; } - if (!getLocalBounds(state.mBounds)) { + if (getLocalBounds(state.mBounds)) { + // valid empty bounds, don't bother deferring + if (state.mBounds.isEmpty()) return; + } else { // empty bounds signify bounds can't be calculated state.mBounds.setEmpty(); } diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index 05f43a9..ed6498f 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -1395,9 +1395,9 @@ bool OpenGLRenderer::storeDisplayState(DeferredDisplayState& state, int stateDef } state.mBounds.set(clippedBounds); } else { - // If we don't have bounds, let's assume we're clipped - // to prevent merging - state.mClipSideFlags = kClipSide_Full; + // Empty bounds implies size unknown. Label op as conservatively clipped to disable + // overdraw avoidance (since we don't know what it overlaps) + state.mClipSideFlags = kClipSide_ConservativeFull; state.mBounds.set(currentClip); } } diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h index 5b7f90d..ab15879 100644 --- a/libs/hwui/OpenGLRenderer.h +++ b/libs/hwui/OpenGLRenderer.h @@ -86,7 +86,8 @@ enum ClipSideFlags { kClipSide_Top = 0x2, kClipSide_Right = 0x4, kClipSide_Bottom = 0x8, - kClipSide_Full = 0xF + kClipSide_Full = 0xF, + kClipSide_ConservativeFull = 0x1F }; struct DeferredDisplayState { |