diff options
author | Chris Craik <ccraik@google.com> | 2013-06-21 20:51:54 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2013-06-21 20:51:54 +0000 |
commit | 4f20f8ae50ecc3b6c04afd2e62716ca87620962b (patch) | |
tree | e3cb9ca5ce19b83bc351323111b9be7082fb883e /libs/hwui | |
parent | b06accf34f53956a5ccd44cecc3604cc2d166cd7 (diff) | |
parent | 0e87f00f8cb79635aa70b9a2dfa02bf19dc7473d (diff) | |
download | frameworks_base-4f20f8ae50ecc3b6c04afd2e62716ca87620962b.zip frameworks_base-4f20f8ae50ecc3b6c04afd2e62716ca87620962b.tar.gz frameworks_base-4f20f8ae50ecc3b6c04afd2e62716ca87620962b.tar.bz2 |
Merge "Initialize MergingDrawBatch clip with viewport bounds"
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. |