Skip to content

Commit e48b275

Browse files
authored
Auto merge of #421 - pcwalton:canvas-nested-clip-paths, r=pcwalton
Allow clip paths to nest in the canvas API. Closes #372.
2 parents 37a3285 + c8a6d8e commit e48b275

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

canvas/src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,8 +358,11 @@ impl CanvasRenderingContext2D {
358358

359359
let mut clip_path = ClipPath::new(outline);
360360
clip_path.set_fill_rule(fill_rule);
361-
let clip_path_id = self.canvas.scene.push_clip_path(clip_path);
361+
if let Some(existing_clip_path) = self.current_state.clip_path.take() {
362+
clip_path.set_clip_path(Some(existing_clip_path));
363+
}
362364

365+
let clip_path_id = self.canvas.scene.push_clip_path(clip_path);
363366
self.current_state.clip_path = Some(clip_path_id);
364367
}
365368

0 commit comments

Comments
 (0)