Skip to content

Commit

Permalink
Partially fixed bugs with winding order.
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthewBlanchard committed May 20, 2021
1 parent 11d00db commit 5934ce4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/editor/operations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ impl Editor {
};

if let Some(closed) = skpaths.closed {
if let Some(result) = current_layer_group.op(&closed, pathop) {
if let Some(result) = current_layer_group.op(&closed, pathop).unwrap().as_winding() {
current_layer_group = result;
}
}
Expand Down
15 changes: 8 additions & 7 deletions src/renderer/glyph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,19 +65,20 @@ pub fn draw(canvas: &mut Canvas, v: &mut Editor, active_layer: usize) -> Path {
paint.set_color4f(color, None);
}

canvas.draw_path(&total_closed_path, &paint);

paint.set_style(PaintStyle::Stroke);
canvas.draw_path(&total_open_path, &paint);

if v.viewport.preview_mode != PreviewMode::Paper {
paint.set_color(OUTLINE_STROKE);
if let Some(color) = root_color {
paint.set_color4f(color, None);
}
canvas.draw_path(&total_closed_path, &paint);

paint.set_style(PaintStyle::Stroke);
canvas.draw_path(&total_open_path, &paint);
} else {
canvas.draw_path(&total_closed_path, &paint);
canvas.draw_path(&total_outline_path, &paint);

paint.set_style(PaintStyle::Stroke);
canvas.draw_path(&total_open_path, &paint);
}

total_open_path = Path::new();
Expand Down Expand Up @@ -113,7 +114,7 @@ pub fn draw(canvas: &mut Canvas, v: &mut Editor, active_layer: usize) -> Path {
total_outline_path.add_path(&closed, (0., 0.), skulpin::skia_safe::path::AddPathMode::Append);
if let Some(result) = total_closed_path.op(&closed, pathop) {
total_closed_path = Path::new();
total_closed_path.add_path(&result, (0., 0.), skulpin::skia_safe::path::AddPathMode::Append);
total_closed_path.add_path(&result.as_winding().unwrap(), (0., 0.), skulpin::skia_safe::path::AddPathMode::Append);
}
else
{
Expand Down

0 comments on commit 5934ce4

Please sign in to comment.