Use RoundRect clipping for circle reveal animation
bug:16630975
Also, remove inverse clipping feature from reveal animator.
Change-Id: I770a4eb48cd123b0ca0f39d16a0f3eefd1be3653
diff --git a/libs/hwui/StatefulBaseRenderer.cpp b/libs/hwui/StatefulBaseRenderer.cpp
index 473005c..dc41157 100644
--- a/libs/hwui/StatefulBaseRenderer.cpp
+++ b/libs/hwui/StatefulBaseRenderer.cpp
@@ -20,6 +20,8 @@
#include "StatefulBaseRenderer.h"
+#include "utils/MathUtils.h"
+
namespace android {
namespace uirenderer {
@@ -189,9 +191,24 @@
}
void StatefulBaseRenderer::setClippingOutline(LinearAllocator& allocator, const Outline* outline) {
- mSnapshot->setClippingOutline(allocator, outline);
+ Rect bounds;
+ float radius;
+ if (!outline->getAsRoundRect(&bounds, &radius)) return; // only RR supported
+
+ if (!MathUtils::isPositive(radius)) {
+ // TODO: consider storing this rect separately, so that this can't be replaced with clip ops
+ clipRect(bounds.left, bounds.top, bounds.right, bounds.bottom, SkRegion::kIntersect_Op);
+ return;
+ }
+ setClippingRoundRect(allocator, bounds, radius);
}
+void StatefulBaseRenderer::setClippingRoundRect(LinearAllocator& allocator,
+ const Rect& rect, float radius) {
+ mSnapshot->setClippingRoundRect(allocator, rect, radius);
+}
+
+
///////////////////////////////////////////////////////////////////////////////
// Quick Rejection
///////////////////////////////////////////////////////////////////////////////