Limit the scope of clip path to the group, not global

http://b/18758765

Change-Id: I899401a5fcbccd0421687bd5cf671f7751092195
This commit is contained in:
ztenghui
2015-01-08 10:16:52 -08:00
parent a1d11273d3
commit 054a17caaa
2 changed files with 27 additions and 17 deletions

View File

@@ -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) {

View File

@@ -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>