summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2015-05-29 16:23:43 -0700
committerAlan Viverette <alanv@google.com>2015-05-29 16:23:43 -0700
commit15ce834e52806378d6ab2b90f573bae14cb3fd4b (patch)
tree3b8afb2706f458ce892dd095a47af7c4be26355c /graphics
parent517f3ee41afb7713f1fc6fa37a6f3a6efa97a020 (diff)
downloadframeworks_base-15ce834e52806378d6ab2b90f573bae14cb3fd4b.zip
frameworks_base-15ce834e52806378d6ab2b90f573bae14cb3fd4b.tar.gz
frameworks_base-15ce834e52806378d6ab2b90f573bae14cb3fd4b.tar.bz2
Reduce amount of unnecessary RippleDrawable mask redraw
Bug: 19638504 Change-Id: Ie7b639c543150e13aec30dfeca2b303d5b601cf3
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/drawable/RippleComponent.java2
-rw-r--r--graphics/java/android/graphics/drawable/RippleDrawable.java19
2 files changed, 14 insertions, 7 deletions
diff --git a/graphics/java/android/graphics/drawable/RippleComponent.java b/graphics/java/android/graphics/drawable/RippleComponent.java
index 5ba2f93..aa2aa20 100644
--- a/graphics/java/android/graphics/drawable/RippleComponent.java
+++ b/graphics/java/android/graphics/drawable/RippleComponent.java
@@ -237,7 +237,7 @@ abstract class RippleComponent {
}
protected final void invalidateSelf() {
- mOwner.invalidateSelf();
+ mOwner.invalidateSelf(false);
}
protected final boolean isHardwareAnimating() {
diff --git a/graphics/java/android/graphics/drawable/RippleDrawable.java b/graphics/java/android/graphics/drawable/RippleDrawable.java
index f7e8ed0..1af48ca 100644
--- a/graphics/java/android/graphics/drawable/RippleDrawable.java
+++ b/graphics/java/android/graphics/drawable/RippleDrawable.java
@@ -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() {