Checkpoint

This commit is contained in:
Antonio Scandurra
2023-09-23 15:56:40 -06:00
parent 1fa45c69d6
commit b516ea2fe2
3 changed files with 33 additions and 22 deletions
+21 -12
View File
@@ -305,18 +305,6 @@ impl Mul<f32> for Pixels {
}
}
#[derive(
Clone, Copy, Debug, Default, Add, AddAssign, Sub, SubAssign, Div, PartialEq, PartialOrd,
)]
#[repr(transparent)]
pub struct DevicePixels(pub(crate) u32);
impl From<DevicePixels> for u32 {
fn from(device_pixels: DevicePixels) -> Self {
device_pixels.0
}
}
impl Pixels {
pub fn round(&self) -> Self {
Self(self.0.round())
@@ -388,6 +376,27 @@ impl From<Pixels> for f64 {
}
}
#[derive(
Clone, Copy, Debug, Default, Add, AddAssign, Sub, SubAssign, Div, PartialEq, PartialOrd,
)]
#[repr(transparent)]
pub struct DevicePixels(pub(crate) u32);
unsafe impl bytemuck::Pod for DevicePixels {}
unsafe impl bytemuck::Zeroable for DevicePixels {}
impl From<DevicePixels> for u32 {
fn from(device_pixels: DevicePixels) -> Self {
device_pixels.0
}
}
impl From<u32> for DevicePixels {
fn from(val: u32) -> Self {
DevicePixels(val)
}
}
#[derive(Clone, Copy, Default, Add, Sub, Mul, Div)]
pub struct Rems(f32);