diff options
author | Chris Craik <ccraik@google.com> | 2014-07-29 12:50:14 -0700 |
---|---|---|
committer | Chris Craik <ccraik@google.com> | 2014-07-30 17:15:50 +0000 |
commit | af4d04cab6d48ae0d6a5e79bd30f679af87abaad (patch) | |
tree | b1fe9d83f5ccc32b1e0db8f002d2d3035368dfac /libs/hwui/Snapshot.cpp | |
parent | 3d1856f4449f02a9a3bda06738c3eb83df96f88b (diff) | |
download | frameworks_base-af4d04cab6d48ae0d6a5e79bd30f679af87abaad.zip frameworks_base-af4d04cab6d48ae0d6a5e79bd30f679af87abaad.tar.gz frameworks_base-af4d04cab6d48ae0d6a5e79bd30f679af87abaad.tar.bz2 |
Use RoundRect clipping for circle reveal animation
bug:16630975
Also, remove inverse clipping feature from reveal animator.
Change-Id: I770a4eb48cd123b0ca0f39d16a0f3eefd1be3653
Diffstat (limited to 'libs/hwui/Snapshot.cpp')
-rw-r--r-- | libs/hwui/Snapshot.cpp | 29 |
1 files changed, 13 insertions, 16 deletions
diff --git a/libs/hwui/Snapshot.cpp b/libs/hwui/Snapshot.cpp index 80f7eca..6f19275 100644 --- a/libs/hwui/Snapshot.cpp +++ b/libs/hwui/Snapshot.cpp @@ -20,8 +20,6 @@ #include <SkCanvas.h> -#include "utils/MathUtils.h" - namespace android { namespace uirenderer { @@ -207,23 +205,22 @@ void Snapshot::resetTransform(float x, float y, float z) { } /////////////////////////////////////////////////////////////////////////////// -// Clipping outline +// Clipping round rect /////////////////////////////////////////////////////////////////////////////// -void Snapshot::setClippingOutline(LinearAllocator& allocator, const Outline* outline) { - Rect bounds; - float radius; - if (!outline->getAsRoundRect(&bounds, &radius)) return; // only RR supported - - if (!MathUtils::isPositive(radius)) return; // leave clipping up to rect clipping +void Snapshot::setClippingRoundRect(LinearAllocator& allocator, const Rect& bounds, float radius) { + if (bounds.isEmpty()) { + clipRect->setEmpty(); + return; + } RoundRectClipState* state = new (allocator) RoundRectClipState; // store the inverse drawing matrix - Matrix4 outlineDrawingMatrix; - outlineDrawingMatrix.load(getOrthoMatrix()); - outlineDrawingMatrix.multiply(*transform); - state->matrix.loadInverse(outlineDrawingMatrix); + Matrix4 roundRectDrawingMatrix; + roundRectDrawingMatrix.load(getOrthoMatrix()); + roundRectDrawingMatrix.multiply(*transform); + state->matrix.loadInverse(roundRectDrawingMatrix); // compute area under rounded corners - only draws overlapping these rects need to be clipped for (int i = 0 ; i < 4; i++) { @@ -241,9 +238,9 @@ void Snapshot::setClippingOutline(LinearAllocator& allocator, const Outline* out } // store RR area - bounds.inset(radius); - state->outlineInnerRect = bounds; - state->outlineRadius = radius; + state->innerRect = bounds; + state->innerRect.inset(radius); + state->radius = radius; // store as immutable so, for this frame, pointer uniquely identifies this bundle of shader info roundRectClipState = state; |