Skip to content

PhotoCraft: An open-source, photo editor written by scratch in pure Rust

test(gpu): cover clipped Dissolve opacity and fill parity

Nigel Ihza Firdausy2ef53bb673b7
diff --git a/crates/gpu/tests/parity.rs b/crates/gpu/tests/parity.rs
index 474a6e8e8..b40d3786a 100644
--- a/crates/gpu/tests/parity.rs
+++ b/crates/gpu/tests/parity.rs
@@ -735,6 +735,19 @@ fn groups_masks_and_clipping() {
d.layers.extend([base, c1, c2]);
check(&mut g, &d, &format!("clipping hidden={hidden}"));
}
+ // #3052/#4921: a clipped Dissolve layer retains opacity/fill binary coverage
+ // across the partially covered clipping base; the GPU must match the CPU.
+ for (opacity, fill) in [(0.4, 1.0), (0.8, 0.5)] {
+ let mut d = base_doc(56, 44);
+ let base = noise_layer("base", PixelFormat::RGBA8, Rect::new(5, 6, 48, 40), 45, 0.0);
+ let mut clip = noise_layer("dissolve clip", PixelFormat::RGBA8, d.bounds(), 46, 0.0);
+ clip.clipped = true;
+ clip.blend = BlendMode::Dissolve;
+ clip.opacity = opacity;
+ clip.fill_opacity = fill;
+ d.layers.extend([base, clip]);
+ check(&mut g, &d, "clipped Dissolve opacity/fill CPU/GPU parity");
+ }
// Clipped group base (isolated) with a clipped layer.
let mut d = base_doc(56, 44);
let mut gb = Layer::group("gb", vec![child(18, BlendMode::Normal)]);