mirror of
https://github.com/servo/servo.git
synced 2025-07-22 23:03:42 +01:00
auto merge of #5302 : mmatyas/servo/canvas_stroke, r=jdm
This is the servo side patch of servo/rust-azure#149.
This commit is contained in:
commit
f29ea4e4ef
46 changed files with 23 additions and 208 deletions
|
@ -26,6 +26,7 @@ pub enum CanvasMsg {
|
|||
BeginPath,
|
||||
ClosePath,
|
||||
Fill,
|
||||
Stroke,
|
||||
DrawImage(Vec<u8>, Rect<i32>, Rect<i32>, bool),
|
||||
DrawImageSelf(Size2D<i32>, Rect<i32>, Rect<i32>, bool),
|
||||
MoveTo(Point2D<f32>),
|
||||
|
@ -211,6 +212,7 @@ impl<'a> CanvasPaintTask<'a> {
|
|||
CanvasMsg::BeginPath => painter.begin_path(),
|
||||
CanvasMsg::ClosePath => painter.close_path(),
|
||||
CanvasMsg::Fill => painter.fill(),
|
||||
CanvasMsg::Stroke => painter.stroke(),
|
||||
CanvasMsg::DrawImage(imagedata, dest_rect, source_rect, smoothing_enabled) => {
|
||||
painter.draw_image(imagedata, dest_rect, source_rect, smoothing_enabled)
|
||||
}
|
||||
|
@ -284,6 +286,19 @@ impl<'a> CanvasPaintTask<'a> {
|
|||
};
|
||||
}
|
||||
|
||||
fn stroke(&self) {
|
||||
let draw_options = DrawOptions::new(1.0, 0);
|
||||
match self.stroke_style {
|
||||
Pattern::Color(ref color) => {
|
||||
self.drawtarget.stroke(&self.path_builder.finish(),
|
||||
color, &self.stroke_opts, &draw_options);
|
||||
}
|
||||
_ => {
|
||||
// TODO
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
fn draw_image(&self, imagedata: Vec<u8>, dest_rect: Rect<i32>,
|
||||
source_rect: Rect<i32>, smoothing_enabled: bool) {
|
||||
self.write_image(imagedata, source_rect, dest_rect, smoothing_enabled);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue