Create new subpath with origin after drawing rect

Step 4 has been missing.
https://html.spec.whatwg.org/multipage/canvas.html#dom-context-2d-rect
This commit is contained in:
pylbrecht 2020-01-19 09:23:18 +01:00
parent 77c07a26fd
commit 3c7205c99f
4 changed files with 11 additions and 18 deletions

View file

@ -143,11 +143,12 @@ impl<'a> PathBuilderRef<'a> {
),
Point2D::new(rect.origin.x, rect.origin.y + rect.size.height),
);
self.builder.move_to(self.transform.transform_point(first));
self.builder.line_to(self.transform.transform_point(second));
self.builder.line_to(self.transform.transform_point(third));
self.builder.line_to(self.transform.transform_point(fourth));
self.builder.close();
self.move_to(&first);
self.line_to(&second);
self.line_to(&third);
self.line_to(&fourth);
self.close();
self.move_to(&first);
}
fn quadratic_curve_to(&mut self, cp: &Point2D<f32>, endpoint: &Point2D<f32>) {
@ -210,6 +211,10 @@ impl<'a> PathBuilderRef<'a> {
None => None,
}
}
fn close(&mut self) {
self.builder.close();
}
}
// TODO(pylbrecht)
@ -573,7 +578,7 @@ impl<'a> CanvasData<'a> {
}
pub fn close_path(&mut self) {
self.path_builder().builder.close();
self.path_builder().close();
}
fn ensure_path(&mut self) {

View file

@ -1,4 +0,0 @@
[2d.path.rect.zero.4.html]
[Canvas test: 2d.path.rect.zero.4]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.path.rect.zero.4.html]
[OffscreenCanvas test: 2d.path.rect.zero.4]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.path.rect.zero.4.worker.html]
[2d]
expected: FAIL