diff options
author | 2023-02-05 18:30:11 +0100 | |
---|---|---|
committer | 2023-02-24 13:36:02 +0100 | |
commit | f37b87fbabf09296ad7fea695baded25020d5fbc (patch) | |
tree | 0a14109e7a2e393dad1c3f704268557c655ab8f3 | |
parent | 6cf4a10906e777645b6bf47faf0e7b8f3c36549e (diff) | |
download | iced-f37b87fbabf09296ad7fea695baded25020d5fbc.tar.gz iced-f37b87fbabf09296ad7fea695baded25020d5fbc.tar.bz2 iced-f37b87fbabf09296ad7fea695baded25020d5fbc.zip |
Avoid allocating `text_areas` in `text::Pipeline`
-rw-r--r-- | wgpu/Cargo.toml | 2 | ||||
-rw-r--r-- | wgpu/src/text.rs | 11 |
2 files changed, 5 insertions, 8 deletions
diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index da8cdf9f..b3fbfc00 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -60,7 +60,7 @@ path = "../graphics" [dependencies.glyphon] version = "0.2" git = "https://github.com/hecrj/glyphon.git" -rev = "304dcaf8443bec7194891fdef3df468a6eaeb7d9" +rev = "3c2acb9dea5b9fcb0fa650b3c73b3a3242c62f4a" [dependencies.tracing] version = "0.1.6" diff --git a/wgpu/src/text.rs b/wgpu/src/text.rs index 59a840ca..e8c3e385 100644 --- a/wgpu/src/text.rs +++ b/wgpu/src/text.rs @@ -123,10 +123,8 @@ impl Pipeline { bottom: ((bounds.y + bounds.height) * scale_factor) as i32, }; - let text_areas: Vec<_> = sections - .iter() - .zip(keys.iter()) - .map(|(section, key)| { + let text_areas = + sections.iter().zip(keys.iter()).map(|(section, key)| { let buffer = fields .render_cache .get(key) @@ -163,8 +161,7 @@ impl Pipeline { top: top as i32, bounds, } - }) - .collect(); + }); renderer .prepare( @@ -175,7 +172,7 @@ impl Pipeline { width: target_size.width, height: target_size.height, }, - &text_areas, + text_areas, glyphon::Color::rgb(0, 0, 0), &mut glyphon::SwashCache::new(fields.fonts), ) |