Skip to content
This repository was archived by the owner on Apr 29, 2021. It is now read-only.

Commit 0a89e28

Browse files
committed
improve batch efficiency when long paragraph is selected
1 parent 50b83d9 commit 0a89e28

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Runtime/rendering/paragraph.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,9 +372,11 @@ void _paintSelection(Canvas canvas, Offset effectiveOffset) {
372372
D.assert(this.selectionColor != null);
373373
var paint = new Paint {color = this.selectionColor};
374374

375+
Path barPath = new Path();
375376
foreach (var box in this._selectionRects) {
376-
canvas.drawRect(box.toRect().shift(effectiveOffset), paint);
377+
barPath.addRect(box.toRect().shift(effectiveOffset));
377378
}
379+
canvas.drawPath(barPath, paint);
378380
}
379381

380382
void _layoutText(float minWidth = 0.0f, float maxWidth = float.PositiveInfinity) {

0 commit comments

Comments
 (0)