From 054a17caaa7cd36f4f4ba644088c4ccf5b9c06fb Mon Sep 17 00:00:00 2001 From: ztenghui Date: Thu, 8 Jan 2015 10:16:52 -0800 Subject: [PATCH] Limit the scope of clip path to the group, not global http://b/18758765 Change-Id: I899401a5fcbccd0421687bd5cf671f7751092195 --- .../graphics/drawable/VectorDrawable.java | 4 +- .../res/drawable/vector_drawable03.xml | 40 +++++++++++-------- 2 files changed, 27 insertions(+), 17 deletions(-) diff --git a/graphics/java/android/graphics/drawable/VectorDrawable.java b/graphics/java/android/graphics/drawable/VectorDrawable.java index 8b0f635482e07..b5fd8dd5588c2 100644 --- a/graphics/java/android/graphics/drawable/VectorDrawable.java +++ b/graphics/java/android/graphics/drawable/VectorDrawable.java @@ -913,9 +913,10 @@ public class VectorDrawable extends Drawable { // Basically the Mfinal = Mviewport * M0 * M1 * M2; // Mi the local matrix at level i of the group tree. currentGroup.mStackedMatrix.set(currentMatrix); - currentGroup.mStackedMatrix.preConcat(currentGroup.mLocalMatrix); + // Save the current clip information, which is local to this group. + canvas.save(); // Draw the group tree in the same order as the XML file. for (int i = 0; i < currentGroup.mChildren.size(); i++) { Object child = currentGroup.mChildren.get(i); @@ -928,6 +929,7 @@ public class VectorDrawable extends Drawable { drawPath(currentGroup, childPath, canvas, w, h, filter); } } + canvas.restore(); } public void draw(Canvas canvas, int w, int h, ColorFilter filter) { diff --git a/tests/VectorDrawableTest/res/drawable/vector_drawable03.xml b/tests/VectorDrawableTest/res/drawable/vector_drawable03.xml index a0b0e000d09e4..7cddda177b39b 100644 --- a/tests/VectorDrawableTest/res/drawable/vector_drawable03.xml +++ b/tests/VectorDrawableTest/res/drawable/vector_drawable03.xml @@ -14,10 +14,10 @@ limitations under the License. --> + android:height="64dp" + android:viewportHeight="12.25" + android:viewportWidth="7.30625" + android:width="64dp" > - - - + + - - - + + \ No newline at end of file