summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2013-08-28 14:06:38 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2013-08-28 14:06:38 -0700
commitdd5745b7c71e8c6bd6d4c95f6c1981899ac67538 (patch)
tree4b7cf92009e7a76896cb8ce7b02755528811e532 /graphics
parentc5c4809c956eb867c80e41df3c7bb3ff230bfb2d (diff)
parentc6de5c74e1e5dd92c011a1f060e26e10b15ffb77 (diff)
downloadframeworks_base-dd5745b7c71e8c6bd6d4c95f6c1981899ac67538.zip
frameworks_base-dd5745b7c71e8c6bd6d4c95f6c1981899ac67538.tar.gz
frameworks_base-dd5745b7c71e8c6bd6d4c95f6c1981899ac67538.tar.bz2
am c6de5c74: am 236ae4f2: Merge "Set alpha channel correctly when recomputing gradient" into klp-dev
* commit 'c6de5c74e1e5dd92c011a1f060e26e10b15ffb77': Set alpha channel correctly when recomputing gradient
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/drawable/GradientDrawable.java19
1 files changed, 10 insertions, 9 deletions
diff --git a/graphics/java/android/graphics/drawable/GradientDrawable.java b/graphics/java/android/graphics/drawable/GradientDrawable.java
index d226c8c..b340777 100644
--- a/graphics/java/android/graphics/drawable/GradientDrawable.java
+++ b/graphics/java/android/graphics/drawable/GradientDrawable.java
@@ -19,6 +19,7 @@ package android.graphics.drawable;
import android.content.res.Resources;
import android.content.res.TypedArray;
import android.graphics.Canvas;
+import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.DashPathEffect;
import android.graphics.LinearGradient;
@@ -747,9 +748,6 @@ public class GradientDrawable extends Drawable {
mFillPaint.setShader(new LinearGradient(x0, y0, x1, y1,
colors, st.mPositions, Shader.TileMode.CLAMP));
- if (!mGradientState.mHasSolidColor) {
- mFillPaint.setColor(mAlpha << 24);
- }
} else if (st.mGradient == RADIAL_GRADIENT) {
x0 = r.left + (r.right - r.left) * st.mCenterX;
y0 = r.top + (r.bottom - r.top) * st.mCenterY;
@@ -759,9 +757,6 @@ public class GradientDrawable extends Drawable {
mFillPaint.setShader(new RadialGradient(x0, y0,
level * st.mGradientRadius, colors, null,
Shader.TileMode.CLAMP));
- if (!mGradientState.mHasSolidColor) {
- mFillPaint.setColor(mAlpha << 24);
- }
} else if (st.mGradient == SWEEP_GRADIENT) {
x0 = r.left + (r.right - r.left) * st.mCenterX;
y0 = r.top + (r.bottom - r.top) * st.mCenterY;
@@ -792,9 +787,12 @@ public class GradientDrawable extends Drawable {
}
mFillPaint.setShader(new SweepGradient(x0, y0, tempColors, tempPositions));
- if (!mGradientState.mHasSolidColor) {
- mFillPaint.setColor(mAlpha << 24);
- }
+ }
+
+ // If we don't have a solid color, the alpha channel must be
+ // maxed out so that alpha modulation works correctly.
+ if (!st.mHasSolidColor) {
+ mFillPaint.setColor(Color.BLACK);
}
}
}
@@ -1281,6 +1279,9 @@ public class GradientDrawable extends Drawable {
// the app is stroking the shape, set the color to the default
// value of state.mSolidColor
mFillPaint.setColor(0);
+ } else {
+ // Otherwise, make sure the fill alpha is maxed out.
+ mFillPaint.setColor(Color.BLACK);
}
mPadding = state.mPadding;
if (state.mStrokeWidth >= 0) {