File tree 1 file changed +9
-7
lines changed
lib/java/com/google/android/material/shape
1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change @@ -1394,20 +1394,22 @@ public void getOutline(@NonNull Outline outline) {
1394
1394
return ;
1395
1395
}
1396
1396
1397
- if (pathDirty ) {
1398
- calculatePath (getBoundsAsRectF (), path );
1399
- pathDirty = false ;
1397
+ RectF bounds = getBoundsAsRectF ();
1398
+ if (bounds .isEmpty ()) {
1399
+ // Don't set the outline if the bounds are empty.
1400
+ return ;
1400
1401
}
1401
-
1402
1402
// Calculates the radius of a round rect, if the stroke shape can be drawn as a round rect.
1403
1403
float roundRectRadius =
1404
1404
calculateRoundRectCornerSize (
1405
- getBoundsInsetByStroke (),
1406
- drawableState .shapeAppearanceModel ,
1407
- springAnimatedCornerSizes );
1405
+ bounds , drawableState .shapeAppearanceModel , springAnimatedCornerSizes );
1408
1406
if (roundRectRadius >= 0 ) {
1409
1407
outline .setRoundRect (getBounds (), roundRectRadius * drawableState .interpolation );
1410
1408
} else {
1409
+ if (pathDirty ) {
1410
+ calculatePath (bounds , path );
1411
+ pathDirty = false ;
1412
+ }
1411
1413
DrawableUtils .setOutlineToPath (outline , path );
1412
1414
}
1413
1415
}
You can’t perform that action at this time.
0 commit comments