mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
parent
186ab5aa24
commit
9333f028e8
5 changed files with 133 additions and 80 deletions
|
@ -236,6 +236,11 @@ impl Au {
|
|||
((self.0 as f64) / (AU_PER_PX as f64)).round() as i32
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn to_nearest_pixel(self, pixels_per_px: f32) -> f32 {
|
||||
((self.0 as f32) / (AU_PER_PX as f32) * pixels_per_px).round() / pixels_per_px
|
||||
}
|
||||
|
||||
#[inline]
|
||||
pub fn to_f32_px(self) -> f32 {
|
||||
(self.0 as f32) / (AU_PER_PX as f32)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue