diff options
author | 2023-08-30 05:06:08 +0200 | |
---|---|---|
committer | 2023-08-30 05:06:08 +0200 | |
commit | 89acf0217e0acd92a82bff1fd516cd4266c0878a (patch) | |
tree | 7ed80675520b67c02e1a171a2131100281d7c5d7 /wgpu/src/text.rs | |
parent | ed3454301e663a7cb7d73cd56b57b188f4d14a2f (diff) | |
download | iced-89acf0217e0acd92a82bff1fd516cd4266c0878a.tar.gz iced-89acf0217e0acd92a82bff1fd516cd4266c0878a.tar.bz2 iced-89acf0217e0acd92a82bff1fd516cd4266c0878a.zip |
Use `min_bounds` for cached text
Diffstat (limited to 'wgpu/src/text.rs')
-rw-r--r-- | wgpu/src/text.rs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/wgpu/src/text.rs b/wgpu/src/text.rs index da2062fe..ee352368 100644 --- a/wgpu/src/text.rs +++ b/wgpu/src/text.rs @@ -59,7 +59,7 @@ impl Pipeline { device: &wgpu::Device, queue: &wgpu::Queue, sections: &[Text<'_>], - bounds: Rectangle, + layer_bounds: Rectangle, scale_factor: f32, target_size: Size<u32>, ) { @@ -98,8 +98,8 @@ impl Pipeline { ), font: text.font, bounds: Size { - width: bounds.width, - height: bounds.height, + width: text.bounds.width, + height: text.bounds.height, }, shaping: text.shaping, }, @@ -110,7 +110,7 @@ impl Pipeline { }) .collect(); - let layer_bounds = bounds * scale_factor; + let layer_bounds = layer_bounds * scale_factor; let text_areas = sections.iter().zip(allocations.iter()).filter_map( |(section, allocation)| { @@ -144,11 +144,14 @@ impl Pipeline { return None; }; - let buffer = cache.get(key).expect("Get cached buffer"); + let entry = cache.get(key).expect("Get cached buffer"); ( - buffer, - text.bounds, + &entry.buffer, + Rectangle::new( + text.bounds.position(), + entry.min_bounds, + ), text.horizontal_alignment, text.vertical_alignment, text.color, |