Split text measurements cache from rendering cache
This speeds up layouting in the most common scenario considerably!
🎉
This commit is contained in:
parent
d4d14b68f4
commit
860a6923bb
9 changed files with 53 additions and 24 deletions
|
|
@ -22,7 +22,7 @@ impl text::Renderer for Renderer {
|
|||
};
|
||||
|
||||
let (width, height) = if let Some(bounds) =
|
||||
self.glyph_brush.borrow_mut().glyph_bounds(§ion)
|
||||
self.text_measurements.borrow_mut().glyph_bounds(§ion)
|
||||
{
|
||||
(bounds.width().ceil(), bounds.height().ceil())
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ impl text_input::Renderer for Renderer {
|
|||
.to_string();
|
||||
|
||||
let mut text_value_width = self
|
||||
.glyph_brush
|
||||
.text_measurements
|
||||
.borrow_mut()
|
||||
.glyph_bounds(Section {
|
||||
text: text_before_cursor,
|
||||
|
|
@ -94,7 +94,7 @@ impl text_input::Renderer for Renderer {
|
|||
|
||||
if spaces_at_the_end > 0 {
|
||||
let space_width = {
|
||||
let glyph_brush = self.glyph_brush.borrow();
|
||||
let glyph_brush = self.text_measurements.borrow();
|
||||
|
||||
// TODO: Select appropriate font
|
||||
let font = &glyph_brush.fonts()[0];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue