This commit is contained in:
Antonio Scandurra 2023-11-29 18:18:15 +01:00
parent 3ac545088a
commit a4035f15af
2 changed files with 43 additions and 54 deletions

View file

@ -965,6 +965,18 @@ impl From<u64> for DevicePixels {
}
}
impl From<DevicePixels> for usize {
fn from(device_pixels: DevicePixels) -> Self {
device_pixels.0 as usize
}
}
impl From<usize> for DevicePixels {
fn from(device_pixels: usize) -> Self {
DevicePixels(device_pixels as i32)
}
}
#[derive(Clone, Copy, Default, Add, AddAssign, Sub, SubAssign, Div, PartialEq, PartialOrd)]
#[repr(transparent)]
pub struct ScaledPixels(pub(crate) f32);