Skip to content

Commit a004ff8

Browse files
chethaaseAndroid (Google) Code Review
authored andcommitted
Merge "Use correct alpha value when a color is not set on a GradientDrawable." into jb-mr1.1-dev
2 parents 18bbcf7 + 8136807 commit a004ff8

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

graphics/java/android/graphics/drawable/GradientDrawable.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ of the fill (if any) without worrying about blending artifacts.
479479
mFillPaint.setDither(mDither);
480480
mFillPaint.setColorFilter(mColorFilter);
481481
if (mColorFilter != null && !mGradientState.mHasSolidColor) {
482-
mFillPaint.setColor(0xff000000);
482+
mFillPaint.setColor(mAlpha << 24);
483483
}
484484
if (haveStroke) {
485485
mStrokePaint.setAlpha(currStrokeAlpha);
@@ -743,7 +743,7 @@ private boolean ensureValidRect() {
743743
mFillPaint.setShader(new LinearGradient(x0, y0, x1, y1,
744744
colors, st.mPositions, Shader.TileMode.CLAMP));
745745
if (!mGradientState.mHasSolidColor) {
746-
mFillPaint.setColor(0xff000000);
746+
mFillPaint.setColor(mAlpha << 24);
747747
}
748748
} else if (st.mGradient == RADIAL_GRADIENT) {
749749
x0 = r.left + (r.right - r.left) * st.mCenterX;
@@ -755,7 +755,7 @@ private boolean ensureValidRect() {
755755
level * st.mGradientRadius, colors, null,
756756
Shader.TileMode.CLAMP));
757757
if (!mGradientState.mHasSolidColor) {
758-
mFillPaint.setColor(0xff000000);
758+
mFillPaint.setColor(mAlpha << 24);
759759
}
760760
} else if (st.mGradient == SWEEP_GRADIENT) {
761761
x0 = r.left + (r.right - r.left) * st.mCenterX;
@@ -788,7 +788,7 @@ private boolean ensureValidRect() {
788788
}
789789
mFillPaint.setShader(new SweepGradient(x0, y0, tempColors, tempPositions));
790790
if (!mGradientState.mHasSolidColor) {
791-
mFillPaint.setColor(0xff000000);
791+
mFillPaint.setColor(mAlpha << 24);
792792
}
793793
}
794794
}

0 commit comments

Comments
 (0)