Add first control point if there's no subpath

This commit is contained in:
pylbrecht 2020-01-16 21:22:22 +01:00
parent 08461db4da
commit ca1e780c59
4 changed files with 5 additions and 14 deletions

View file

@ -771,8 +771,8 @@ impl<'a> CanvasData<'a> {
} }
pub fn quadratic_curve_to(&mut self, cp: &Point2D<f32>, endpoint: &Point2D<f32>) { pub fn quadratic_curve_to(&mut self, cp: &Point2D<f32>, endpoint: &Point2D<f32>) {
if self.path_builder().current_point().is_none() { if self.path_state.is_none() {
self.path_builder().move_to(cp); self.move_to(cp);
} }
self.path_builder().quadratic_curve_to(cp, endpoint); self.path_builder().quadratic_curve_to(cp, endpoint);
} }
@ -783,6 +783,9 @@ impl<'a> CanvasData<'a> {
cp2: &Point2D<f32>, cp2: &Point2D<f32>,
endpoint: &Point2D<f32>, endpoint: &Point2D<f32>,
) { ) {
if self.path_state.is_none() {
self.move_to(cp1);
}
self.path_builder().bezier_curve_to(cp1, cp2, endpoint); self.path_builder().bezier_curve_to(cp1, cp2, endpoint);
} }

View file

@ -1,4 +0,0 @@
[2d.path.bezierCurveTo.ensuresubpath.2.html]
[If there is no subpath, the first control point is added]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.path.bezierCurveTo.ensuresubpath.2.html]
[If there is no subpath, the first control point is added]
expected: FAIL

View file

@ -1,4 +0,0 @@
[2d.path.bezierCurveTo.ensuresubpath.2.worker.html]
[If there is no subpath, the first control point is added]
expected: FAIL