summaryrefslogtreecommitdiffstats
path: root/wgpu/src/geometry.rs
diff options
context:
space:
mode:
authorLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-09-07 05:51:39 +0200
committerLibravatar Héctor Ramón Jiménez <hector0193@gmail.com>2023-09-07 05:51:39 +0200
commit09965b686ea6bf82e6c13ed5331bbeb059848e4f (patch)
treef19bfc7558c874c981ddb7d8a2046858bd04a6b8 /wgpu/src/geometry.rs
parent1f263051b6c2d2f2a02633d8a6277c772ae8e7f9 (diff)
downloadiced-09965b686ea6bf82e6c13ed5331bbeb059848e4f.tar.gz
iced-09965b686ea6bf82e6c13ed5331bbeb059848e4f.tar.bz2
iced-09965b686ea6bf82e6c13ed5331bbeb059848e4f.zip
Make `scale` methods in `Frame` generic over `f32` and `Vector`
Diffstat (limited to 'wgpu/src/geometry.rs')
-rw-r--r--wgpu/src/geometry.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/wgpu/src/geometry.rs b/wgpu/src/geometry.rs
index 64b98469..c3e16f8c 100644
--- a/wgpu/src/geometry.rs
+++ b/wgpu/src/geometry.rs
@@ -446,13 +446,17 @@ impl Frame {
/// Applies a uniform scaling to the current transform of the [`Frame`].
#[inline]
- pub fn scale(&mut self, scale: f32) {
+ pub fn scale(&mut self, scale: impl Into<f32>) {
+ let scale = scale.into();
+
self.scale_nonuniform(Vector { x: scale, y: scale });
}
/// Applies a non-uniform scaling to the current transform of the [`Frame`].
#[inline]
- pub fn scale_nonuniform(&mut self, scale: Vector) {
+ pub fn scale_nonuniform(&mut self, scale: impl Into<Vector>) {
+ let scale = scale.into();
+
self.transforms.current.raw =
self.transforms.current.raw.pre_scale(scale.x, scale.y);
self.transforms.current.is_identity = false;