Recompose retained frames exactly and preserve text width validity
Keep each widget's original local frame and replay the same composition order on reuse. Remove inverse region remapping, including its fixed-frame fallback that forced otherwise valid subtrees to draw again. Require exact pixel-region equality in the shared generated oracle. Check primitive and mask geometry as well as draw reuse when fixed frames resize. Publish text's retained line-break range, with no upper bound when there are no soft breaks, and cover widening, explicit newlines, and empty text. Compared withefb416b, the depth-8 diagnostic rig performs 7-9% fewer widget evaluations in the affected phases. Uninstrumented release runs use 3.5% fewer instructions for size changes and 5.0% fewer for resize. Repaint and scroll use 0.7% and 0.6% more instructions. Container updates remain substantially more expensive than thee44dea3baseline; this is still an experimental continuation, not a production replacement.
This commit is contained in:
1 parent
efb416bbc3
commit
2ed5503717
7 files changed
+162
-203
No files matched your search
+4
-13
@@ -50,20 +50,11 @@ impl TextView {
|
||||
let width = self.attrs.wrap.then(|| painter.px_len(Axis::X));
|
||||
// The shaper measures in floats, which is where a glyph advance comes
|
||||
// from; what it answers goes back on the grid.
|
||||
let text = painter.render_text(&mut self.buf, &self.attrs, width.map(Px::to_f32));
|
||||
// A greedy break is the same break at every width from its longest
|
||||
// line up to the one it was made at: each line still fits, and none
|
||||
// could take a word that did not fit in the wider box. A line too
|
||||
// long to fit at all says nothing about narrower boxes.
|
||||
//
|
||||
// The step at or above that longest line rather than the nearest
|
||||
// one, since the shaper measures in floats: the nearest step is
|
||||
// under the line half the time, and a range starting there admits a
|
||||
// box the line does not fit in, where the break is not this one.
|
||||
if let Some(width) = width {
|
||||
painter.holds(Axis::X, Px::ceil_from_f32(text.size.x).min(width)..=width);
|
||||
painter.render_text(&mut self.buf, &self.attrs, width.map(Px::to_f32));
|
||||
if width.is_some() {
|
||||
painter.holds(Axis::X, self.buf.width_holds());
|
||||
}
|
||||
text
|
||||
self.buf.rendered().expect("render_text placed the glyphs")
|
||||
}
|
||||
|
||||
pub fn tex(&self) -> Option<&RenderedText> {
|
||||
|
||||
Reference in new issue
Block a user