Skip to content

Commit

Permalink
Allow clip paths to nest in the canvas API.
Browse files Browse the repository at this point in the history
  • Loading branch information
pcwalton committed Jul 28, 2020
1 parent 4c8699a commit c8a6d8e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion canvas/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,8 +358,11 @@ impl CanvasRenderingContext2D {

let mut clip_path = ClipPath::new(outline);
clip_path.set_fill_rule(fill_rule);
let clip_path_id = self.canvas.scene.push_clip_path(clip_path);
if let Some(existing_clip_path) = self.current_state.clip_path.take() {
clip_path.set_clip_path(Some(existing_clip_path));
}

let clip_path_id = self.canvas.scene.push_clip_path(clip_path);
self.current_state.clip_path = Some(clip_path_id);
}

Expand Down

0 comments on commit c8a6d8e

Please sign in to comment.