diff --git a/crates/render/src/fx/pixels.rs b/crates/render/src/fx/pixels.rs index 1f1b160ac..a49817cd0 100644 --- a/crates/render/src/fx/pixels.rs +++ b/crates/render/src/fx/pixels.rs @@ -382,7 +382,7 @@ impl Renderer { } /// The inputs a raster of `n`'s content, which reads `reads`, is drawn with in frame `f`: the - /// color settings, the edge smoothing, the document's raster effects resolution (which a + /// color settings, the edge smoothing, whether dashed strokes draw as solid lines, the document's raster effects resolution (which a /// Rasterize or De-Interlace anywhere in the content follows), the knockout `n` inherits and, /// while `n` holds the isolated group, isolation mode; the pattern definitions, symbols and /// brush library it reads; for images and placed documents their pixels and files, the @@ -398,6 +398,8 @@ impl Renderer { (doc.cms, f.opts.anti_alias.threshold(), self.knockout, f.doc.raster_effects_ppi.to_bits()).hash(&mut h); // Cached effects on containers can include paths made into guides. f.opts.hide_guides.hash(&mut h); + // Cached effects can include dashed strokes drawn as solid lines. + f.opts.solid_dashes.hash(&mut h); if let Some((isolated, path)) = self.isolation_path(f) && n.id != isolated && path.contains(&n.id) diff --git a/crates/render/src/tests.rs b/crates/render/src/tests.rs index 2a6a4872d..e171eecf6 100644 --- a/crates/render/src/tests.rs +++ b/crates/render/src/tests.rs @@ -1321,6 +1321,12 @@ fn solid_dashes_draw_dashed_strokes_as_solid_lines() { assert_eq!(draw(&line(true, shadow), true).pixels, solid.pixels, "the dashes go with the option (shadow: {shadow})"); assert_eq!(draw(&line(false, shadow), true).pixels, solid.pixels, "a solid stroke is unchanged (shadow: {shadow})"); } + // One renderer that draws the shadow both ways makes its raster again for each setting. + let (dashed, mut r) = (line(true, true), Renderer::new()); + let fresh = |solid: bool| draw(&dashed, solid).pixels; + for solid in [false, true, false] { + assert_eq!(r.render(&dashed, 100, 100, Affine::IDENTITY, &opts(solid)).pixels, fresh(solid), "reused renderer, solid: {solid}"); + } } /// An image that can't be decoded is counted on the thread that tried to decode it: an export