gfx: Fix imprecision in float_to_fixed.

Improves text rendering a lot.
This commit is contained in:
Patrick Walton 2014-10-01 22:07:10 -07:00
parent f7d2fb6ff8
commit cdc59fe68a

View file

@ -110,7 +110,7 @@ pub fn transform_text(text: &str, mode: CompressionMode,
}
pub fn float_to_fixed(before: int, f: f64) -> i32 {
(1i32 << before as uint) * (f as i32)
((1i32 << before as uint) as f64 * f) as i32
}
pub fn fixed_to_float(before: int, f: i32) -> f64 {