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. --- core/src/rectangle.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'core/src') diff --git a/core/src/rectangle.rs b/core/src/rectangle.rs index 95c2570c..c3191677 100644 --- a/core/src/rectangle.rs +++ b/core/src/rectangle.rs @@ -28,3 +28,16 @@ impl Rectangle { && point.y <= self.y + self.height } } + +impl std::ops::Mul for Rectangle { + type Output = Self; + + fn mul(self, scale: f32) -> Self { + Self { + x: (self.x as f32 * scale).round() as u32, + y: (self.y as f32 * scale).round() as u32, + width: (self.width as f32 * scale).round() as u32, + height: (self.height as f32 * scale).round() as u32, + } + } +} -- cgit