OSDN Git Service

VD: Fix Canvas save leak
authorztenghui <ztenghui@google.com>
Tue, 12 Aug 2014 16:16:19 +0000 (09:16 -0700)
committerztenghui <ztenghui@google.com>
Tue, 12 Aug 2014 17:35:49 +0000 (10:35 -0700)
bug:16965998

Change-Id: I367388b270748e2ce114b468940966d78de07465

graphics/java/android/graphics/drawable/VectorDrawable.java

index c2cec32..766e681 100644 (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);