Skip to content
Permalink
Browse files

Add pixel-snapping method to Au.

  • Loading branch information
Brian J. Burg
Brian J. Burg committed Nov 21, 2012
1 parent e1d4045 commit a9fdbf0c669082ee7bd9a60352c0607fab819d8d
Showing with 6 additions and 0 deletions.
  1. +6 −0 src/servo-gfx/geometry.rs
@@ -52,6 +52,12 @@ impl Au {
(**self / 60) as int
}

pub pure fn to_snapped(&const self) -> Au {
let res = **self % 60i32;
return if res >= 30i32 { return Au(**self - res + 60i32) }
else { return Au(**self - res) };
}

static pub pure fn zero_point() -> Point2D<Au> {
Point2D(Au(0), Au(0))
}

0 comments on commit a9fdbf0

Please sign in to comment.
You can’t perform that action at this time.