mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Add pixel-snapping method to Au.
This commit is contained in:
parent
e1d4045399
commit
a9fdbf0c66
1 changed files with 6 additions and 0 deletions
|
@ -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))
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue