Allow non-convex paths in Outline#setConvexPath

Bug: 131759669
Test: I5eca77e1a60e484e4e118b7e464a88363c539ca9
Test: Manual - assert no longer fires and app looks normal

The limitation to only support convex paths was due to a limitation
in the old renderer. Today, it is fine to use a concave path. Further,
Skia has changed how it computes complexity - it is more conservative,
so paths which were previously thought to be convex are no longer. We
cannot guarantee that a path will be considered convex (especially
after e.g. rotating it, as in the library in question), so drop the
requirement.

Change-Id: Ice88d0995750e066320cb175a87f8ae70ce3aeed
This commit is contained in:
Leon Scroggins III
2019-05-20 15:54:15 -04:00
parent fa7a24ef8e
commit 63eb6e495a

View File

@@ -273,8 +273,12 @@ public final class Outline {
}
/**
* Sets the Constructs an Outline from a
* Sets the Outline to a
* {@link android.graphics.Path#isConvex() convex path}.
*
* @param convexPath used to construct the Outline. As of
* {@link android.os.Build.VERSION_CODES#Q}, it is no longer required to be
* convex.
*/
public void setConvexPath(@NonNull Path convexPath) {
if (convexPath.isEmpty()) {
@@ -282,10 +286,6 @@ public final class Outline {
return;
}
if (!convexPath.isConvex()) {
throw new IllegalArgumentException("path must be convex");
}
if (mPath == null) {
mPath = new Path();
}