Fix rounded corners modifying already rounded corners
Rounded corners should noop for corners that already have control points
diff --git a/lottie/src/main/java/com/airbnb/lottie/animation/content/RoundedCornersContent.java b/lottie/src/main/java/com/airbnb/lottie/animation/content/RoundedCornersContent.java
index 06a3bb1..30db45c 100644
--- a/lottie/src/main/java/com/airbnb/lottie/animation/content/RoundedCornersContent.java
+++ b/lottie/src/main/java/com/airbnb/lottie/animation/content/RoundedCornersContent.java
@@ -161,9 +161,9 @@
// oriented point to CubicCurveData (path segments).
CubicCurveData previousCurveData = modifiedCurves.get(floorMod(modifiedCurvesIndex - 1, modifiedCurves.size()));
CubicCurveData currentCurveData = modifiedCurves.get(modifiedCurvesIndex);
- previousCurveData.setControlPoint2(previousCurve.getVertex().x, previousCurve.getVertex().y);
+ previousCurveData.setControlPoint2(previousCurve.getControlPoint2().x, previousCurve.getControlPoint2().y);
previousCurveData.setVertex(previousCurve.getVertex().x, previousCurve.getVertex().y);
- currentCurveData.setControlPoint1(startingCurve.getVertex().x, startingCurve.getVertex().y);
+ currentCurveData.setControlPoint1(startingCurve.getControlPoint1().x, startingCurve.getControlPoint1().y);
modifiedCurvesIndex++;
}
}
diff --git a/snapshot-tests/src/main/assets/Tests/RoundedWithAlreadyRoundedCorners.json b/snapshot-tests/src/main/assets/Tests/RoundedWithAlreadyRoundedCorners.json
new file mode 100644
index 0000000..46dfd07
--- /dev/null
+++ b/snapshot-tests/src/main/assets/Tests/RoundedWithAlreadyRoundedCorners.json
@@ -0,0 +1,386 @@
+{
+ "v": "5.9.1",
+ "fr": 60,
+ "ip": 0,
+ "op": 56,
+ "w": 1080,
+ "h": 1080,
+ "nm": "Warning",
+ "ddd": 0,
+ "assets": [
+ {
+ "id": "comp_0",
+ "nm": "Warning_2",
+ "fr": 60,
+ "layers": [
+ {
+ "ddd": 0,
+ "ind": 3,
+ "ty": 4,
+ "nm": "CERCHIO contorni",
+ "sr": 1,
+ "ks": {
+ "o": {
+ "a": 0,
+ "k": 100,
+ "ix": 11
+ },
+ "r": {
+ "a": 0,
+ "k": 0,
+ "ix": 10
+ },
+ "p": {
+ "a": 0,
+ "k": [
+ 24.5,
+ 24.5,
+ 0
+ ],
+ "ix": 2,
+ "l": 2
+ },
+ "a": {
+ "a": 0,
+ "k": [
+ 29.5,
+ 29.5,
+ 0
+ ],
+ "ix": 1,
+ "l": 2
+ },
+ "s": {
+ "a": 0,
+ "k": [
+ 100,
+ 100,
+ 100
+ ],
+ "ix": 6,
+ "l": 2
+ }
+ },
+ "ao": 0,
+ "shapes": [
+ {
+ "ty": "gr",
+ "it": [
+ {
+ "ind": 0,
+ "ty": "sh",
+ "ix": 1,
+ "ks": {
+ "a": 0,
+ "k": {
+ "i": [
+ [
+ -12.15,
+ 0
+ ],
+ [
+ 0,
+ -12.15
+ ],
+ [
+ 12.15,
+ 0
+ ],
+ [
+ 0,
+ 12.15
+ ]
+ ],
+ "o": [
+ [
+ 12.15,
+ 0
+ ],
+ [
+ 0,
+ 12.15
+ ],
+ [
+ -12.15,
+ 0
+ ],
+ [
+ 0,
+ -12.15
+ ]
+ ],
+ "v": [
+ [
+ 0,
+ -22
+ ],
+ [
+ 22,
+ 0
+ ],
+ [
+ 0,
+ 22
+ ],
+ [
+ -22,
+ 0
+ ]
+ ],
+ "c": true
+ },
+ "ix": 2
+ },
+ "nm": "Tracciato 1",
+ "mn": "ADBE Vector Shape - Group",
+ "hd": false
+ },
+ {
+ "ty": "st",
+ "c": {
+ "a": 0,
+ "k": [
+ 0.956862804936,
+ 0.290196078431,
+ 0.239215701234,
+ 1
+ ],
+ "ix": 3
+ },
+ "o": {
+ "a": 0,
+ "k": 100,
+ "ix": 4
+ },
+ "w": {
+ "a": 0,
+ "k": 3,
+ "ix": 5
+ },
+ "lc": 2,
+ "lj": 2,
+ "bm": 0,
+ "nm": "Traccia 1",
+ "mn": "ADBE Vector Graphic - Stroke",
+ "hd": false
+ },
+ {
+ "ty": "tr",
+ "p": {
+ "a": 0,
+ "k": [
+ 29.5,
+ 29.5
+ ],
+ "ix": 2
+ },
+ "a": {
+ "a": 0,
+ "k": [
+ 0,
+ 0
+ ],
+ "ix": 1
+ },
+ "s": {
+ "a": 0,
+ "k": [
+ 100,
+ 100
+ ],
+ "ix": 3
+ },
+ "r": {
+ "a": 0,
+ "k": 0,
+ "ix": 6
+ },
+ "o": {
+ "a": 0,
+ "k": 100,
+ "ix": 7
+ },
+ "sk": {
+ "a": 0,
+ "k": 0,
+ "ix": 4
+ },
+ "sa": {
+ "a": 0,
+ "k": 0,
+ "ix": 5
+ },
+ "nm": "Transform"
+ }
+ ],
+ "nm": "Gruppo 1",
+ "np": 2,
+ "cix": 2,
+ "bm": 0,
+ "ix": 1,
+ "mn": "ADBE Vector Group",
+ "hd": false
+ },
+ {
+ "ty": "tm",
+ "s": {
+ "a": 1,
+ "k": [
+ {
+ "i": {
+ "x": [
+ 0.833
+ ],
+ "y": [
+ 0.833
+ ]
+ },
+ "o": {
+ "x": [
+ 0.167
+ ],
+ "y": [
+ 0.167
+ ]
+ },
+ "t": 0,
+ "s": [
+ 0
+ ]
+ },
+ {
+ "t": 36,
+ "s": [
+ 0
+ ]
+ }
+ ],
+ "ix": 1
+ },
+ "e": {
+ "a": 1,
+ "k": [
+ {
+ "i": {
+ "x": [
+ 0.833
+ ],
+ "y": [
+ 0.833
+ ]
+ },
+ "o": {
+ "x": [
+ 0.167
+ ],
+ "y": [
+ 0.167
+ ]
+ },
+ "t": 0,
+ "s": [
+ 0
+ ]
+ },
+ {
+ "t": 36,
+ "s": [
+ 100
+ ]
+ }
+ ],
+ "ix": 2
+ },
+ "o": {
+ "a": 0,
+ "k": 0,
+ "ix": 3
+ },
+ "m": 1,
+ "ix": 2,
+ "nm": "Taglia tracciati 1",
+ "mn": "ADBE Vector Filter - Trim",
+ "hd": false
+ },
+ {
+ "ty": "rd",
+ "nm": "Angoli arrotondati 1",
+ "r": {
+ "a": 0,
+ "k": 10,
+ "ix": 1
+ },
+ "ix": 3,
+ "mn": "ADBE Vector Filter - RC",
+ "hd": false
+ }
+ ],
+ "ip": 0,
+ "op": 57,
+ "st": 0,
+ "bm": 0
+ }
+ ]
+ }
+ ],
+ "layers": [
+ {
+ "ddd": 0,
+ "ind": 1,
+ "ty": 0,
+ "nm": "Warning_2",
+ "refId": "comp_0",
+ "sr": 1,
+ "ks": {
+ "o": {
+ "a": 0,
+ "k": 100,
+ "ix": 11
+ },
+ "r": {
+ "a": 0,
+ "k": 0,
+ "ix": 10
+ },
+ "p": {
+ "a": 0,
+ "k": [
+ 530,
+ 530,
+ 0
+ ],
+ "ix": 2,
+ "l": 2
+ },
+ "a": {
+ "a": 0,
+ "k": [
+ 24,
+ 24,
+ 0
+ ],
+ "ix": 1,
+ "l": 2
+ },
+ "s": {
+ "a": 0,
+ "k": [
+ 2000,
+ 2000,
+ 100
+ ],
+ "ix": 6,
+ "l": 2
+ }
+ },
+ "ao": 0,
+ "w": 48,
+ "h": 48,
+ "ip": 0,
+ "op": 57,
+ "st": 0,
+ "bm": 0
+ }
+ ],
+ "markers": []
+}
\ No newline at end of file