Merge "Reduce amount of unnecessary RippleDrawable mask redraw" into mnc-dev

This commit is contained in:
Alan Viverette
2015-05-30 02:19:57 +00:00
committed by Android (Google) Code Review
2 changed files with 14 additions and 7 deletions

View File

@@ -237,7 +237,7 @@ abstract class RippleComponent {
}
protected final void invalidateSelf() {
mOwner.invalidateSelf();
mOwner.invalidateSelf(false);
}
protected final boolean isHardwareAnimating() {

View File

@@ -229,7 +229,7 @@ public class RippleDrawable extends LayerDrawable {
mExitingRipplesCount = 0;
// Always draw an additional "clean" frame after canceling animations.
invalidateSelf();
invalidateSelf(false);
}
@Override
@@ -364,7 +364,7 @@ public class RippleDrawable extends LayerDrawable {
*/
public void setColor(ColorStateList color) {
mState.mColor = color;
invalidateSelf();
invalidateSelf(false);
}
/**
@@ -376,7 +376,7 @@ public class RippleDrawable extends LayerDrawable {
*/
public void setRadius(int radius) {
mState.mMaxRadius = radius;
invalidateSelf();
invalidateSelf(false);
}
/**
@@ -477,7 +477,7 @@ public class RippleDrawable extends LayerDrawable {
private void setTargetDensity(DisplayMetrics metrics) {
if (mDensity != metrics.density) {
mDensity = metrics.density;
invalidateSelf();
invalidateSelf(false);
}
}
@@ -684,10 +684,17 @@ public class RippleDrawable extends LayerDrawable {
@Override
public void invalidateSelf() {
invalidateSelf(true);
}
void invalidateSelf(boolean invalidateMask) {
super.invalidateSelf();
// Force the mask to update on the next draw().
mHasValidMask = false;
if (invalidateMask) {
// Force the mask to update on the next draw().
mHasValidMask = false;
}
}
private void pruneRipples() {