summaryrefslogtreecommitdiffstats
path: root/graphics/java/android/graphics/drawable/ShapeDrawable.java
diff options
context:
space:
mode:
Diffstat (limited to 'graphics/java/android/graphics/drawable/ShapeDrawable.java')
-rw-r--r--graphics/java/android/graphics/drawable/ShapeDrawable.java12
1 files changed, 10 insertions, 2 deletions
diff --git a/graphics/java/android/graphics/drawable/ShapeDrawable.java b/graphics/java/android/graphics/drawable/ShapeDrawable.java
index a3622a2..2ec1293 100644
--- a/graphics/java/android/graphics/drawable/ShapeDrawable.java
+++ b/graphics/java/android/graphics/drawable/ShapeDrawable.java
@@ -373,8 +373,16 @@ public class ShapeDrawable extends Drawable {
@Override
public Drawable mutate() {
if (!mMutated && super.mutate() == this) {
- mShapeState.mPaint = new Paint(mShapeState.mPaint);
- mShapeState.mPadding = new Rect(mShapeState.mPadding);
+ if (mShapeState.mPaint != null) {
+ mShapeState.mPaint = new Paint(mShapeState.mPaint);
+ } else {
+ mShapeState.mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
+ }
+ if (mShapeState.mPadding != null) {
+ mShapeState.mPadding = new Rect(mShapeState.mPadding);
+ } else {
+ mShapeState.mPadding = new Rect();
+ }
try {
mShapeState.mShape = mShapeState.mShape.clone();
} catch (CloneNotSupportedException e) {