Skip to content

Commit 9d90132

Browse files
Do not call saveLayer for physical model layers whose bounds are simple rectangles (flutter#11324)
This is similar to an optimization done in PhysicalModelLayer::Paint in the engine
1 parent 48427cb commit 9d90132

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

packages/flutter/lib/src/rendering/proxy_box.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1364,7 +1364,11 @@ class RenderPhysicalModel extends _RenderCustomClip<RRect> {
13641364
);
13651365
}
13661366
canvas.drawRRect(offsetClipRRect, new Paint()..color = color);
1367-
canvas.saveLayer(offsetBounds, _defaultPaint);
1367+
if (offsetClipRRect.isRect) {
1368+
canvas.save();
1369+
} else {
1370+
canvas.saveLayer(offsetBounds, _defaultPaint);
1371+
}
13681372
canvas.clipRRect(offsetClipRRect);
13691373
super.paint(context, offset);
13701374
canvas.restore();

0 commit comments

Comments
 (0)