We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 7c02632 commit 1558cf1Copy full SHA for 1558cf1
1 file changed
graphics/java/android/graphics/drawable/ShapeDrawable.java
@@ -373,8 +373,16 @@ public ConstantState getConstantState() {
373
@Override
374
public Drawable mutate() {
375
if (!mMutated && super.mutate() == this) {
376
- mShapeState.mPaint = new Paint(mShapeState.mPaint);
377
- mShapeState.mPadding = new Rect(mShapeState.mPadding);
+ if (mShapeState.mPaint != null) {
+ mShapeState.mPaint = new Paint(mShapeState.mPaint);
378
+ } else {
379
+ mShapeState.mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
380
+ }
381
+ if (mShapeState.mPadding != null) {
382
+ mShapeState.mPadding = new Rect(mShapeState.mPadding);
383
384
+ mShapeState.mPadding = new Rect();
385
386
try {
387
mShapeState.mShape = mShapeState.mShape.clone();
388
} catch (CloneNotSupportedException e) {
0 commit comments