diff options
author | Alan Viverette <alanv@google.com> | 2014-09-10 23:38:11 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2014-09-10 23:38:11 +0000 |
commit | 25cc6dcea8e5928f9e3c1dae96329b21a06517a0 (patch) | |
tree | 5708c4e88f8e3cb37d03f261f5797358ce5a32fc /graphics/java | |
parent | 95ebea4f17c76933326529ad0a59a5887ca22383 (diff) | |
parent | 730f9ca351eaa9c750472228e0e034637c97a114 (diff) | |
download | frameworks_base-25cc6dcea8e5928f9e3c1dae96329b21a06517a0.zip frameworks_base-25cc6dcea8e5928f9e3c1dae96329b21a06517a0.tar.gz frameworks_base-25cc6dcea8e5928f9e3c1dae96329b21a06517a0.tar.bz2 |
am b5d64475: am 38669745: Merge "Only force drawing in RippleDrawable when necessary" into lmp-dev
* commit 'b5d64475b9383b85432adf62d7d853e43b217d53':
Only force drawing in RippleDrawable when necessary
Diffstat (limited to 'graphics/java')
-rw-r--r-- | graphics/java/android/graphics/drawable/RippleDrawable.java | 18 |
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); } |