summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorChet Haase <chet@google.com>2012-11-21 11:17:39 -0800
committerChet Haase <chet@google.com>2012-11-21 11:21:13 -0800
commit813680780f365648b39873fa26dfae0123d51aed (patch)
tree75b33b47d843c4af1c9cdb6cc2c39ce1852d80eb /graphics
parent3f64edec6c6b2e53b42cfd8c6a6765ecee084fc2 (diff)
downloadframeworks_base-813680780f365648b39873fa26dfae0123d51aed.zip
frameworks_base-813680780f365648b39873fa26dfae0123d51aed.tar.gz
frameworks_base-813680780f365648b39873fa26dfae0123d51aed.tar.bz2
Use correct alpha value when a color is not set on a GradientDrawable.
A previous fix ensured that color filters would have a default (black) color to interact with if no color was set on the GradientDrawable object. However, that fix assumed an opaque alpha value, which is not always the case. Specifically, calling setImageAlpha() on an ImageView with a shape drawable source (as in the bug here) caused the alpha to be set to a translucent value, which was then ignored in the fix above. The fix is to account for the current alpha value of the GradientDrawable object when setting the color used by the paint object. Issue #7592193 ImageView.setImageAlpha() broken when colorFilter is in use Change-Id: Ie622ffca776fdd8731ced78ce1f683ca6a51dec8
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/drawable/GradientDrawable.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/graphics/java/android/graphics/drawable/GradientDrawable.java b/graphics/java/android/graphics/drawable/GradientDrawable.java
index 0623a9e..b966bb4 100644
--- a/graphics/java/android/graphics/drawable/GradientDrawable.java
+++ b/graphics/java/android/graphics/drawable/GradientDrawable.java
@@ -479,7 +479,7 @@ public class GradientDrawable extends Drawable {
mFillPaint.setDither(mDither);
mFillPaint.setColorFilter(mColorFilter);
if (mColorFilter != null && !mGradientState.mHasSolidColor) {
- mFillPaint.setColor(0xff000000);
+ mFillPaint.setColor(mAlpha << 24);
}
if (haveStroke) {
mStrokePaint.setAlpha(currStrokeAlpha);
@@ -743,7 +743,7 @@ public class GradientDrawable extends Drawable {
mFillPaint.setShader(new LinearGradient(x0, y0, x1, y1,
colors, st.mPositions, Shader.TileMode.CLAMP));
if (!mGradientState.mHasSolidColor) {
- mFillPaint.setColor(0xff000000);
+ mFillPaint.setColor(mAlpha << 24);
}
} else if (st.mGradient == RADIAL_GRADIENT) {
x0 = r.left + (r.right - r.left) * st.mCenterX;
@@ -755,7 +755,7 @@ public class GradientDrawable extends Drawable {
level * st.mGradientRadius, colors, null,
Shader.TileMode.CLAMP));
if (!mGradientState.mHasSolidColor) {
- mFillPaint.setColor(0xff000000);
+ mFillPaint.setColor(mAlpha << 24);
}
} else if (st.mGradient == SWEEP_GRADIENT) {
x0 = r.left + (r.right - r.left) * st.mCenterX;
@@ -788,7 +788,7 @@ public class GradientDrawable extends Drawable {
}
mFillPaint.setShader(new SweepGradient(x0, y0, tempColors, tempPositions));
if (!mGradientState.mHasSolidColor) {
- mFillPaint.setColor(0xff000000);
+ mFillPaint.setColor(mAlpha << 24);
}
}
}