Round results for scale_by and to_px.

This fixes the acid1 size issues where boxes were 1px too narrow.
This commit is contained in:
Jack Moffitt 2013-08-23 17:11:24 -06:00
parent d70178da86
commit a3d5ca35a0

View file

@ -82,7 +82,7 @@ pub fn box<T:Clone + Ord + Add<T,T> + Sub<T,T>>(x: T, y: T, w: T, h: T) -> Rect<
impl Au { impl Au {
pub fn scale_by(self, factor: float) -> Au { pub fn scale_by(self, factor: float) -> Au {
Au(((*self as float) * factor) as i32) Au(((*self as float) * factor).round() as i32)
} }
pub fn from_px(px: int) -> Au { pub fn from_px(px: int) -> Au {
@ -90,7 +90,7 @@ impl Au {
} }
pub fn to_px(&self) -> int { pub fn to_px(&self) -> int {
(**self / 60) as int ((**self as float) / 60f).round() as int
} }
pub fn to_snapped(&self) -> Au { pub fn to_snapped(&self) -> Au {