diff options
author | 2023-10-24 02:51:02 +0200 | |
---|---|---|
committer | 2024-02-02 01:55:32 +0100 | |
commit | aa41d7656e734b5dae3c19dff87afbc74617a67f (patch) | |
tree | 2b2a074998ed5d39e2901d25627a295d3dfb24d4 /wgpu | |
parent | 9b8614a4e2252f0b74d1a1b38b5e5bb55b1af995 (diff) | |
download | iced-aa41d7656e734b5dae3c19dff87afbc74617a67f.tar.gz iced-aa41d7656e734b5dae3c19dff87afbc74617a67f.tar.bz2 iced-aa41d7656e734b5dae3c19dff87afbc74617a67f.zip |
Apply `Transform` scaling to text primitives
Diffstat (limited to 'wgpu')
-rw-r--r-- | wgpu/src/layer.rs | 2 | ||||
-rw-r--r-- | wgpu/src/text.rs | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/wgpu/src/layer.rs b/wgpu/src/layer.rs index fd5f2345..82e8ba02 100644 --- a/wgpu/src/layer.rs +++ b/wgpu/src/layer.rs @@ -169,7 +169,7 @@ impl<'a> Layer<'a> { layer.text.push(Text::Cached(text::Cached { content, bounds: *bounds * transformation, - size: *size, + size: *size * transformation.scale_y(), line_height: *line_height, color: *color, font: *font, diff --git a/wgpu/src/text.rs b/wgpu/src/text.rs index dca09cb8..4a151073 100644 --- a/wgpu/src/text.rs +++ b/wgpu/src/text.rs @@ -124,11 +124,13 @@ impl Pipeline { vertical_alignment, color, clip_bounds, + scale, ) = match section { Text::Paragraph { position, color, clip_bounds, + scale, .. } => { use crate::core::text::Paragraph as _; @@ -145,12 +147,14 @@ impl Pipeline { paragraph.vertical_alignment(), *color, *clip_bounds, + *scale, ) } Text::Editor { position, color, clip_bounds, + scale, .. } => { use crate::core::text::Editor as _; @@ -167,6 +171,7 @@ impl Pipeline { alignment::Vertical::Top, *color, *clip_bounds, + *scale, ) } Text::Cached(text) => { @@ -186,6 +191,7 @@ impl Pipeline { text.vertical_alignment, text.color, text.clip_bounds, + 1.0, ) } Text::Raw(text) => { @@ -205,6 +211,7 @@ impl Pipeline { alignment::Vertical::Top, text.color, text.clip_bounds, + 1.0, ) } }; @@ -234,7 +241,7 @@ impl Pipeline { buffer, left, top, - scale: scale_factor, + scale: scale * scale_factor, bounds: glyphon::TextBounds { left: clip_bounds.x as i32, top: clip_bounds.y as i32, |