Save and restore ClockIconDrawable canvas when modifying it
Test: Play "slot machine" animation where Clock icon is involved, ensure all icons in the animation draw normally
Bug: 180605356
Change-Id: I2ad4d1a02dbb399e4b92502d21d3974c57729d6d
diff --git a/iconloaderlib/src/com/android/launcher3/icons/ClockDrawableWrapper.java b/iconloaderlib/src/com/android/launcher3/icons/ClockDrawableWrapper.java
index a7894c9..5e86fde 100644
--- a/iconloaderlib/src/com/android/launcher3/icons/ClockDrawableWrapper.java
+++ b/iconloaderlib/src/com/android/launcher3/icons/ClockDrawableWrapper.java
@@ -25,10 +25,8 @@
import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
-import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Paint;
-import android.graphics.PorterDuff;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffColorFilter;
import android.graphics.Rect;
@@ -373,10 +371,12 @@
// prepare and draw the foreground
mInfo.animInfo.applyTime(mTime, mForeground);
+ int saveCount = canvas.save();
canvas.scale(mInfo.scale, mInfo.scale,
bounds.exactCenterX() + mInfo.offset, bounds.exactCenterY() + mInfo.offset);
canvas.clipPath(mFullDrawable.getIconMask());
mForeground.draw(canvas);
+ canvas.restoreToCount(saveCount);
reschedule();
}