mirror of
https://github.com/servo/servo.git
synced 2025-06-06 16:45:39 +00:00
Auto merge of #5613 - mmatyas:canvas_miterlimit, r=jdm
This exposes some other canvas tests which were marked as PASS before. Two strokeRect related tests are fixed by #5612, and lineCap/lineJoin will have an implementation soon.
This commit is contained in:
commit
325899bfad
15 changed files with 38 additions and 48 deletions
|
@ -53,6 +53,7 @@ pub struct CanvasRenderingContext2D {
|
|||
image_smoothing_enabled: Cell<bool>,
|
||||
stroke_color: Cell<RGBA>,
|
||||
line_width: Cell<f64>,
|
||||
miter_limit: Cell<f64>,
|
||||
fill_color: Cell<RGBA>,
|
||||
transform: Cell<Matrix2D<f32>>,
|
||||
}
|
||||
|
@ -75,6 +76,7 @@ impl CanvasRenderingContext2D {
|
|||
image_smoothing_enabled: Cell::new(true),
|
||||
stroke_color: Cell::new(black),
|
||||
line_width: Cell::new(1.0),
|
||||
miter_limit: Cell::new(10.0),
|
||||
fill_color: Cell::new(black),
|
||||
transform: Cell::new(Matrix2D::identity()),
|
||||
}
|
||||
|
@ -816,6 +818,19 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
|
|||
self.line_width.set(width);
|
||||
self.renderer.send(CanvasMsg::SetLineWidth(width as f32)).unwrap()
|
||||
}
|
||||
|
||||
fn MiterLimit(self) -> f64 {
|
||||
self.miter_limit.get()
|
||||
}
|
||||
|
||||
fn SetMiterLimit(self, limit: f64) {
|
||||
if !limit.is_finite() || limit <= 0.0 {
|
||||
return;
|
||||
}
|
||||
|
||||
self.miter_limit.set(limit);
|
||||
self.renderer.send(CanvasMsg::SetMiterLimit(limit as f32)).unwrap()
|
||||
}
|
||||
}
|
||||
|
||||
#[unsafe_destructor]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue