summaryrefslogtreecommitdiffstats
path: root/wgpu/src/layer.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2023-10-24 05:34:03 +0200
committerLibravatar Héctor Ramón Jiménez <hector@hecrj.dev>2024-02-02 02:24:45 +0100
commitf4d66486016076bb339a338bc589645119962d1e (patch)
treebbb9c4d996216893296cf4323857323542d6e757 /wgpu/src/layer.rs
parenta6e91d13d5d43796d0e6bb570fb4f010cf27921a (diff)
downloadiced-f4d66486016076bb339a338bc589645119962d1e.tar.gz
iced-f4d66486016076bb339a338bc589645119962d1e.tar.bz2
iced-f4d66486016076bb339a338bc589645119962d1e.zip
Introduce `with_transformation` to `Renderer` trait
Diffstat (limited to 'wgpu/src/layer.rs')
-rw-r--r--wgpu/src/layer.rs20
1 files changed, 11 insertions, 9 deletions
diff --git a/wgpu/src/layer.rs b/wgpu/src/layer.rs
index 4a2e72df..12588849 100644
--- a/wgpu/src/layer.rs
+++ b/wgpu/src/layer.rs
@@ -12,10 +12,12 @@ pub use text::Text;
use crate::core;
use crate::core::alignment;
-use crate::core::{Color, Font, Pixels, Point, Rectangle, Size, Vector};
+use crate::core::{
+ Color, Font, Pixels, Point, Rectangle, Size, Transformation, Vector,
+};
use crate::graphics;
use crate::graphics::color;
-use crate::graphics::{Transformation, Viewport};
+use crate::graphics::Viewport;
use crate::primitive::{self, Primitive};
use crate::quad::{self, Quad};
@@ -130,10 +132,10 @@ impl<'a> Layer<'a> {
layer.text.push(Text::Paragraph {
paragraph: paragraph.clone(),
- position: *position * transformation,
+ position: *position,
color: *color,
- clip_bounds: *clip_bounds * transformation,
- scale: transformation.scale_factor(),
+ clip_bounds: *clip_bounds,
+ transformation,
});
}
Primitive::Editor {
@@ -146,10 +148,10 @@ impl<'a> Layer<'a> {
layer.text.push(Text::Editor {
editor: editor.clone(),
- position: *position * transformation,
+ position: *position,
color: *color,
- clip_bounds: *clip_bounds * transformation,
- scale: transformation.scale_factor(),
+ clip_bounds: *clip_bounds,
+ transformation,
});
}
Primitive::Text {
@@ -168,7 +170,7 @@ impl<'a> Layer<'a> {
layer.text.push(Text::Cached(text::Cached {
content,
- bounds: *bounds * transformation,
+ bounds: *bounds + transformation.translation(),
size: *size * transformation.scale_factor(),
line_height: *line_height,
color: *color,