Adds specifying comments and bugtrack to RoundedPolygon and PolygonValidation
Relnote: Specifies comments and bugtrack to RoundedPolygon and PolygonValidation
Test: None, not needed
Change-Id: Ie0e096347b05de78b99b3c328a4b5bc05d79931f
diff --git a/graphics/graphics-shapes/src/commonMain/kotlin/androidx/graphics/shapes/Features.kt b/graphics/graphics-shapes/src/commonMain/kotlin/androidx/graphics/shapes/Features.kt
index ac51e30..501e598 100644
--- a/graphics/graphics-shapes/src/commonMain/kotlin/androidx/graphics/shapes/Features.kt
+++ b/graphics/graphics-shapes/src/commonMain/kotlin/androidx/graphics/shapes/Features.kt
@@ -91,6 +91,8 @@
reversedCubics.add(cubics[i].reverse())
}
+ // TODO: b/369320447 - Revert flag negation when [RoundedPolygon] ignores orientation
+ // for setting the flag
return Corner(reversedCubics, vertex, roundedCenter, !convex)
}
diff --git a/graphics/graphics-shapes/src/commonMain/kotlin/androidx/graphics/shapes/PolygonValidation.kt b/graphics/graphics-shapes/src/commonMain/kotlin/androidx/graphics/shapes/PolygonValidation.kt
index e716f34..607a0b1 100644
--- a/graphics/graphics-shapes/src/commonMain/kotlin/androidx/graphics/shapes/PolygonValidation.kt
+++ b/graphics/graphics-shapes/src/commonMain/kotlin/androidx/graphics/shapes/PolygonValidation.kt
@@ -16,7 +16,8 @@
package androidx.graphics.shapes
-// @TODO: Make class public as soon as all validations are implemented
+// @TODO: Make class public as soon as all validations are implemented and mention in
+// [RoundedPolygon] constructor
/**
* Utility class to fix invalid [RoundedPolygon]s that will otherwise break [Morph]s in one way or
@@ -66,11 +67,13 @@
}
private fun fixCWOrientation(polygon: RoundedPolygon): RoundedPolygon {
- // Persist first feature to stay a Corner
- val reversedFeatures = mutableListOf(polygon.features.first().reversed())
+ val reversedFeatures = buildList {
+ // Persist first feature to stay a Corner
+ add(polygon.features.first().reversed())
- for (i in polygon.features.lastIndex downTo 1) {
- reversedFeatures.add(polygon.features[i].reversed())
+ for (i in polygon.features.lastIndex downTo 1) {
+ add(polygon.features[i].reversed())
+ }
}
return RoundedPolygon(reversedFeatures, polygon.centerX, polygon.centerY)