mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Make most Au methods take self by value. (It’s a i32 wrapper.)
This commit is contained in:
parent
4f618c45a5
commit
5f0c55cefb
1 changed files with 7 additions and 7 deletions
|
@ -203,39 +203,39 @@ impl Au {
|
||||||
|
|
||||||
/// Rounds this app unit down to the pixel towards zero and returns it.
|
/// Rounds this app unit down to the pixel towards zero and returns it.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_px(&self) -> i32 {
|
pub fn to_px(self) -> i32 {
|
||||||
self.0 / 60
|
self.0 / 60
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Rounds this app unit down to the previous (left or top) pixel and returns it.
|
/// Rounds this app unit down to the previous (left or top) pixel and returns it.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_prev_px(&self) -> i32 {
|
pub fn to_prev_px(self) -> i32 {
|
||||||
((self.0 as f64) / 60f64).floor() as i32
|
((self.0 as f64) / 60f64).floor() as i32
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Rounds this app unit up to the next (right or bottom) pixel and returns it.
|
/// Rounds this app unit up to the next (right or bottom) pixel and returns it.
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_next_px(&self) -> i32 {
|
pub fn to_next_px(self) -> i32 {
|
||||||
((self.0 as f64) / 60f64).ceil() as i32
|
((self.0 as f64) / 60f64).ceil() as i32
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_nearest_px(&self) -> i32 {
|
pub fn to_nearest_px(self) -> i32 {
|
||||||
((self.0 as f64) / 60f64).round() as i32
|
((self.0 as f64) / 60f64).round() as i32
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_f32_px(&self) -> f32 {
|
pub fn to_f32_px(self) -> f32 {
|
||||||
(self.0 as f32) / 60f32
|
(self.0 as f32) / 60f32
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_f64_px(&self) -> f64 {
|
pub fn to_f64_px(self) -> f64 {
|
||||||
(self.0 as f64) / 60f64
|
(self.0 as f64) / 60f64
|
||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn to_snapped(&self) -> Au {
|
pub fn to_snapped(self) -> Au {
|
||||||
let res = self.0 % 60i32;
|
let res = self.0 % 60i32;
|
||||||
return if res >= 30i32 { return Au(self.0 - res + 60i32) }
|
return if res >= 30i32 { return Au(self.0 - res + 60i32) }
|
||||||
else { return Au(self.0 - res) };
|
else { return Au(self.0 - res) };
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue