Merge "Limit the scope of clip path to the group, not global"
diff --git a/graphics/java/android/graphics/drawable/VectorDrawable.java b/graphics/java/android/graphics/drawable/VectorDrawable.java
index 21dba43..f937ddb 100644
--- a/graphics/java/android/graphics/drawable/VectorDrawable.java
+++ b/graphics/java/android/graphics/drawable/VectorDrawable.java
@@ -926,9 +926,10 @@
             // 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);
@@ -941,6 +942,7 @@
                     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 a0b0e00..7cddda1 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.
 -->
 <vector xmlns:android="http://schemas.android.com/apk/res/android"
-        android:height="64dp"
-        android:width="64dp"
-        android:viewportHeight="12.25"
-        android:viewportWidth="7.30625" >
+    android:height="64dp"
+    android:viewportHeight="12.25"
+    android:viewportWidth="7.30625"
+    android:width="64dp" >
 
     <group
         android:pivotX="3.65"
@@ -31,14 +31,18 @@
                 l 0, 12.25
                 l-7.3, 0
                 z" />
-    </group>
-    <group>
-        <path
-            android:name="one"
-            android:fillColor="#ff88ff"
-            android:pathData="M 1.215625,9.5l 1.9375,0.0 0.0-6.671875-2.109375,0.421875 0.0-1.078125
+
+        <group
+            android:pivotX="3.65"
+            android:pivotY="6.125"
+            android:rotation="30" >
+            <path
+                android:name="one"
+                android:fillColor="#ff88ff"
+                android:pathData="M 1.215625,9.5l 1.9375,0.0 0.0-6.671875-2.109375,0.421875 0.0-1.078125
                 l 2.09375-0.421875 1.1874998,0.0 0.0,7.75 1.9375,0.0 0.0,1.0
                 l-5.046875,0.0 0.0-1.0Z" />
+        </group>
     </group>
     <group
         android:pivotX="3.65"
@@ -52,12 +56,15 @@
                 l 0, 6.125
                 l-7.3, 0
                 z" />
-    </group>
-    <group>
-        <path
-            android:name="two"
-            android:fillColor="#ff88ff"
-            android:pathData="M 2.534375,9.6875l 4.140625,0.0 0.0,1.0-5.5625,0.0 0.0-1.0q 0.671875-0.6875 1.828125-1.859375
+
+        <group
+            android:pivotX="3.65"
+            android:pivotY="6.125"
+            android:rotation="30" >
+            <path
+                android:name="two"
+                android:fillColor="#ff88ff"
+                android:pathData="M 2.534375,9.6875l 4.140625,0.0 0.0,1.0-5.5625,0.0 0.0-1.0q 0.671875-0.6875 1.828125-1.859375
                         q 1.1718752-1.1875 1.4687502-1.53125 0.578125-0.625 0.796875-1.0625
                         q 0.234375-0.453125 0.234375-0.875 0.0-0.703125-0.5-1.140625
                         q-0.484375-0.4375-1.2656252-0.4375-0.5625,0.0-1.1875,0.1875
@@ -66,6 +73,7 @@
                         q 0.8125,0.671875 0.8125,1.8125 0.0,0.53125-0.203125,1.015625
                         q-0.203125,0.484375-0.734375,1.140625-0.15625,0.171875-0.9375,0.984375
                         q-0.78125024,0.8125-2.2187502,2.265625Z" />
+        </group>
     </group>
 
 </vector>
\ No newline at end of file