mirror of
https://github.com/servo/servo.git
synced 2025-08-04 05:00:08 +01:00
Merge pull request #2763 from Ms2ger/azure-ctors
Replace bare constructor functions with 'new' static member functions in rust-azure; r=SimonSapin
This commit is contained in:
commit
e62637fee2
3 changed files with 13 additions and 13 deletions
|
@ -330,7 +330,7 @@ impl Font {
|
||||||
|
|
||||||
let target = rctx.get_draw_target();
|
let target = rctx.get_draw_target();
|
||||||
let azfontref = self.get_azure_font();
|
let azfontref = self.get_azure_font();
|
||||||
let pattern = ColorPattern(color);
|
let pattern = ColorPattern::new(color);
|
||||||
let azure_pattern = pattern.azure_color_pattern;
|
let azure_pattern = pattern.azure_color_pattern;
|
||||||
assert!(azure_pattern.is_not_null());
|
assert!(azure_pattern.is_not_null());
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ impl<'a> RenderContext<'a> {
|
||||||
|
|
||||||
pub fn draw_solid_color(&self, bounds: &Rect<Au>, color: Color) {
|
pub fn draw_solid_color(&self, bounds: &Rect<Au>, color: Color) {
|
||||||
self.draw_target.make_current();
|
self.draw_target.make_current();
|
||||||
self.draw_target.fill_rect(&bounds.to_azure_rect(), &ColorPattern(color), None);
|
self.draw_target.fill_rect(&bounds.to_azure_rect(), &ColorPattern::new(color), None);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn draw_border(&self,
|
pub fn draw_border(&self,
|
||||||
|
@ -115,8 +115,8 @@ impl<'a> RenderContext<'a> {
|
||||||
let source_rect = Rect(Point2D(0 as AzFloat, 0 as AzFloat),
|
let source_rect = Rect(Point2D(0 as AzFloat, 0 as AzFloat),
|
||||||
Size2D(image.width as AzFloat, image.height as AzFloat));
|
Size2D(image.width as AzFloat, image.height as AzFloat));
|
||||||
let dest_rect = bounds.to_azure_rect();
|
let dest_rect = bounds.to_azure_rect();
|
||||||
let draw_surface_options = DrawSurfaceOptions(Linear, true);
|
let draw_surface_options = DrawSurfaceOptions::new(Linear, true);
|
||||||
let draw_options = DrawOptions(1.0f64 as AzFloat, 0);
|
let draw_options = DrawOptions::new(1.0f64 as AzFloat, 0);
|
||||||
draw_target_ref.draw_surface(azure_surface,
|
draw_target_ref.draw_surface(azure_surface,
|
||||||
dest_rect,
|
dest_rect,
|
||||||
source_rect,
|
source_rect,
|
||||||
|
@ -125,12 +125,12 @@ impl<'a> RenderContext<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn clear(&self) {
|
pub fn clear(&self) {
|
||||||
let pattern = ColorPattern(Color(0.0, 0.0, 0.0, 0.0));
|
let pattern = ColorPattern::new(Color::new(0.0, 0.0, 0.0, 0.0));
|
||||||
let rect = Rect(Point2D(self.page_rect.origin.x as AzFloat,
|
let rect = Rect(Point2D(self.page_rect.origin.x as AzFloat,
|
||||||
self.page_rect.origin.y as AzFloat),
|
self.page_rect.origin.y as AzFloat),
|
||||||
Size2D(self.screen_rect.size.width as AzFloat,
|
Size2D(self.screen_rect.size.width as AzFloat,
|
||||||
self.screen_rect.size.height as AzFloat));
|
self.screen_rect.size.height as AzFloat));
|
||||||
let mut draw_options = DrawOptions(1.0, 0);
|
let mut draw_options = DrawOptions::new(1.0, 0);
|
||||||
draw_options.set_composition_op(SourceOp);
|
draw_options.set_composition_op(SourceOp);
|
||||||
self.draw_target.make_current();
|
self.draw_target.make_current();
|
||||||
self.draw_target.fill_rect(&rect, &pattern, Some(&draw_options));
|
self.draw_target.fill_rect(&rect, &pattern, Some(&draw_options));
|
||||||
|
@ -206,7 +206,7 @@ impl<'a> RenderContext<'a> {
|
||||||
let right_top = left_top + Point2D(bounds.size.width, 0.0);
|
let right_top = left_top + Point2D(bounds.size.width, 0.0);
|
||||||
let left_bottom = left_top + Point2D(0.0, bounds.size.height);
|
let left_bottom = left_top + Point2D(0.0, bounds.size.height);
|
||||||
let right_bottom = left_top + Point2D(bounds.size.width, bounds.size.height);
|
let right_bottom = left_top + Point2D(bounds.size.width, bounds.size.height);
|
||||||
let draw_opts = DrawOptions(1.0, 0);
|
let draw_opts = DrawOptions::new(1.0, 0);
|
||||||
let path_builder = self.draw_target.create_path_builder();
|
let path_builder = self.draw_target.create_path_builder();
|
||||||
match direction {
|
match direction {
|
||||||
Top => {
|
Top => {
|
||||||
|
@ -235,7 +235,7 @@ impl<'a> RenderContext<'a> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let path = path_builder.finish();
|
let path = path_builder.finish();
|
||||||
self.draw_target.fill(&path, &ColorPattern(color), &draw_opts);
|
self.draw_target.fill(&path, &ColorPattern::new(color), &draw_opts);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,8 +246,8 @@ impl<'a> RenderContext<'a> {
|
||||||
color: Color,
|
color: Color,
|
||||||
dash_size: DashSize) {
|
dash_size: DashSize) {
|
||||||
let rect = bounds.to_azure_rect();
|
let rect = bounds.to_azure_rect();
|
||||||
let draw_opts = DrawOptions(1 as AzFloat, 0 as uint16_t);
|
let draw_opts = DrawOptions::new(1 as AzFloat, 0 as uint16_t);
|
||||||
let mut stroke_opts = StrokeOptions(0 as AzFloat, 10 as AzFloat);
|
let mut stroke_opts = StrokeOptions::new(0 as AzFloat, 10 as AzFloat);
|
||||||
let mut dash: [AzFloat, ..2] = [0 as AzFloat, 0 as AzFloat];
|
let mut dash: [AzFloat, ..2] = [0 as AzFloat, 0 as AzFloat];
|
||||||
|
|
||||||
stroke_opts.set_cap_style(AZ_CAP_BUTT as u8);
|
stroke_opts.set_cap_style(AZ_CAP_BUTT as u8);
|
||||||
|
@ -294,7 +294,7 @@ impl<'a> RenderContext<'a> {
|
||||||
|
|
||||||
self.draw_target.stroke_line(start,
|
self.draw_target.stroke_line(start,
|
||||||
end,
|
end,
|
||||||
&ColorPattern(color),
|
&ColorPattern::new(color),
|
||||||
&stroke_opts,
|
&stroke_opts,
|
||||||
&draw_opts);
|
&draw_opts);
|
||||||
}
|
}
|
||||||
|
@ -321,7 +321,7 @@ impl<'a> RenderContext<'a> {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn scale_color(&self, color: Color, scale_factor: f32) -> Color {
|
fn scale_color(&self, color: Color, scale_factor: f32) -> Color {
|
||||||
return Color(color.r * scale_factor, color.g * scale_factor, color.b * scale_factor, color.a);
|
return Color::new(color.r * scale_factor, color.g * scale_factor, color.b * scale_factor, color.a);
|
||||||
}
|
}
|
||||||
|
|
||||||
fn draw_double_border_segment(&self, direction: Direction, bounds: &Rect<Au>, border: SideOffsets2D<f32>, color: Color) {
|
fn draw_double_border_segment(&self, direction: Direction, bounds: &Rect<Au>, border: SideOffsets2D<f32>, color: Color) {
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 9c71deb6575c1cf6664b19b415705af6c5f9b56f
|
Subproject commit 70dcf94bce5003d0dfead6e47b5c9159dc72a001
|
Loading…
Add table
Add a link
Reference in a new issue