diff options
author | 2019-11-05 05:26:20 +0100 | |
---|---|---|
committer | 2019-11-05 05:26:20 +0100 | |
commit | db716b3bdf039b38fe7dcb17776cae7803d47d24 (patch) | |
tree | 510f31387190d7e1b49e01610a651a39a9763106 /core | |
parent | 0157121038987feb6c2ea3066a21ce25e689888e (diff) | |
download | iced-db716b3bdf039b38fe7dcb17776cae7803d47d24.tar.gz iced-db716b3bdf039b38fe7dcb17776cae7803d47d24.tar.bz2 iced-db716b3bdf039b38fe7dcb17776cae7803d47d24.zip |
Apply HiDPI to text, images, and clip primitives
Quads are a bit trickier to handle. We may need to change the shaders a
bit.
Diffstat (limited to 'core')
-rw-r--r-- | core/src/rectangle.rs | 13 |
1 files changed, 13 insertions, 0 deletions
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<f32> { && point.y <= self.y + self.height } } + +impl std::ops::Mul<f32> for Rectangle<u32> { + 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, + } + } +} |