diff --git a/crates/engine/src/tests/build.rs b/crates/engine/src/tests/build.rs index 91c1ad7814..46821e7173 100644 --- a/crates/engine/src/tests/build.rs +++ b/crates/engine/src/tests/build.rs @@ -7737,7 +7737,8 @@ fn image_trace_views_draw_on_screen_only_and_expand_to_the_result() { } /// Outline views draw the traced paths' outlines and leave out an Abutting trace's seam fills -/// (their clipping box and strokes, or on a stretched image the strokes' filled outlines). +/// (their clipping box and strokes, or on a stretched image the strokes' filled outlines), renamed +/// too. #[test] fn image_trace_outline_view_leaves_out_the_seam_fills() { // Red beside blue in the middle of a transparent 60 × 40 image, placed at 50, 50 and scaled 2×, @@ -7769,6 +7770,14 @@ fn image_trace_outline_view_leaves_out_the_seam_fills() { } // The art's left edge (x = 70) is outlined. assert!((68..=72).any(|x| screen.pixel(x, 90)[0] < 128), "{scale:?}"); + // Beside the red and blue paths' shared edge (x = 110), inside the seam band (1.5 units + // each side on the stretched image) but off the traced outlines (x = 109 and 110): nothing. + for x in [108, 111] { + assert!(screen.pixel(x, 100)[0] > 245, "{scale:?}, x = {x}: {:?}", screen.pixel(x, 100)); + } + // Renamed, the group is still left out: the view draws as it did. + s.execute("layer.setProps", &json!({"id": seams.id.0, "name": "Edges"})).unwrap(); + assert!(render_doc(&s, true).pixels == screen.pixels, "{scale:?}: renamed seam fills drawn"); } } diff --git a/crates/render/src/renderer/nodes.rs b/crates/render/src/renderer/nodes.rs index d259e637f1..8e18b3a045 100644 --- a/crates/render/src/renderer/nodes.rs +++ b/crates/render/src/renderer/nodes.rs @@ -653,19 +653,20 @@ impl Renderer { if view.shows_outlines() { let opts = RenderOptions { outline: true, ..f.opts.clone() }; let frame = Frame { opts: &opts, ..*f }; - // An Abutting trace's seam fills hold no traced outline: a clip group named "Seam Fills" - // of paths that are each stroked without a fill or (on a stretched image, the strokes' - // outlines) filled without a stroke. - let seam_fills = |c: &Arc| { + // An Abutting trace's seam fills hold no traced outline: a clip group of paths that are + // each stroked without a fill or (on a stretched image, the strokes' outlines) filled + // without a stroke, named "Seam Fills" or, renamed, still the lowest shape, where the + // trace puts it. + let seam_fills = |i: usize, c: &Arc| { let one_paint = |m: &Arc| { matches!(m.kind, NodeKind::Path { .. } | NodeKind::Compound { .. }) && m.appearance.fill_paint().is_none() != m.appearance.stroke_paint().is_none() }; - c.name.as_deref() == Some("Seam Fills") + (i == 0 || c.name.as_deref() == Some("Seam Fills")) && matches!(&c.kind, NodeKind::Group { clip: true, children } if children.split_first().is_some_and(|(_, members)| !members.is_empty() && members.iter().all(one_paint))) }; - for c in shapes.iter().filter(|c| !seam_fills(c)) { + for (_, c) in shapes.iter().enumerate().filter(|(i, c)| !seam_fills(*i, c)) { self.draw_outline_member(ctx, &frame, c); } }