aboutsummaryrefslogtreecommitdiffstats
path: root/components/util/geometry.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/util/geometry.rs')
-rw-r--r--components/util/geometry.rs40
1 files changed, 0 insertions, 40 deletions
diff --git a/components/util/geometry.rs b/components/util/geometry.rs
index fb39cfd9919..d14b1808f83 100644
--- a/components/util/geometry.rs
+++ b/components/util/geometry.rs
@@ -3,7 +3,6 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use cssparser::ToCss;
-use euclid::length::Length;
use euclid::num::Zero;
use euclid::point::Point2D;
use euclid::rect::Rect;
@@ -205,29 +204,12 @@ impl Au {
Au((px * AU_PER_PX) as i32)
}
- #[inline]
- pub fn from_page_px(px: Length<PagePx, f32>) -> Au {
- Au((px.get() * (AU_PER_PX as f32)) as i32)
- }
-
/// Rounds this app unit down to the pixel towards zero and returns it.
#[inline]
pub fn to_px(self) -> i32 {
self.0 / AU_PER_PX
}
- /// Rounds this app unit down to the previous (left or top) pixel and returns it.
- #[inline]
- pub fn to_prev_px(self) -> i32 {
- ((self.0 as f64) / (AU_PER_PX as f64)).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 {
- ((self.0 as f64) / (AU_PER_PX as f64)).ceil() as i32
- }
-
#[inline]
pub fn to_nearest_px(self) -> i32 {
((self.0 as f64) / (AU_PER_PX as f64)).round() as i32
@@ -249,38 +231,16 @@ impl Au {
}
#[inline]
- pub fn to_snapped(self) -> Au {
- let res = self.0 % AU_PER_PX;
- return if res >= 30i32 { return Au(self.0 - res + AU_PER_PX) }
- else { return Au(self.0 - res) };
- }
-
- #[inline]
pub fn from_f32_px(px: f32) -> Au {
Au((px * (AU_PER_PX as f32)) as i32)
}
#[inline]
- pub fn from_pt(pt: f64) -> Au {
- Au::from_f64_px(pt_to_px(pt))
- }
-
- #[inline]
pub fn from_f64_px(px: f64) -> Au {
Au((px * (AU_PER_PX as f64)) as i32)
}
}
-// assumes 72 points per inch, and 96 px per inch
-pub fn pt_to_px(pt: f64) -> f64 {
- pt / 72. * 96.
-}
-
-// assumes 72 points per inch, and 96 px per inch
-pub fn px_to_pt(px: f64) -> f64 {
- px / 96. * 72.
-}
-
/// Returns true if the rect contains the given point. Points on the top or left sides of the rect
/// are considered inside the rectangle, while points on the right or bottom sides of the rect are
/// not considered inside the rectangle.