summaryrefslogtreecommitdiffstats
path: root/graphics/java
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-02-19 14:40:12 -0800
committerAlan Viverette <alanv@google.com>2014-02-19 14:40:12 -0800
commit7f610fed107b158c144dca1b20a44ee91eb8c934 (patch)
tree1c3fbce93d4ef16a35bd7f39cc899f0efacb97db /graphics/java
parent5314b3d593a04c67d12dc134e9e80aa41c8e7042 (diff)
downloadframeworks_base-7f610fed107b158c144dca1b20a44ee91eb8c934.zip
frameworks_base-7f610fed107b158c144dca1b20a44ee91eb8c934.tar.gz
frameworks_base-7f610fed107b158c144dca1b20a44ee91eb8c934.tar.bz2
Fix for reveal animated drawables
Includes fixes for RevealDrawable clipping, touch feedback constant state, and action bar background display lists. BUG: 13065159 Change-Id: Ie4bf03f59da69047e18a8fe9233c3d24b0160576
Diffstat (limited to 'graphics/java')
-rw-r--r--graphics/java/android/graphics/drawable/RevealDrawable.java18
-rw-r--r--graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java15
2 files changed, 20 insertions, 13 deletions
diff --git a/graphics/java/android/graphics/drawable/RevealDrawable.java b/graphics/java/android/graphics/drawable/RevealDrawable.java
index 38765e8..91de638 100644
--- a/graphics/java/android/graphics/drawable/RevealDrawable.java
+++ b/graphics/java/android/graphics/drawable/RevealDrawable.java
@@ -18,7 +18,6 @@ package android.graphics.drawable;
import android.content.res.Resources;
import android.graphics.Canvas;
-import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff.Mode;
import android.graphics.PorterDuffXfermode;
@@ -233,16 +232,14 @@ public class RevealDrawable extends LayerDrawable {
getDrawable(0).draw(canvas);
+ final Rect bounds = getBounds();
final ArrayList<Ripple> activeRipples = mActiveRipples;
- if (layerCount == 1 || activeRipples == null || activeRipples.isEmpty()) {
+ if (layerCount == 1 || bounds.isEmpty() || activeRipples == null
+ || activeRipples.isEmpty()) {
// Nothing to reveal, we're done here.
return;
}
- final Rect bounds = getBounds();
- final int width = bounds.width();
- final int height = bounds.height();
-
if (mRipplePaint == null) {
mRipplePaint = new Paint();
mRipplePaint.setAntiAlias(true);
@@ -260,7 +257,11 @@ public class RevealDrawable extends LayerDrawable {
n--;
} else {
if (layerSaveCount < 0) {
- layerSaveCount = canvas.saveLayer(0, 0, width, height, null, 0);
+ layerSaveCount = canvas.saveLayer(
+ bounds.left, bounds.top, bounds.right, bounds.bottom, null, 0);
+ // Ripples must be clipped to bounds, otherwise SRC_IN will
+ // miss them and we'll get artifacts.
+ canvas.clipRect(bounds);
}
needsMask |= ripple.draw(canvas, mRipplePaint);
@@ -279,7 +280,8 @@ public class RevealDrawable extends LayerDrawable {
// TODO: When Drawable.setXfermode() is supported by all drawables,
// we won't need an extra layer.
- canvas.saveLayer(0, 0, width, height, mMaskingPaint, 0);
+ canvas.saveLayer(
+ bounds.left, bounds.top, bounds.right, bounds.bottom, mMaskingPaint, 0);
getDrawable(1).draw(canvas);
}
diff --git a/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java b/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java
index 1bfdc4d..f7cd9de 100644
--- a/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java
+++ b/graphics/java/android/graphics/drawable/TouchFeedbackDrawable.java
@@ -338,11 +338,16 @@ public class TouchFeedbackDrawable extends Drawable {
return dirtyBounds;
}
- private static class TouchFeedbackState extends ConstantState {
- private ColorStateList mColorStateList;
- private Xfermode mXfermode;
- private int mTargetDensity;
- private boolean mProjected;
+ @Override
+ public ConstantState getConstantState() {
+ return mState;
+ }
+
+ static class TouchFeedbackState extends ConstantState {
+ ColorStateList mColorStateList;
+ Xfermode mXfermode;
+ int mTargetDensity;
+ boolean mProjected;
public TouchFeedbackState(TouchFeedbackState orig) {
if (orig != null) {