Split text measurements cache from rendering cache

This speeds up layouting in the most common scenario considerably!
🎉
This commit is contained in:
Héctor Ramón Jiménez 2019-11-11 06:07:31 +01:00
parent d4d14b68f4
commit 860a6923bb
9 changed files with 53 additions and 24 deletions

View file

@ -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];