From 39824f685c33f8aabbe9526b4cc79b7411e8b37f Mon Sep 17 00:00:00 2001 From: Raph Levien Date: Wed, 31 Oct 2012 13:53:57 -0700 Subject: 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 --- graphics/java/android/graphics/drawable/GradientDrawable.java | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'graphics') 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; -- cgit v1.1