diff options
author | 2023-10-24 05:34:03 +0200 | |
---|---|---|
committer | 2024-02-02 02:24:45 +0100 | |
commit | f4d66486016076bb339a338bc589645119962d1e (patch) | |
tree | bbb9c4d996216893296cf4323857323542d6e757 /wgpu/src/text.rs | |
parent | a6e91d13d5d43796d0e6bb570fb4f010cf27921a (diff) | |
download | iced-f4d66486016076bb339a338bc589645119962d1e.tar.gz iced-f4d66486016076bb339a338bc589645119962d1e.tar.bz2 iced-f4d66486016076bb339a338bc589645119962d1e.zip |
Introduce `with_transformation` to `Renderer` trait
Diffstat (limited to 'wgpu/src/text.rs')
-rw-r--r-- | wgpu/src/text.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/wgpu/src/text.rs b/wgpu/src/text.rs index 4a151073..cffe57cb 100644 --- a/wgpu/src/text.rs +++ b/wgpu/src/text.rs @@ -1,5 +1,5 @@ use crate::core::alignment; -use crate::core::{Rectangle, Size}; +use crate::core::{Rectangle, Size, Transformation}; use crate::graphics::color; use crate::graphics::text::cache::{self, Cache}; use crate::graphics::text::{font_system, to_color, Editor, Paragraph}; @@ -124,13 +124,13 @@ impl Pipeline { vertical_alignment, color, clip_bounds, - scale, + transformation, ) = match section { Text::Paragraph { position, color, clip_bounds, - scale, + transformation, .. } => { use crate::core::text::Paragraph as _; @@ -147,14 +147,14 @@ impl Pipeline { paragraph.vertical_alignment(), *color, *clip_bounds, - *scale, + *transformation, ) } Text::Editor { position, color, clip_bounds, - scale, + transformation, .. } => { use crate::core::text::Editor as _; @@ -171,7 +171,7 @@ impl Pipeline { alignment::Vertical::Top, *color, *clip_bounds, - *scale, + *transformation, ) } Text::Cached(text) => { @@ -191,7 +191,7 @@ impl Pipeline { text.vertical_alignment, text.color, text.clip_bounds, - 1.0, + Transformation::IDENTITY, ) } Text::Raw(text) => { @@ -211,12 +211,12 @@ impl Pipeline { alignment::Vertical::Top, text.color, text.clip_bounds, - 1.0, + Transformation::IDENTITY, ) } }; - let bounds = bounds * scale_factor; + let bounds = bounds * transformation * scale_factor; let left = match horizontal_alignment { alignment::Horizontal::Left => bounds.x, @@ -241,7 +241,7 @@ impl Pipeline { buffer, left, top, - scale: scale * scale_factor, + scale: scale_factor * transformation.scale_factor(), bounds: glyphon::TextBounds { left: clip_bounds.x as i32, top: clip_bounds.y as i32, |