diff options
author | Chris Craik <ccraik@google.com> | 2013-06-19 16:54:59 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2013-06-21 13:16:31 -0700 |
commit | 0e87f00f8cb79635aa70b9a2dfa02bf19dc7473d (patch) | |
tree | f109c7a20dc65947e8d69cd274a10b512a46d940 /libs/hwui | |
parent | 2c290392c9a934f9ac48364af01c848b01ba8e80 (diff) | |
download | frameworks_base-0e87f00f8cb79635aa70b9a2dfa02bf19dc7473d.zip frameworks_base-0e87f00f8cb79635aa70b9a2dfa02bf19dc7473d.tar.gz frameworks_base-0e87f00f8cb79635aa70b9a2dfa02bf19dc7473d.tar.bz2 |
Initialize MergingDrawBatch clip with viewport bounds
This allows merged, clipped operations to behave correctly within a
savelayer, even if the base viewport has a large offset.
Additionally, disregard opaqueness when within a
complexclip/savelayer, as the coverage can't be trusted.
Change-Id: Ic908b82a4bb410bc7fac1b4295f4874ed166efc5
Diffstat (limited to 'libs/hwui')
-rw-r--r-- | libs/hwui/DeferredDisplayList.cpp | 9 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.cpp | 1 | ||||
-rw-r--r-- | libs/hwui/OpenGLRenderer.h | 3 |
3 files changed, 10 insertions, 3 deletions
diff --git a/libs/hwui/DeferredDisplayList.cpp b/libs/hwui/DeferredDisplayList.cpp index 887e822..7ce15c5 100644 --- a/libs/hwui/DeferredDisplayList.cpp +++ b/libs/hwui/DeferredDisplayList.cpp @@ -152,8 +152,9 @@ private: class MergingDrawBatch : public DrawBatch { public: - MergingDrawBatch(DeferInfo& deferInfo, Rect viewport) : - DrawBatch(deferInfo), mClipRect(viewport), mClipSideFlags(kClipSide_None) {} + MergingDrawBatch(DeferInfo& deferInfo, int width, int height) : + DrawBatch(deferInfo), mClipRect(width, height), + mClipSideFlags(kClipSide_None) {} /* * Helper for determining if a new op can merge with a MergingDrawBatch based on their bounds @@ -489,6 +490,7 @@ void DeferredDisplayList::addDrawOp(OpenGLRenderer& renderer, DrawOp* op) { // complex clip has a complex set of expectations on the renderer state - for now, avoid taking // the merge path in those cases deferInfo.mergeable &= !recordingComplexClip(); + deferInfo.opaqueOverBounds &= !recordingComplexClip() && mSaveStack.isEmpty(); if (CC_LIKELY(mAvoidOverdraw) && mBatches.size() && op->state.mClipSideFlags != kClipSide_ConservativeFull && @@ -570,7 +572,8 @@ void DeferredDisplayList::addDrawOp(OpenGLRenderer& renderer, DrawOp* op) { if (!targetBatch) { if (deferInfo.mergeable) { - targetBatch = new MergingDrawBatch(deferInfo, mBounds); + targetBatch = new MergingDrawBatch(deferInfo, + renderer.getViewportWidth(), renderer.getViewportHeight()); mMergingBatches[deferInfo.batchId].put(deferInfo.mergeId, targetBatch); } else { targetBatch = new DrawBatch(deferInfo); diff --git a/libs/hwui/OpenGLRenderer.cpp b/libs/hwui/OpenGLRenderer.cpp index d6d7b7f..6f1dc6f 100644 --- a/libs/hwui/OpenGLRenderer.cpp +++ b/libs/hwui/OpenGLRenderer.cpp @@ -827,6 +827,7 @@ int OpenGLRenderer::saveLayerDeferred(float left, float top, float right, float if (!mSnapshot->isIgnored()) { mSnapshot->resetTransform(-bounds.left, -bounds.top, 0.0f); mSnapshot->resetClip(clip.left, clip.top, clip.right, clip.bottom); + mSnapshot->viewport.set(0.0f, 0.0f, bounds.getWidth(), bounds.getHeight()); } } diff --git a/libs/hwui/OpenGLRenderer.h b/libs/hwui/OpenGLRenderer.h index 548501d..aa0f9fc 100644 --- a/libs/hwui/OpenGLRenderer.h +++ b/libs/hwui/OpenGLRenderer.h @@ -360,6 +360,9 @@ public: return mSnapshot->clipRegion->isEmpty(); } + int getViewportWidth() { return getSnapshot()->viewport.getWidth(); } + int getViewportHeight() { return getSnapshot()->viewport.getHeight(); } + /** * Scales the alpha on the current snapshot. This alpha value will be modulated * with other alpha values when drawing primitives. |