Skip to content

Commit

Permalink
Add pixel-snapping method to Au.
Browse files Browse the repository at this point in the history
  • Loading branch information
Brian J. Burg committed Nov 21, 2012
1 parent e1d4045 commit a9fdbf0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/servo-gfx/geometry.rs
Expand Up @@ -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))
}
Expand Down

0 comments on commit a9fdbf0

Please sign in to comment.