aboutsummaryrefslogtreecommitdiffstats
path: root/components/util/geometry.rs
diff options
context:
space:
mode:
authorSimon Sapin <simon.sapin@exyr.org>2015-05-05 18:23:29 +0200
committerSimon Sapin <simon.sapin@exyr.org>2015-05-05 18:23:29 +0200
commit8b522f2e7d08aaf73429207cbbfd9da915f6d9a5 (patch)
treec4c7e7247ac5685aa4ec5048187132492b8eb6b9 /components/util/geometry.rs
parent32d5e24922e47322bf67c100fa4c178bc9b430f4 (diff)
downloadservo-8b522f2e7d08aaf73429207cbbfd9da915f6d9a5.tar.gz
servo-8b522f2e7d08aaf73429207cbbfd9da915f6d9a5.zip
Rename Au methods with f32/f64 instead of frac32/frac/subpx
Diffstat (limited to 'components/util/geometry.rs')
-rw-r--r--components/util/geometry.rs18
1 files changed, 9 insertions, 9 deletions
diff --git a/components/util/geometry.rs b/components/util/geometry.rs
index 515529ad2f7..684b06183f8 100644
--- a/components/util/geometry.rs
+++ b/components/util/geometry.rs
@@ -115,13 +115,13 @@ pub const MAX_AU: Au = Au(i32::MAX);
impl Encodable for Au {
fn encode<S: Encoder>(&self, e: &mut S) -> Result<(), S::Error> {
- e.emit_f64(self.to_subpx())
+ e.emit_f64(self.to_f64_px())
}
}
impl fmt::Debug for Au {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
- write!(f, "{}px", self.to_subpx())
+ write!(f, "{}px", self.to_f64_px())
}}
impl Add for Au {
@@ -238,13 +238,13 @@ impl Au {
}
#[inline]
- pub fn to_frac32_px(&self) -> f32 {
+ pub fn to_f32_px(&self) -> f32 {
let Au(s) = *self;
(s as f32) / 60f32
}
#[inline]
- pub fn to_subpx(&self) -> f64 {
+ pub fn to_f64_px(&self) -> f64 {
let Au(s) = *self;
(s as f64) / 60f64
}
@@ -258,17 +258,17 @@ impl Au {
}
#[inline]
- pub fn from_frac32_px(px: f32) -> Au {
+ pub fn from_f32_px(px: f32) -> Au {
Au((px * 60f32) as i32)
}
#[inline]
pub fn from_pt(pt: f64) -> Au {
- Au::from_frac_px(pt_to_px(pt))
+ Au::from_f64_px(pt_to_px(pt))
}
#[inline]
- pub fn from_frac_px(px: f64) -> Au {
+ pub fn from_f64_px(px: f64) -> Au {
Au((px * 60.) as i32)
}
}
@@ -293,7 +293,7 @@ pub fn rect_contains_point<T:PartialOrd + Add<T, Output=T>>(rect: Rect<T>, point
/// A helper function to convert a rect of `f32` pixels to a rect of app units.
pub fn f32_rect_to_au_rect(rect: Rect<f32>) -> Rect<Au> {
- Rect(Point2D(Au::from_frac32_px(rect.origin.x), Au::from_frac32_px(rect.origin.y)),
- Size2D(Au::from_frac32_px(rect.size.width), Au::from_frac32_px(rect.size.height)))
+ Rect(Point2D(Au::from_f32_px(rect.origin.x), Au::from_f32_px(rect.origin.y)),
+ Size2D(Au::from_f32_px(rect.size.width), Au::from_f32_px(rect.size.height)))
}