Commit 62e78bf
authored
Improve
Improves `TextPainter.layout` caching when only the input constraints change:
- removes the double layout calls in `TextPainter._layoutParagraph`: now double layout is only needed when `TextAlign` is not left, and the input `maxWidth == double.infinity`.
- skip calls to `ui.Paragraph.layout` when it's guaranteed that there's no soft line breaks before/after the layout call.
This doesn't introduce new APIs but may slightly shift text rendered on screen.
This reduces the number of `layout` calls but since shaping results are already cached so it only skips the relatively cheap line-breaking process when possible.
528 scuba failures but all of them seem reasonable.TextPainter.layout caching (#118128)1 parent 4d1c6a4 commit 62e78bf
File tree
5 files changed
+431
-170
lines changed- packages/flutter
- lib/src
- material
- painting
- test
- material
- painting
- widgets
5 files changed
+431
-170
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1129 | 1129 | | |
1130 | 1130 | | |
1131 | 1131 | | |
| 1132 | + | |
1132 | 1133 | | |
1133 | 1134 | | |
1134 | 1135 | | |
| |||
1137 | 1138 | | |
1138 | 1139 | | |
1139 | 1140 | | |
1140 | | - | |
| 1141 | + | |
1141 | 1142 | | |
1142 | 1143 | | |
1143 | | - | |
| 1144 | + | |
1144 | 1145 | | |
1145 | 1146 | | |
1146 | 1147 | | |
1147 | | - | |
1148 | | - | |
1149 | | - | |
1150 | | - | |
1151 | | - | |
1152 | | - | |
1153 | | - | |
1154 | | - | |
1155 | | - | |
1156 | | - | |
1157 | | - | |
1158 | | - | |
| 1148 | + | |
| 1149 | + | |
| 1150 | + | |
| 1151 | + | |
| 1152 | + | |
| 1153 | + | |
| 1154 | + | |
| 1155 | + | |
1159 | 1156 | | |
1160 | 1157 | | |
1161 | 1158 | | |
| |||
0 commit comments