diff options
| author | 2014-09-10 23:26:05 +0000 | |
|---|---|---|
| committer | 2014-09-10 23:26:06 +0000 | |
| commit | 5aaa7788d5f6196fe0a756fb219c293131e4f21b (patch) | |
| tree | 98be5fe5e324ce8375ebe82c19f546c9396a3f91 /graphics/java/android | |
| parent | 12981923b80fbafe4a829c5aa03b8a970a1f14fa (diff) | |
| parent | 8683a4f819c5b4c77593568048428a6a18a883ca (diff) | |
Merge "Only force drawing in RippleDrawable when necessary" into lmp-dev
Diffstat (limited to 'graphics/java/android')
| -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 b05fb6130757..b13669b13816 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); } |