Loading core/java/android/util/PathParser.java +17 −7 Original line number Diff line number Diff line Loading @@ -142,9 +142,9 @@ public class PathParser { private static class ExtractFloatResult { // We need to return the position of the next separator and whether the // next float starts with a '-'. // next float starts with a '-' or a '.'. int mEndPosition; boolean mEndWithNegSign; boolean mEndWithNegOrDot; } /** Loading Loading @@ -179,8 +179,8 @@ public class PathParser { s.substring(startPosition, endPosition)); } if (result.mEndWithNegSign) { // Keep the '-' sign with next number. if (result.mEndWithNegOrDot) { // Keep the '-' or '.' sign with next number. startPosition = endPosition; } else { startPosition = endPosition + 1; Loading @@ -201,10 +201,11 @@ public class PathParser { * the starting position of next number, whether it is ending with a '-'. */ private static void extract(String s, int start, ExtractFloatResult result) { // Now looking for ' ', ',' or '-' from the start. // Now looking for ' ', ',', '.' or '-' from the start. int currentIndex = start; boolean foundSeparator = false; result.mEndWithNegSign = false; result.mEndWithNegOrDot = false; boolean secondDot = false; for (; currentIndex < s.length(); currentIndex++) { char currentChar = s.charAt(currentIndex); switch (currentChar) { Loading @@ -215,7 +216,16 @@ public class PathParser { case '-': if (currentIndex != start) { foundSeparator = true; result.mEndWithNegSign = true; result.mEndWithNegOrDot = true; } break; case '.': if (!secondDot) { secondDot = true; } else { // This is the second dot, and it is considered as a separator. foundSeparator = true; result.mEndWithNegOrDot = true; } break; } Loading tests/VectorDrawableTest/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.test.dynamic" > <uses-sdk android:minSdkVersion="20" /> <uses-sdk android:minSdkVersion="21" /> <application android:hardwareAccelerated="true" Loading tests/VectorDrawableTest/res/drawable/vector_drawable29.xml 0 → 100644 +28 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2014 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="48dp" android:width="48dp" android:viewportHeight="1" android:viewportWidth="1" > <group> <path android:name="box1" android:pathData="l0.0.0.5.0.0.5-0.5.0.0-.5z" android:fillColor="#ff00ff00"/> </group> </vector> tests/VectorDrawableTest/src/com/android/test/dynamic/VectorDrawablePerformance.java +1 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ public class VectorDrawablePerformance extends Activity { R.drawable.vector_drawable26, R.drawable.vector_drawable27, R.drawable.vector_drawable28, R.drawable.vector_drawable29, }; @Override Loading Loading
core/java/android/util/PathParser.java +17 −7 Original line number Diff line number Diff line Loading @@ -142,9 +142,9 @@ public class PathParser { private static class ExtractFloatResult { // We need to return the position of the next separator and whether the // next float starts with a '-'. // next float starts with a '-' or a '.'. int mEndPosition; boolean mEndWithNegSign; boolean mEndWithNegOrDot; } /** Loading Loading @@ -179,8 +179,8 @@ public class PathParser { s.substring(startPosition, endPosition)); } if (result.mEndWithNegSign) { // Keep the '-' sign with next number. if (result.mEndWithNegOrDot) { // Keep the '-' or '.' sign with next number. startPosition = endPosition; } else { startPosition = endPosition + 1; Loading @@ -201,10 +201,11 @@ public class PathParser { * the starting position of next number, whether it is ending with a '-'. */ private static void extract(String s, int start, ExtractFloatResult result) { // Now looking for ' ', ',' or '-' from the start. // Now looking for ' ', ',', '.' or '-' from the start. int currentIndex = start; boolean foundSeparator = false; result.mEndWithNegSign = false; result.mEndWithNegOrDot = false; boolean secondDot = false; for (; currentIndex < s.length(); currentIndex++) { char currentChar = s.charAt(currentIndex); switch (currentChar) { Loading @@ -215,7 +216,16 @@ public class PathParser { case '-': if (currentIndex != start) { foundSeparator = true; result.mEndWithNegSign = true; result.mEndWithNegOrDot = true; } break; case '.': if (!secondDot) { secondDot = true; } else { // This is the second dot, and it is considered as a separator. foundSeparator = true; result.mEndWithNegOrDot = true; } break; } Loading
tests/VectorDrawableTest/AndroidManifest.xml +1 −1 Original line number Diff line number Diff line Loading @@ -18,7 +18,7 @@ <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.test.dynamic" > <uses-sdk android:minSdkVersion="20" /> <uses-sdk android:minSdkVersion="21" /> <application android:hardwareAccelerated="true" Loading
tests/VectorDrawableTest/res/drawable/vector_drawable29.xml 0 → 100644 +28 −0 Original line number Diff line number Diff line <!-- Copyright (C) 2014 The Android Open Source Project Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:height="48dp" android:width="48dp" android:viewportHeight="1" android:viewportWidth="1" > <group> <path android:name="box1" android:pathData="l0.0.0.5.0.0.5-0.5.0.0-.5z" android:fillColor="#ff00ff00"/> </group> </vector>
tests/VectorDrawableTest/src/com/android/test/dynamic/VectorDrawablePerformance.java +1 −0 Original line number Diff line number Diff line Loading @@ -56,6 +56,7 @@ public class VectorDrawablePerformance extends Activity { R.drawable.vector_drawable26, R.drawable.vector_drawable27, R.drawable.vector_drawable28, R.drawable.vector_drawable29, }; @Override Loading