Canvas: added arcTo() support.

This commit is contained in:
Mátyás Mustoha 2015-03-26 16:43:34 +01:00
parent ba0d28e002
commit 56303e21cc
20 changed files with 81 additions and 76 deletions

View file

@ -477,6 +477,19 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
Ok(())
}
fn ArcTo(self, cp1x: f64, cp1y: f64, cp2x: f64, cp2y: f64, r: f64) -> Fallible<()> {
if !([cp1x, cp1y, cp2x, cp2y, r].iter().all(|x| x.is_finite())) {
return Ok(());
}
if r < 0.0 {
return Err(IndexSize);
}
self.renderer.send(CanvasMsg::ArcTo(Point2D(cp1x as f32, cp1y as f32),
Point2D(cp2x as f32, cp2y as f32),
r as f32)).unwrap();
Ok(())
}
// https://html.spec.whatwg.org/#dom-context-2d-imagesmoothingenabled
fn ImageSmoothingEnabled(self) -> bool {
self.image_smoothing_enabled.get()

View file

@ -145,7 +145,10 @@ interface CanvasPathMethods {
unrestricted double x,
unrestricted double y);
//void arcTo(double x1, double y1, double x2, double y2, double radius);
[Throws]
void arcTo(unrestricted double x1, unrestricted double y1,
unrestricted double x2, unrestricted double y2,
unrestricted double radius);
// NOT IMPLEMENTED [LenientFloat] void arcTo(double x1, double y1, double x2, double y2, double radiusX, double radiusY, double rotation);
//void rect(double x, double y, double w, double h);