summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaph Levien <raph@google.com>2012-10-31 13:53:57 -0700
committerRaph Levien <raph@google.com>2012-10-31 13:59:02 -0700
commit39824f685c33f8aabbe9526b4cc79b7411e8b37f (patch)
tree82144e5bf92a1435019181142e58d1479dca80ac
parentf64e70fd045c2a786e3d3edf880d806e93beec3b (diff)
downloadframeworks_base-39824f685c33f8aabbe9526b4cc79b7411e8b37f.zip
frameworks_base-39824f685c33f8aabbe9526b4cc79b7411e8b37f.tar.gz
frameworks_base-39824f685c33f8aabbe9526b4cc79b7411e8b37f.tar.bz2
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
-rw-r--r--graphics/java/android/graphics/drawable/GradientDrawable.java5
1 files changed, 5 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/drawable/GradientDrawable.java b/graphics/java/android/graphics/drawable/GradientDrawable.java
index 8374b10..0623a9e 100644
--- a/graphics/java/android/graphics/drawable/GradientDrawable.java
+++ b/graphics/java/android/graphics/drawable/GradientDrawable.java
@@ -1191,6 +1191,11 @@ public class GradientDrawable extends Drawable {
return;
}
+ if (mRadius > 0 || mRadiusArray != null) {
+ mOpaque = false;
+ return;
+ }
+
if (mStrokeWidth > 0 && !isOpaque(mStrokeColor)) {
mOpaque = false;
return;