Remove some unnecessary casts.

This commit is contained in:
Simon Sapin 2015-05-05 20:11:26 +02:00
parent 5f0c55cefb
commit 6bf830f663
3 changed files with 13 additions and 13 deletions

View file

@ -36,13 +36,13 @@ use azure::scaled_font::FontInfo;
#[cfg(any(target_os="linux", target_os = "android"))]
fn create_scaled_font(template: &Arc<FontTemplateData>, 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<FontTemplateData>, 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)

View file

@ -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<Au> {
Point2D(self.x.to_nearest_px() as AzFloat, self.y.to_nearest_px() as AzFloat)
}
fn to_f64_px_azure_point(&self) -> Point2D<AzFloat> {
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<Au> {
}
fn to_f64_px_azure_rect(&self) -> Rect<AzFloat> {
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);

View file

@ -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<AzFloat> = Matrix2D::identity();