From 5934ce4f464613f877f5789b69000a48ef3f09ef Mon Sep 17 00:00:00 2001 From: Matthew Blanchard Date: Thu, 20 May 2021 15:32:57 -0400 Subject: [PATCH] Partially fixed bugs with winding order. --- src/editor/operations.rs | 2 +- src/renderer/glyph.rs | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/editor/operations.rs b/src/editor/operations.rs index cdb0535a..38068eba 100644 --- a/src/editor/operations.rs +++ b/src/editor/operations.rs @@ -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; } } diff --git a/src/renderer/glyph.rs b/src/renderer/glyph.rs index 07e5489a..ba9b0133 100644 --- a/src/renderer/glyph.rs +++ b/src/renderer/glyph.rs @@ -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(); @@ -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 {