summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-09-10 14:05:15 -0700
committerAlan Viverette <alanv@google.com>2014-09-10 14:05:15 -0700
commit8683a4f819c5b4c77593568048428a6a18a883ca (patch)
tree19df18f2b96ff47a4309e9f3d9a42fceea215f70 /graphics
parent3ab7bf1a3d1383190a8c3a84f1216227529fdcec (diff)
downloadframeworks_base-8683a4f819c5b4c77593568048428a6a18a883ca.zip
frameworks_base-8683a4f819c5b4c77593568048428a6a18a883ca.tar.gz
frameworks_base-8683a4f819c5b4c77593568048428a6a18a883ca.tar.bz2
Only force drawing in RippleDrawable when necessary
BUG: 17451761 Change-Id: Ibb9d1c64791ec54eb90608c957eeb5efb1712b4a
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/drawable/RippleDrawable.java18
1 files changed, 15 insertions, 3 deletions
diff --git a/graphics/java/android/graphics/drawable/RippleDrawable.java b/graphics/java/android/graphics/drawable/RippleDrawable.java
index b05fb61..b13669b 100644
--- a/graphics/java/android/graphics/drawable/RippleDrawable.java
+++ b/graphics/java/android/graphics/drawable/RippleDrawable.java
@@ -156,6 +156,13 @@ public class RippleDrawable extends LayerDrawable {
private boolean mOverrideBounds;
/**
+ * Whether the next draw MUST draw something to canvas. Used to work around
+ * a bug in hardware invalidation following a render thread-accelerated
+ * animation.
+ */
+ private boolean mNeedsDraw;
+
+ /**
* Constructor used for drawable inflation.
*/
RippleDrawable() {
@@ -204,6 +211,8 @@ public class RippleDrawable extends LayerDrawable {
}
cancelExitingRipples();
+
+ mNeedsDraw = true;
invalidateSelf();
}
@@ -548,6 +557,8 @@ public class RippleDrawable extends LayerDrawable {
}
cancelExitingRipples();
+
+ mNeedsDraw = true;
invalidateSelf();
}
@@ -642,11 +653,12 @@ public class RippleDrawable extends LayerDrawable {
canvas.restoreToCount(rippleLayer);
}
- // If we failed to draw anything, at least draw a color so that
- // invalidation works correctly.
- if (contentLayer < 0 && backgroundLayer < 0 && rippleLayer < 0) {
+ // If we failed to draw anything and we just canceled animations, at
+ // least draw a color so that hardware invalidation works correctly.
+ if (contentLayer < 0 && backgroundLayer < 0 && rippleLayer < 0 && mNeedsDraw) {
canvas.drawColor(Color.TRANSPARENT);
}
+ mNeedsDraw = false;
canvas.restoreToCount(saveCount);
}