From db716b3bdf039b38fe7dcb17776cae7803d47d24 Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Tue, 5 Nov 2019 05:26:20 +0100 Subject: Apply HiDPI to text, images, and clip primitives Quads are a bit trickier to handle. We may need to change the shaders a bit. --- wgpu/src/transformation.rs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'wgpu/src/transformation.rs') diff --git a/wgpu/src/transformation.rs b/wgpu/src/transformation.rs index b0d14cc8..52165387 100644 --- a/wgpu/src/transformation.rs +++ b/wgpu/src/transformation.rs @@ -26,6 +26,11 @@ impl Transformation { pub fn translate(x: f32, y: f32) -> Transformation { Transformation(Mat4::from_translation(Vec3::new(x, y, 0.0))) } + + /// Creates a scale transformation. + pub fn scale(x: f32, y: f32) -> Transformation { + Transformation(Mat4::from_scale(Vec3::new(x, y, 0.0))) + } } impl Mul for Transformation { -- cgit From 6216f197e927aef0993a36c1bb094c7f917d54dd Mon Sep 17 00:00:00 2001 From: Héctor Ramón Jiménez Date: Wed, 6 Nov 2019 19:35:28 +0100 Subject: Fix panic in `Transformation::scale` --- wgpu/src/transformation.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'wgpu/src/transformation.rs') diff --git a/wgpu/src/transformation.rs b/wgpu/src/transformation.rs index 52165387..c8a7ee75 100644 --- a/wgpu/src/transformation.rs +++ b/wgpu/src/transformation.rs @@ -29,7 +29,7 @@ impl Transformation { /// Creates a scale transformation. pub fn scale(x: f32, y: f32) -> Transformation { - Transformation(Mat4::from_scale(Vec3::new(x, y, 0.0))) + Transformation(Mat4::from_scale(Vec3::new(x, y, 1.0))) } } -- cgit