diff options
author | Chris Craik <ccraik@google.com> | 2014-09-04 21:06:09 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-09-04 21:06:10 +0000 |
commit | 2d3f9033f8803d471720be60228d9894dd385488 (patch) | |
tree | ae2fe0eef1725e9cabaae6f0915d03f3fa016b65 /libs | |
parent | e7baf5afc07127854e5791d93f05e6b46633bc47 (diff) | |
parent | e83cbd451868a734bfac07ccd680d5617080b579 (diff) | |
download | frameworks_base-2d3f9033f8803d471720be60228d9894dd385488.zip frameworks_base-2d3f9033f8803d471720be60228d9894dd385488.tar.gz frameworks_base-2d3f9033f8803d471720be60228d9894dd385488.tar.bz2 |
Merge "Prioritize reveal clipping over Outline clipping" into lmp-dev
Diffstat (limited to 'libs')
-rw-r--r-- | libs/hwui/RenderNode.cpp | 3 | ||||
-rw-r--r-- | libs/hwui/Snapshot.cpp | 10 | ||||
-rw-r--r-- | libs/hwui/Snapshot.h | 6 | ||||
-rw-r--r-- | libs/hwui/StatefulBaseRenderer.cpp | 6 | ||||
-rw-r--r-- | libs/hwui/StatefulBaseRenderer.h | 2 |
5 files changed, 19 insertions, 8 deletions
diff --git a/libs/hwui/RenderNode.cpp b/libs/hwui/RenderNode.cpp index 6a92a6e..8fb1f64 100644 --- a/libs/hwui/RenderNode.cpp +++ b/libs/hwui/RenderNode.cpp @@ -413,7 +413,7 @@ void RenderNode::setViewProperties(OpenGLRenderer& renderer, T& handler) { handler(op, PROPERTY_SAVECOUNT, properties().getClipToBounds()); } - // TODO: support both reveal clip and outline clip simultaneously + // TODO: support nesting round rect clips if (mProperties.getRevealClip().willClip()) { Rect bounds; mProperties.getRevealClip().getBounds(&bounds); @@ -421,7 +421,6 @@ void RenderNode::setViewProperties(OpenGLRenderer& renderer, T& handler) { } else if (mProperties.getOutline().willClip()) { renderer.setClippingOutline(handler.allocator(), &(mProperties.getOutline())); } - } /** diff --git a/libs/hwui/Snapshot.cpp b/libs/hwui/Snapshot.cpp index ecc47d2..cf8229f 100644 --- a/libs/hwui/Snapshot.cpp +++ b/libs/hwui/Snapshot.cpp @@ -216,14 +216,22 @@ void Snapshot::resetTransform(float x, float y, float z) { // Clipping round rect /////////////////////////////////////////////////////////////////////////////// -void Snapshot::setClippingRoundRect(LinearAllocator& allocator, const Rect& bounds, float radius) { +void Snapshot::setClippingRoundRect(LinearAllocator& allocator, const Rect& bounds, + float radius, bool highPriority) { if (bounds.isEmpty()) { clipRect->setEmpty(); return; } + if (roundRectClipState && roundRectClipState->highPriority) { + // ignore, don't replace, already have a high priority clip + return; + } + RoundRectClipState* state = new (allocator) RoundRectClipState; + state->highPriority = highPriority; + // store the inverse drawing matrix Matrix4 roundRectDrawingMatrix; roundRectDrawingMatrix.load(getOrthoMatrix()); diff --git a/libs/hwui/Snapshot.h b/libs/hwui/Snapshot.h index ad4ee9d..549de9b 100644 --- a/libs/hwui/Snapshot.h +++ b/libs/hwui/Snapshot.h @@ -55,6 +55,7 @@ public: || rect.intersects(dangerRects[3]); } + bool highPriority; Matrix4 matrix; Rect dangerRects[4]; Rect innerRect; @@ -166,8 +167,11 @@ public: /** * Sets (and replaces) the current clipping outline + * + * If the current round rect clip is high priority, the incoming clip is ignored. */ - void setClippingRoundRect(LinearAllocator& allocator, const Rect& bounds, float radius); + void setClippingRoundRect(LinearAllocator& allocator, const Rect& bounds, + float radius, bool highPriority); /** * Indicates whether this snapshot should be ignored. A snapshot diff --git a/libs/hwui/StatefulBaseRenderer.cpp b/libs/hwui/StatefulBaseRenderer.cpp index 3e1aed3..12b8c8d 100644 --- a/libs/hwui/StatefulBaseRenderer.cpp +++ b/libs/hwui/StatefulBaseRenderer.cpp @@ -198,13 +198,13 @@ void StatefulBaseRenderer::setClippingOutline(LinearAllocator& allocator, const clipRect(bounds.left, bounds.top, bounds.right, bounds.bottom, SkRegion::kIntersect_Op); } if (outlineIsRounded) { - setClippingRoundRect(allocator, bounds, radius); + setClippingRoundRect(allocator, bounds, radius, false); } } void StatefulBaseRenderer::setClippingRoundRect(LinearAllocator& allocator, - const Rect& rect, float radius) { - mSnapshot->setClippingRoundRect(allocator, rect, radius); + const Rect& rect, float radius, bool highPriority) { + mSnapshot->setClippingRoundRect(allocator, rect, radius, highPriority); } diff --git a/libs/hwui/StatefulBaseRenderer.h b/libs/hwui/StatefulBaseRenderer.h index c6974b4..745e48a 100644 --- a/libs/hwui/StatefulBaseRenderer.h +++ b/libs/hwui/StatefulBaseRenderer.h @@ -97,7 +97,7 @@ public: */ void setClippingOutline(LinearAllocator& allocator, const Outline* outline); void setClippingRoundRect(LinearAllocator& allocator, - const Rect& rect, float radius); + const Rect& rect, float radius, bool highPriority = true); inline const mat4* currentTransform() const { return mSnapshot->transform; |