Avoid unnecessary Vec allocation in text pipeline
This commit is contained in:
parent
02fc7e6e89
commit
6b70771146
1 changed files with 5 additions and 7 deletions
|
|
@ -159,11 +159,6 @@ impl Pipeline {
|
||||||
})
|
})
|
||||||
.collect();
|
.collect();
|
||||||
|
|
||||||
let buffers: Vec<_> = keys
|
|
||||||
.iter()
|
|
||||||
.map(|key| self.render_cache.get(key).expect("Get cached buffer"))
|
|
||||||
.collect();
|
|
||||||
|
|
||||||
let bounds = glyphon::TextBounds {
|
let bounds = glyphon::TextBounds {
|
||||||
left: (bounds.x * scale_factor) as i32,
|
left: (bounds.x * scale_factor) as i32,
|
||||||
top: (bounds.y * scale_factor) as i32,
|
top: (bounds.y * scale_factor) as i32,
|
||||||
|
|
@ -173,8 +168,11 @@ impl Pipeline {
|
||||||
|
|
||||||
let text_areas: Vec<_> = sections
|
let text_areas: Vec<_> = sections
|
||||||
.iter()
|
.iter()
|
||||||
.zip(buffers.iter())
|
.zip(keys.iter())
|
||||||
.map(|(section, buffer)| {
|
.map(|(section, key)| {
|
||||||
|
let buffer =
|
||||||
|
self.render_cache.get(key).expect("Get cached buffer");
|
||||||
|
|
||||||
let x = section.bounds.x * scale_factor;
|
let x = section.bounds.x * scale_factor;
|
||||||
let y = section.bounds.y * scale_factor;
|
let y = section.bounds.y * scale_factor;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue