VD: Fix Canvas save leak

bug:16965998

Change-Id: I367388b270748e2ce114b468940966d78de07465
This commit is contained in:
ztenghui
2014-08-12 09:16:19 -07:00
parent 1fbc124780
commit 0670f029a4

View File

@@ -238,14 +238,13 @@ public class VectorDrawable extends Drawable {
@Override
public void draw(Canvas canvas) {
final int saveCount = canvas.save();
final Rect bounds = getBounds();
if (bounds.width() == 0 || bounds.height() == 0) {
// too small to draw
return;
}
final int saveCount = canvas.save();
final boolean needMirroring = needMirroring();
canvas.translate(bounds.left, bounds.top);