From 63eb6e495a9f199c6fe7cf072272aa987836fa96 Mon Sep 17 00:00:00 2001 From: Leon Scroggins III Date: Mon, 20 May 2019 15:54:15 -0400 Subject: [PATCH] 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 --- graphics/java/android/graphics/Outline.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/graphics/java/android/graphics/Outline.java b/graphics/java/android/graphics/Outline.java index 98c990a71601f..1fc056c3652f2 100644 --- a/graphics/java/android/graphics/Outline.java +++ b/graphics/java/android/graphics/Outline.java @@ -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(); }