mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Prevent redundant layouts when floor(width) is the same (flutter/engine#8867)
This commit is contained in:
parent
909ba9c7ba
commit
a18609ae0d
@ -477,13 +477,15 @@ void Paragraph::ComputeStrut(StrutMetrics* strut, SkFont& font) {
|
||||
}
|
||||
|
||||
void Paragraph::Layout(double width, bool force) {
|
||||
double rounded_width = floor(width);
|
||||
// Do not allow calling layout multiple times without changing anything.
|
||||
if (!needs_layout_ && width == width_ && !force) {
|
||||
if (!needs_layout_ && rounded_width == width_ && !force) {
|
||||
return;
|
||||
}
|
||||
needs_layout_ = false;
|
||||
|
||||
width_ = floor(width);
|
||||
width_ = rounded_width;
|
||||
|
||||
needs_layout_ = false;
|
||||
|
||||
if (!ComputeLineBreaks())
|
||||
return;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user