mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
auto merge of #5251 : mmatyas/servo/canvas_quadratic, r=jdm
Yet another small canvas patch.
This commit is contained in:
commit
2c85c1d312
4 changed files with 16 additions and 10 deletions
|
@ -29,6 +29,7 @@ pub enum CanvasMsg {
|
|||
Fill,
|
||||
MoveTo(Point2D<f32>),
|
||||
LineTo(Point2D<f32>),
|
||||
QuadraticCurveTo(Point2D<f32>, Point2D<f32>),
|
||||
BezierCurveTo(Point2D<f32>, Point2D<f32>, Point2D<f32>),
|
||||
Arc(Point2D<f32>, f32, f32, f32, bool),
|
||||
SetFillStyle(FillOrStrokeStyle),
|
||||
|
@ -81,6 +82,9 @@ impl<'a> CanvasPaintTask<'a> {
|
|||
CanvasMsg::Fill => painter.fill(),
|
||||
CanvasMsg::MoveTo(ref point) => painter.move_to(point),
|
||||
CanvasMsg::LineTo(ref point) => painter.line_to(point),
|
||||
CanvasMsg::QuadraticCurveTo(ref cp, ref pt) => {
|
||||
painter.quadratic_curve_to(cp, pt)
|
||||
}
|
||||
CanvasMsg::BezierCurveTo(ref cp1, ref cp2, ref pt) => {
|
||||
painter.bezier_curve_to(cp1, cp2, pt)
|
||||
}
|
||||
|
@ -151,6 +155,12 @@ impl<'a> CanvasPaintTask<'a> {
|
|||
self.path_builder.line_to(*point)
|
||||
}
|
||||
|
||||
fn quadratic_curve_to(&self,
|
||||
cp: &Point2D<AzFloat>,
|
||||
endpoint: &Point2D<AzFloat>) {
|
||||
self.path_builder.quadratic_curve_to(cp, endpoint)
|
||||
}
|
||||
|
||||
fn bezier_curve_to(&self,
|
||||
cp1: &Point2D<AzFloat>,
|
||||
cp2: &Point2D<AzFloat>,
|
||||
|
|
|
@ -157,6 +157,11 @@ impl<'a> CanvasRenderingContext2DMethods for JSRef<'a, CanvasRenderingContext2D>
|
|||
self.renderer.send(CanvasMsg::LineTo(Point2D(x as f32, y as f32))).unwrap();
|
||||
}
|
||||
|
||||
fn QuadraticCurveTo(self, cpx: f64, cpy: f64, x: f64, y: f64) {
|
||||
self.renderer.send(CanvasMsg::QuadraticCurveTo(Point2D(cpx as f32, cpy as f32),
|
||||
Point2D(x as f32, y as f32))).unwrap();
|
||||
}
|
||||
|
||||
fn BezierCurveTo(self, cp1x: f64, cp1y: f64, cp2x: f64, cp2y: f64, x: f64, y: f64) {
|
||||
self.renderer.send(CanvasMsg::BezierCurveTo(Point2D(cp1x as f32, cp1y as f32),
|
||||
Point2D(cp2x as f32, cp2y as f32),
|
||||
|
|
|
@ -126,7 +126,7 @@ interface CanvasPathMethods {
|
|||
void closePath();
|
||||
void moveTo(/*unrestricted*/ double x, /*unrestricted*/ double y);
|
||||
void lineTo(double x, double y);
|
||||
//void quadraticCurveTo(double cpx, double cpy, double x, double y);
|
||||
void quadraticCurveTo(double cpx, double cpy, double x, double y);
|
||||
|
||||
void bezierCurveTo(/*unrestricted*/ double cp1x,
|
||||
/*unrestricted*/ double cp1y,
|
||||
|
|
|
@ -7104,9 +7104,6 @@
|
|||
[CanvasRenderingContext2D interface: attribute direction]
|
||||
expected: FAIL
|
||||
|
||||
[CanvasRenderingContext2D interface: operation quadraticCurveTo(unrestricted double,unrestricted double,unrestricted double,unrestricted double)]
|
||||
expected: FAIL
|
||||
|
||||
[CanvasRenderingContext2D interface: operation arcTo(unrestricted double,unrestricted double,unrestricted double,unrestricted double,unrestricted double)]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -7350,12 +7347,6 @@
|
|||
[CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "direction" with the proper type (69)]
|
||||
expected: FAIL
|
||||
|
||||
[CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "quadraticCurveTo" with the proper type (73)]
|
||||
expected: FAIL
|
||||
|
||||
[CanvasRenderingContext2D interface: calling quadraticCurveTo(unrestricted double,unrestricted double,unrestricted double,unrestricted double) on document.createElement("canvas").getContext("2d") with too few arguments must throw TypeError]
|
||||
expected: FAIL
|
||||
|
||||
[CanvasRenderingContext2D interface: document.createElement("canvas").getContext("2d") must inherit property "arcTo" with the proper type (75)]
|
||||
expected: FAIL
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue