Skip to content

Commit

Permalink
[Shape] Moved unnecessary object from the drawable state.
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 651118525
  • Loading branch information
pekingme authored and paulfthomas committed Jul 22, 2024
1 parent 6617342 commit eb56238
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public CornerSize apply(@NonNull CornerSize cornerSize) {

private final Paint fillPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
private final Paint strokePaint = new Paint(Paint.ANTI_ALIAS_FLAG);
@NonNull private ShapeAppearanceModel strokeShapeAppearanceModel;

private final ShadowRenderer shadowRenderer = new ShadowRenderer();
@NonNull private final PathListener pathShadowListener;
Expand Down Expand Up @@ -1228,7 +1229,7 @@ protected void drawStrokeShape(@NonNull Canvas canvas) {
canvas,
strokePaint,
pathInsetByStroke,
drawableState.strokeShapeAppearanceModel,
strokeShapeAppearanceModel,
springAnimatedStrokeCornerSizes,
getBoundsInsetByStroke());
}
Expand Down Expand Up @@ -1332,7 +1333,7 @@ private void calculateStrokePath() {
updateStrokeShapeAppearanceModels();
RectF boundsInsetByStroke = getBoundsInsetByStroke();
pathProvider.calculatePath(
drawableState.strokeShapeAppearanceModel,
strokeShapeAppearanceModel,
springAnimatedStrokeCornerSizes,
drawableState.interpolation,
boundsInsetByStroke,
Expand All @@ -1343,7 +1344,7 @@ private void calculateStrokePath() {
private void updateStrokeShapeAppearanceModels() {
// Adjust corner radius in order to draw the stroke so that the corners of the background are
// drawn on top of the edges.
drawableState.strokeShapeAppearanceModel =
strokeShapeAppearanceModel =
getShapeAppearanceModel().withTransformedCornerSizes(strokeInsetCornerSizeUnaryOperator);
// Adjust spring animated corner sizes, when springs are controlling the corner sizes, in order
// to draw the stroke so that the corners of the background are drawn on top of the edges.
Expand Down Expand Up @@ -1653,7 +1654,6 @@ protected static class MaterialShapeDrawableState extends ConstantState {

@NonNull ShapeAppearanceModel shapeAppearanceModel;
@Nullable StateListShapeAppearanceModel stateListShapeAppearanceModel;
@NonNull ShapeAppearanceModel strokeShapeAppearanceModel;
@Nullable ElevationOverlayProvider elevationOverlayProvider;

@Nullable ColorFilter colorFilter;
Expand Down Expand Up @@ -1691,7 +1691,6 @@ public MaterialShapeDrawableState(
public MaterialShapeDrawableState(@NonNull MaterialShapeDrawableState orig) {
shapeAppearanceModel = orig.shapeAppearanceModel;
stateListShapeAppearanceModel = orig.stateListShapeAppearanceModel;
strokeShapeAppearanceModel = orig.strokeShapeAppearanceModel;
elevationOverlayProvider = orig.elevationOverlayProvider;
strokeWidth = orig.strokeWidth;
colorFilter = orig.colorFilter;
Expand Down

0 comments on commit eb56238

Please sign in to comment.