Do not invalidate drawable if tint doesn't change
Change-Id: I99d7a679ba3aa4978f2915f1a52f23dbce7fd971
diff --git a/graphics/java/android/graphics/drawable/BitmapDrawable.java b/graphics/java/android/graphics/drawable/BitmapDrawable.java
index daf2581..bffbc75 100644
--- a/graphics/java/android/graphics/drawable/BitmapDrawable.java
+++ b/graphics/java/android/graphics/drawable/BitmapDrawable.java
@@ -641,16 +641,22 @@
@Override
public void setTintList(ColorStateList tint) {
- mBitmapState.mTint = tint;
- mTintFilter = updateTintFilter(mTintFilter, tint, mBitmapState.mTintMode);
- invalidateSelf();
+ final BitmapState state = mBitmapState;
+ if (state.mTint != tint) {
+ state.mTint = tint;
+ mTintFilter = updateTintFilter(mTintFilter, tint, mBitmapState.mTintMode);
+ invalidateSelf();
+ }
}
@Override
public void setTintMode(PorterDuff.Mode tintMode) {
- mBitmapState.mTintMode = tintMode;
- mTintFilter = updateTintFilter(mTintFilter, mBitmapState.mTint, tintMode);
- invalidateSelf();
+ final BitmapState state = mBitmapState;
+ if (state.mTintMode != tintMode) {
+ state.mTintMode = tintMode;
+ mTintFilter = updateTintFilter(mTintFilter, mBitmapState.mTint, tintMode);
+ invalidateSelf();
+ }
}
/**