summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2012-10-02 12:32:25 -0700
committerRomain Guy <romainguy@google.com>2012-10-02 13:33:10 -0700
commitcf8675ee176a375f873792684d38a47f78348dff (patch)
treea50655caeb5717f2e53cc613b66e62ae4dee2ec3 /graphics
parent0944d625448209185452eb4e800daec49de51986 (diff)
downloadframeworks_base-cf8675ee176a375f873792684d38a47f78348dff.zip
frameworks_base-cf8675ee176a375f873792684d38a47f78348dff.tar.gz
frameworks_base-cf8675ee176a375f873792684d38a47f78348dff.tar.bz2
Draw stroked rectangle as meshes instead of textures
Bug #7233734 Stroked rectangles were rendered using software generated textures which would lead to slightly misaligned results. Instead, let's use the new convex path rendering code that will do the right thing (and save a lot of bandwidth.) Change-Id: Ib95ff581e56c1ecead97e4919298e6fd146ca167
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/drawable/GradientDrawable.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/graphics/java/android/graphics/drawable/GradientDrawable.java b/graphics/java/android/graphics/drawable/GradientDrawable.java
index 2ca54d4..22aa29c 100644
--- a/graphics/java/android/graphics/drawable/GradientDrawable.java
+++ b/graphics/java/android/graphics/drawable/GradientDrawable.java
@@ -513,7 +513,10 @@ public class GradientDrawable extends Drawable {
canvas.drawRoundRect(mRect, rad, rad, mStrokePaint);
}
} else {
- canvas.drawRect(mRect, mFillPaint);
+ if (mFillPaint.getColor() != 0 || mColorFilter != null ||
+ mFillPaint.getShader() != null) {
+ canvas.drawRect(mRect, mFillPaint);
+ }
if (haveStroke) {
canvas.drawRect(mRect, mStrokePaint);
}
@@ -1251,6 +1254,11 @@ public class GradientDrawable extends Drawable {
private void initializeWithState(GradientState state) {
if (state.mHasSolidColor) {
mFillPaint.setColor(state.mSolidColor);
+ } else if (state.mColors == null) {
+ // If we don't have a solid color and we don't have a gradient,
+ // the app is stroking the shape, set the color to the default
+ // value of state.mSolidColor
+ mFillPaint.setColor(0);
}
mPadding = state.mPadding;
if (state.mStrokeWidth >= 0) {