From 8a2d35fcd24e6e1853ceef7d55ec5c3140d5eb48 Mon Sep 17 00:00:00 2001 From: David Mann Date: Thu, 22 Oct 2026 20:15:16 +0200 Subject: [PATCH] Integration: an unchanged dialog keeps a baked overlay's exact ends (#7335) After merging main, the Layer Style dialog always sends From/To as 8-bit hex (#7072). On a baked Gradient Overlay without a source record (PSD or .asl import) the custom and no-record paths wrote those hex ends back, so OK without a change rounded the curve's ends (a Smooth bake's white end 0.99999994 became 1.0, Lab ends became RGB). Like edit_endpoint for the recorded source, a hex end that only repeats the current end is now left out. baked_overlay_is_unchanged_until_method_selection_then_edits_ the_whole_curve fails without this. Co-authored-by: oRE-o <42003350+oRE-o@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 (1M context) --- .../src/layer_style/gradient_overlay.rs | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/crates/engine/src/layer_style/gradient_overlay.rs b/crates/engine/src/layer_style/gradient_overlay.rs index 9caf82f714..8736597e08 100644 --- a/crates/engine/src/layer_style/gradient_overlay.rs +++ b/crates/engine/src/layer_style/gradient_overlay.rs @@ -19,6 +19,24 @@ fn edit_endpoint(stop: Option<&mut (f32, Color)>, params: &Value, key: &str) { } } +/// `params` without a `from`/`to` hex string that only repeats the gradient's current end as the +/// dialog shows it (8-bit): confirming the dialog unchanged must not quantize a baked or +/// imported curve's exact ends (as `edit_endpoint` guards the recorded source). +fn without_unchanged_ends(gradient: &Gradient, params: &Value) -> Value { + let mut params = params.clone(); + for (key, end) in [("from", gradient.stops.first()), ("to", gradient.stops.last())] { + let shown = |c: &Color| { + let [r, g, b, _] = c.to_rgba8(); + [r, g, b] + }; + let same = params.get(key).is_some_and(Value::is_string) && end.zip(color_of(¶ms, key)).is_some_and(|(end, color)| shown(&end.1) == shown(&color)); + if same && let Some(object) = params.as_object_mut() { + object.remove(key); + } + } + params +} + /// Edits recorded source stops, initializing legacy curves from their end colours. pub(super) fn overlay(gradient: &mut Gradient, interpolation: &mut Option, params: &Value) { // Reset to Default restores the factory's unbaked interpolation too. @@ -26,12 +44,12 @@ pub(super) fn overlay(gradient: &mut Gradient, interpolation: &mut Option