fix(atn): a Minimum / Maximum step with Preserve: Roundness is not exported as Squareness (#7233)

This commit is contained in:
Korg1ch
2026-10-19 21:37:21 +03:00
parent 3a896a5efc
commit 59b03f2948
+15 -3
View File
@@ -872,6 +872,11 @@ struct Event {
macro_rules! ev {
($code:literal, $name:literal, $label:literal, $id:literal, $fields:expr) => {
ev!($code, $name, $label, $id, $fields, unless | _ | false)
};
// `unless`: params the descriptor can't carry, so such a step isn't exported (it would replay
// differently) rather than losing them.
($code:literal, $name:literal, $label:literal, $id:literal, $fields:expr, unless $skip:expr) => {
Event {
code: $code,
name: $name,
@@ -881,11 +886,18 @@ macro_rules! ev {
Some(m) => step($id, Value::Object(m)),
None => Mapped::Unsupported { harmless: false },
},
to: |_, p| if pixel_target(p) { fields_to(p, $fields, desc("null")) } else { None },
to: |_, p| if pixel_target(p) && !($skip)(p) { fields_to(p, $fields, desc("null")) } else { None },
}
};
}
/// Minimum / Maximum with Preserve: Roundness. The descriptor here maps the radius only, and
/// Photoshop's encoding of the shape isn't verified, so such a step is not exported: it would
/// replay as the default Squareness (#7233).
fn preserves_roundness(p: &Value) -> bool {
p.get("preserve").and_then(Value::as_str) == Some("roundness")
}
/// Whether `p` edits the layer's pixels: no `"target"` or `"target":"pixels"`. Photoshop's
/// descriptor for a plain event has no field for a mask, Quick Mask or channel target, so such
/// a step can't be exported faithfully.
@@ -2718,8 +2730,8 @@ const EVENTS: &[Event] = &[
ev!("ShrM", "sharpenMore", "Sharpen More", "filter.sharpen.sharpenMore", &[]),
ev!("ShrE", "sharpenEdges", "Sharpen Edges", "filter.sharpen.sharpenEdges", &[]),
ev!("HghP", "highPass", "High Pass", "filter.other.highPass", &[F("Rds ", "radius", Kind::Px)]),
ev!("Mnm ", "minimum", "Minimum", "filter.other.minimum", &[F("Rds ", "radius", Kind::Px)]),
ev!("Mxm ", "maximum", "Maximum", "filter.other.maximum", &[F("Rds ", "radius", Kind::Px)]),
ev!("Mnm ", "minimum", "Minimum", "filter.other.minimum", &[F("Rds ", "radius", Kind::Px)], unless preserves_roundness),
ev!("Mxm ", "maximum", "Maximum", "filter.other.maximum", &[F("Rds ", "radius", Kind::Px)], unless preserves_roundness),
ev!(
"Ofst",
"offset",