From 5f0c55cefb0c24a235ddbba05176c40f4799d007 Mon Sep 17 00:00:00 2001 From: Simon Sapin Date: Tue, 5 May 2015 18:43:12 +0200 Subject: [PATCH] =?UTF-8?q?Make=20most=20Au=20methods=20take=20self=20by?= =?UTF-8?q?=20value.=20(It=E2=80=99s=20a=20i32=20wrapper.)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/util/geometry.rs | 14 +++++++------- 1 file 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) };