diff --git a/components/gfx/font_context.rs b/components/gfx/font_context.rs index d02d798ca2c..4ccdfbbc01b 100644 --- a/components/gfx/font_context.rs +++ b/components/gfx/font_context.rs @@ -36,13 +36,13 @@ use azure::scaled_font::FontInfo; #[cfg(any(target_os="linux", target_os = "android"))] fn create_scaled_font(template: &Arc, pt_size: Au) -> ScaledFont { ScaledFont::new(BackendType::Skia, FontInfo::FontData(&template.bytes), - pt_size.to_f64_px() as AzFloat) + pt_size.to_f32_px()) } #[cfg(target_os="macos")] fn create_scaled_font(template: &Arc, pt_size: Au) -> ScaledFont { let cgfont = template.ctfont.as_ref().unwrap().copy_to_CGFont(); - ScaledFont::new(BackendType::Skia, &cgfont, pt_size.to_f64_px() as AzFloat) + ScaledFont::new(BackendType::Skia, &cgfont, pt_size.to_f32_px()) } static SMALL_CAPS_SCALE_FACTOR: f32 = 0.8; // Matches FireFox (see gfxFont.h) diff --git a/components/gfx/paint_context.rs b/components/gfx/paint_context.rs index 0aadd9c16b4..7160a31971b 100644 --- a/components/gfx/paint_context.rs +++ b/components/gfx/paint_context.rs @@ -826,16 +826,16 @@ impl<'a> PaintContext<'a> { let baseline_origin = match text.orientation { Upright => text.baseline_origin, SidewaysLeft => { - let x = text.baseline_origin.x.to_f64_px() as AzFloat; - let y = text.baseline_origin.y.to_f64_px() as AzFloat; + let x = text.baseline_origin.x.to_f32_px(); + let y = text.baseline_origin.y.to_f32_px(); self.draw_target.set_transform(&draw_target_transform.mul(&Matrix2D::new(0., -1., 1., 0., x, y))); Point2D::zero() } SidewaysRight => { - let x = text.baseline_origin.x.to_f64_px() as AzFloat; - let y = text.baseline_origin.y.to_f64_px() as AzFloat; + let x = text.baseline_origin.x.to_f32_px(); + let y = text.baseline_origin.y.to_f32_px(); self.draw_target.set_transform(&draw_target_transform.mul(&Matrix2D::new(0., 1., -1., 0., x, y))); @@ -1112,7 +1112,7 @@ impl ToAzurePoint for Point2D { Point2D(self.x.to_nearest_px() as AzFloat, self.y.to_nearest_px() as AzFloat) } fn to_f64_px_azure_point(&self) -> Point2D { - Point2D(self.x.to_f64_px() as AzFloat, self.y.to_f64_px() as AzFloat) + Point2D(self.x.to_f32_px(), self.y.to_f32_px()) } } @@ -1128,8 +1128,8 @@ impl ToAzureRect for Rect { } fn to_f64_px_azure_rect(&self) -> Rect { - Rect(self.origin.to_f64_px_azure_point(), Size2D(self.size.width.to_f64_px() as AzFloat, - self.size.height.to_f64_px() as AzFloat)) + Rect(self.origin.to_f64_px_azure_point(), Size2D(self.size.width.to_f32_px(), + self.size.height.to_f32_px())) } } @@ -1241,8 +1241,8 @@ impl ScaledFontExtensionMethods for ScaledFont { let azglyph = struct__AzGlyph { mIndex: glyph.id() as uint32_t, mPosition: struct__AzPoint { - x: (origin.x + glyph_offset.x).to_f64_px() as AzFloat, - y: (origin.y + glyph_offset.y).to_f64_px() as AzFloat + x: (origin.x + glyph_offset.x).to_f32_px(), + y: (origin.y + glyph_offset.y).to_f32_px(), } }; origin = Point2D(origin.x + glyph_advance, origin.y); diff --git a/components/gfx/paint_task.rs b/components/gfx/paint_task.rs index 1a2dcd18f1a..1ad7bf54006 100644 --- a/components/gfx/paint_task.rs +++ b/components/gfx/paint_task.rs @@ -546,8 +546,8 @@ impl WorkerThread { // Apply a translation to start at the boundaries of the stacking context, since the // layer's origin starts at its overflow rect's origin. let tile_bounds = tile.page_rect.translate( - &Point2D(stacking_context.overflow.origin.x.to_f64_px() as AzFloat, - stacking_context.overflow.origin.y.to_f64_px() as AzFloat)); + &Point2D(stacking_context.overflow.origin.x.to_f32_px(), + stacking_context.overflow.origin.y.to_f32_px())); // Apply the translation to paint the tile we want. let matrix: Matrix2D = Matrix2D::identity();