Skip to content

Commit 39824f6

Browse files
committed
Fix for bug 7400445 regression in background drawable
The opacity calculation for a gradient drawable of shape must take rounded corners into account - if the corner radius is nonzero, then the shape is translucent rather than opaque. Previously the code always assumed that such rectangles were fully opaque, which led to the background (visible behind the rectangle) not getting drawn. This patch simply checks for corner radius in addition to shape and computes opacity as translucent in the nonzero case. Change-Id: Iaf4d24abc6ecf49f85c82972b8f998700c83295e
1 parent f64e70f commit 39824f6

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1191,6 +1191,11 @@ private void computeOpacity() {
11911191
return;
11921192
}
11931193

1194+
if (mRadius > 0 || mRadiusArray != null) {
1195+
mOpaque = false;
1196+
return;
1197+
}
1198+
11941199
if (mStrokeWidth > 0 && !isOpaque(mStrokeColor)) {
11951200
mOpaque = false;
11961201
return;

0 commit comments

Comments
 (0)