diff options
author | Simon Sapin <simon.sapin@exyr.org> | 2015-05-05 18:43:12 +0200 |
---|---|---|
committer | Simon Sapin <simon.sapin@exyr.org> | 2015-05-05 18:43:12 +0200 |
commit | 5f0c55cefb0c24a235ddbba05176c40f4799d007 (patch) | |
tree | 1d573da32017afa428f4a357cbe2a992c4589ef6 /components/util/geometry.rs | |
parent | 4f618c45a51b5ccd84b6114abd8ceebfa6e1811f (diff) | |
download | servo-5f0c55cefb0c24a235ddbba05176c40f4799d007.tar.gz servo-5f0c55cefb0c24a235ddbba05176c40f4799d007.zip |
Make most Au methods take self by value. (It’s a i32 wrapper.)
Diffstat (limited to 'components/util/geometry.rs')
-rw-r--r-- | components/util/geometry.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/components/util/geometry.rs b/components/util/geometry.rs index c8f021895fb..ae149c5162e 100644 --- a/components/util/geometry.rs +++ b/components/util/geometry.rs @@ -203,39 +203,39 @@ impl Au { /// Rounds this app unit down to the pixel towards zero and returns it. #[inline] - pub fn to_px(&self) -> i32 { + pub fn to_px(self) -> i32 { self.0 / 60 } /// Rounds this app unit down to the previous (left or top) pixel and returns it. #[inline] - pub fn to_prev_px(&self) -> i32 { + pub fn to_prev_px(self) -> i32 { ((self.0 as f64) / 60f64).floor() as i32 } /// Rounds this app unit up to the next (right or bottom) pixel and returns it. #[inline] - pub fn to_next_px(&self) -> i32 { + pub fn to_next_px(self) -> i32 { ((self.0 as f64) / 60f64).ceil() as i32 } #[inline] - pub fn to_nearest_px(&self) -> i32 { + pub fn to_nearest_px(self) -> i32 { ((self.0 as f64) / 60f64).round() as i32 } #[inline] - pub fn to_f32_px(&self) -> f32 { + pub fn to_f32_px(self) -> f32 { (self.0 as f32) / 60f32 } #[inline] - pub fn to_f64_px(&self) -> f64 { + pub fn to_f64_px(self) -> f64 { (self.0 as f64) / 60f64 } #[inline] - pub fn to_snapped(&self) -> Au { + pub fn to_snapped(self) -> Au { let res = self.0 % 60i32; return if res >= 30i32 { return Au(self.0 - res + 60i32) } else { return Au(self.0 - res) }; |