From 74687f3cea8a4edfda5946404af107a8b00cb3cd Mon Sep 17 00:00:00 2001 From: tydude001 Date: Thu, 22 Oct 2026 16:49:46 -0500 Subject: [PATCH 01/61] Single instance: private lock file, the CPU relaunch takes part, no stale instance.json (#3755 review) The three follow-ups from the #3755 review, on current main (with the Flatpak socket transport, #7626): - instance.lock is created 0600 (and the settings folder 0700 when single-instance creates it), and a lock file an earlier version left 0644 is narrowed. Another local user who could open it could hold the lock, and every launch would wait out its hand-off time and start on its own. - The CPU-compatibility relaunch (--safe-gpu with PHOTOCRAFT_GPU_STARTUP_FAILURE) takes part in single-instance. The failed launch has already shut its instance down, so the relaunch becomes the primary, and files opened later land in its window. - shutdown removes instance.json if this process wrote it, before the lock is released, so a later launch never reads an endpoint that has since been freed. A second shutdown (the drop) leaves the next primary's file alone. a_launch_waiting_on_a_closing_instance_takes_over now reads the next primary's endpoint before dropping it, since the drop removes the file. Co-Authored-By: Claude Opus 5.5 --- apps/photocraft/src/main.rs | 4 ++ apps/photocraft/src/single_instance.rs | 64 ++++++++++++++++++-- apps/photocraft/src/single_instance/tests.rs | 51 +++++++++++++++- 3 files changed, 111 insertions(+), 8 deletions(-) diff --git a/apps/photocraft/src/main.rs b/apps/photocraft/src/main.rs index 41d2faedee8..062954a58c0 100644 --- a/apps/photocraft/src/main.rs +++ b/apps/photocraft/src/main.rs @@ -224,6 +224,10 @@ fn claim_single_instance( // launch that sets only `PHOTOCRAFT_PRESENT_MODE` (say) has per-process options too, so it // keeps its own process instead of handing its files over and being ignored. launch_options.extend_from_slice(&single_instance::env_launch_options()); + // The CPU-compatibility relaunch's `--safe-gpu` is not a person's: it takes part. + if !single_instance::safe_gpu_is_launch_option(std::env::var_os("PHOTOCRAFT_GPU_STARTUP_FAILURE").as_deref()) { + launch_options.retain(|option| *option != launch_args::PerProcess::SafeGpu); + } let context = single_instance::LaunchContext { per_user_settings: app_dirs::current().mode == app_dirs::Mode::Platform, new_instance_flag: new_instance, diff --git a/apps/photocraft/src/single_instance.rs b/apps/photocraft/src/single_instance.rs index 4d836adc907..76cb0359925 100644 --- a/apps/photocraft/src/single_instance.rs +++ b/apps/photocraft/src/single_instance.rs @@ -29,9 +29,7 @@ use std::io::{BufReader, Read, Write}; use std::net::{Ipv4Addr, SocketAddr, TcpListener, TcpStream}; #[cfg(unix)] use std::os::unix::net::{UnixListener, UnixStream}; -use std::path::Path; -#[cfg(unix)] -use std::path::PathBuf; +use std::path::{Path, PathBuf}; use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering}; use std::sync::mpsc::{SyncSender, sync_channel}; use std::sync::{Arc, Mutex, PoisonError}; @@ -181,6 +179,13 @@ fn env_launch_options_from(get: impl Fn(&str) -> Option) -> ENV_LAUNCH_OPTIONS.iter().filter(|(name, _, is_on)| get(name).is_some_and(|v| is_on(&v.to_string_lossy()))).map(|(_, option, _)| *option).collect() } +/// Whether `--safe-gpu` keeps a launch out of single-instance. It does when a person passes it, but +/// not for the CPU-compatibility relaunch (which sets `PHOTOCRAFT_GPU_STARTUP_FAILURE`): that one +/// takes the place of a launch that has already shut its instance down. +pub fn safe_gpu_is_launch_option(gpu_startup_failure: Option<&std::ffi::OsStr>) -> bool { + gpu_startup_failure.is_none() +} + /// Why this launch runs as its own instance, or `None` to take part in single-instance. pub fn skip_reason(c: &LaunchContext) -> Option { if !c.per_user_settings { @@ -210,6 +215,8 @@ pub struct Primary { /// then, so the second call (`Drop`) can't remove the socket the next primary has bound. #[cfg(unix)] socket: Mutex>, + /// Where `instance.json` is, removed on [`Primary::shutdown`]. + dir: PathBuf, } struct Shared { @@ -255,7 +262,13 @@ impl Primary { if let Some(path) = self.socket.lock().unwrap_or_else(PoisonError::into_inner).take() { let _ = std::fs::remove_file(path); } - drop(self.lock.lock().unwrap_or_else(PoisonError::into_inner).take()); + let mut lock = self.lock.lock().unwrap_or_else(PoisonError::into_inner); + if let Some(file) = lock.take() { + // Before the lock goes, so the file can only be ours: a later launch never reads an + // endpoint that has since been freed (or taken by another program). + remove_info(&self.dir); + drop(file); + } } } @@ -324,11 +337,11 @@ pub fn claim_with(dir: &Path, paths: &[String], timing: Timing) -> Launch { /// once a quitting or crashed primary is gone) and then the running primary, wherever /// `instance.json` says it listens. pub fn claim_in(dir: &Path, paths: &[String], timing: Timing, transport: &Transport) -> Launch { - if let Err(e) = std::fs::create_dir_all(dir) { + if let Err(e) = create_private_dir(dir) { return Launch::Standalone(format!("{}: {e}", dir.display())); } let lock_path = dir.join(LOCK_FILE); - let lock = match OpenOptions::new().read(true).write(true).create(true).truncate(false).open(&lock_path) { + let lock = match open_lock(&lock_path) { Ok(lock) => lock, Err(e) => return Launch::Standalone(format!("{}: {e}", lock_path.display())), }; @@ -407,9 +420,39 @@ fn serve(dir: &Path, lock: File, timing: Timing, transport: &Transport) -> Resul shared, #[cfg(unix)] socket: Mutex::new(socket), + dir: dir.to_path_buf(), }) } +/// The settings folder, the user's alone (0700) on Unix when this is the first to create it. +fn create_private_dir(dir: &Path) -> std::io::Result<()> { + let mut builder = std::fs::DirBuilder::new(); + builder.recursive(true); + #[cfg(unix)] + std::os::unix::fs::DirBuilderExt::mode(&mut builder, 0o700); + builder.create(dir) +} + +/// `instance.lock`, the user's alone (0600) on Unix: another local user who could open it could +/// hold the lock, and every launch would then wait out its hand-off time and start on its own. +fn open_lock(path: &Path) -> std::io::Result { + let mut options = OpenOptions::new(); + options.read(true).write(true).create(true).truncate(false); + #[cfg(unix)] + std::os::unix::fs::OpenOptionsExt::mode(&mut options, 0o600); + let lock = options.open(path)?; + // The mode applies only on create: narrow a lock file an earlier version left readable. + #[cfg(unix)] + { + use std::os::unix::fs::PermissionsExt; + let wide = lock.metadata().is_ok_and(|m| m.permissions().mode() & 0o077 != 0); + if wide && let Err(e) = lock.set_permissions(std::fs::Permissions::from_mode(0o600)) { + log::warn!("{}: couldn't make it private: {e}", path.display()); + } + } + Ok(lock) +} + /// The primary's listener on either transport. enum Listener { Tcp(TcpListener), @@ -574,6 +617,15 @@ fn write_info(dir: &Path, endpoint: &Endpoint, token: &str) -> Result<(), String }) } +/// Remove `instance.json` if this process wrote it. +fn remove_info(dir: &Path) { + let path = dir.join(INFO_FILE); + let pid = std::fs::read(&path).ok().and_then(|b| serde_json::from_slice::(&b).ok()).and_then(|v| v.get("pid")?.as_u64()); + if pid == Some(u64::from(std::process::id())) { + let _ = std::fs::remove_file(&path); + } +} + fn read_info(dir: &Path) -> Option<(Endpoint, String)> { let v: Value = serde_json::from_slice(&std::fs::read(dir.join(INFO_FILE)).ok()?).ok()?; let token = v.get("token")?.as_str()?.to_string(); diff --git a/apps/photocraft/src/single_instance/tests.rs b/apps/photocraft/src/single_instance/tests.rs index dc5755719fa..4ba1369459b 100644 --- a/apps/photocraft/src/single_instance/tests.rs +++ b/apps/photocraft/src/single_instance/tests.rs @@ -128,9 +128,10 @@ fn a_launch_waiting_on_a_closing_instance_takes_over() { let waiting = launch(&dir, &["a.psd"], FAST); std::thread::sleep(Duration::from_millis(200)); primary.shutdown(); - assert!(matches!(waiting.join().unwrap(), Launch::Primary(_)), "the waiting launch becomes the primary"); - // After shutdown new connections are refused too. + let Launch::Primary(next) = waiting.join().unwrap() else { panic!("the waiting launch becomes the primary") }; + // After shutdown new connections are refused too. (Read before the drop, which removes the file.) let (endpoint, token) = read_info(&dir).unwrap(); + drop(next); drop(primary); let short = Instant::now() + Duration::from_millis(300); assert!(send(&endpoint, &token, &["b.psd".into()], short).is_err()); @@ -222,6 +223,52 @@ fn the_token_file_is_private_to_the_user() { let _ = std::fs::remove_dir_all(&dir); } +/// Follow-up to #3755, point 1: another local user can't open the lock, so can't hold it. +#[cfg(unix)] +#[test] +fn the_lock_file_and_a_new_settings_folder_are_private_to_the_user() { + use std::os::unix::fs::PermissionsExt; + let mode = |p: &Path| std::fs::metadata(p).unwrap().permissions().mode() & 0o777; + let dir = temp_dir("lock-mode").join("photocraft"); + let first = primary(&dir); + assert_eq!((mode(&dir), mode(&dir.join(LOCK_FILE))), (0o700, 0o600)); + drop(first); + // A lock file an earlier version created 0644 is narrowed on the next start. + std::fs::set_permissions(dir.join(LOCK_FILE), std::fs::Permissions::from_mode(0o644)).unwrap(); + let second = primary(&dir); + assert_eq!(mode(&dir.join(LOCK_FILE)), 0o600); + drop(second); + let _ = std::fs::remove_dir_all(dir.parent().unwrap()); +} + +/// Follow-up to #3755, point 3: a primary that shuts down takes its `instance.json` with it, +/// and a second `shutdown` (the drop) leaves the next primary's alone. +#[test] +fn shutdown_removes_the_instance_file_but_not_the_next_ones() { + let dir = temp_dir("info-cleanup"); + let first = primary(&dir); + assert!(read_info(&dir).is_some()); + first.shutdown(); + assert!(read_info(&dir).is_none(), "no endpoint left behind for a later launch"); + let second = primary(&dir); + let port = port_of(&dir); + drop(first); + assert_eq!(port_of(&dir), port, "the running primary's file stays"); + drop(second); + assert!(read_info(&dir).is_none()); + let _ = std::fs::remove_dir_all(&dir); +} + +/// Follow-up to #3755, point 2: the CPU-compatibility relaunch takes part in single-instance; +/// `--safe-gpu` given by a person still gets its own process. +#[test] +fn the_cpu_relaunch_takes_part_in_single_instance() { + assert!(safe_gpu_is_launch_option(None)); + assert!(!safe_gpu_is_launch_option(Some(std::ffi::OsStr::new("wgpu: no adapter")))); + // The relaunch sets the reason even when it is empty. + assert!(!safe_gpu_is_launch_option(Some(std::ffi::OsStr::new("")))); +} + #[test] fn an_unreachable_instance_falls_back_to_a_standalone_launch() { let dir = temp_dir("unreachable"); From f4125c46c82c026e299de9935b13755e41a7a861 Mon Sep 17 00:00:00 2001 From: tydude001 Date: Fri, 6 Nov 2026 13:40:17 -0600 Subject: [PATCH 02/61] Single instance: test the CPU relaunch's --safe-gpu filtering through skip_reason (#6654 review) The retain that drops the relaunch's own --safe-gpu moves from claim_single_instance to single_instance::without_relaunch_safe_gpu, so a test can run the filtering claim_single_instance applies and hand its result to skip_reason: the relaunch with only --safe-gpu takes part, a person's --safe-gpu keeps its own process, and a relaunch with another option drops only its --safe-gpu. --- apps/photocraft/src/main.rs | 4 +-- apps/photocraft/src/single_instance.rs | 9 ++++++ apps/photocraft/src/single_instance/tests.rs | 30 ++++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/apps/photocraft/src/main.rs b/apps/photocraft/src/main.rs index 062954a58c0..251c89a1889 100644 --- a/apps/photocraft/src/main.rs +++ b/apps/photocraft/src/main.rs @@ -225,9 +225,7 @@ fn claim_single_instance( // keeps its own process instead of handing its files over and being ignored. launch_options.extend_from_slice(&single_instance::env_launch_options()); // The CPU-compatibility relaunch's `--safe-gpu` is not a person's: it takes part. - if !single_instance::safe_gpu_is_launch_option(std::env::var_os("PHOTOCRAFT_GPU_STARTUP_FAILURE").as_deref()) { - launch_options.retain(|option| *option != launch_args::PerProcess::SafeGpu); - } + let launch_options = single_instance::without_relaunch_safe_gpu(launch_options, std::env::var_os("PHOTOCRAFT_GPU_STARTUP_FAILURE").as_deref()); let context = single_instance::LaunchContext { per_user_settings: app_dirs::current().mode == app_dirs::Mode::Platform, new_instance_flag: new_instance, diff --git a/apps/photocraft/src/single_instance.rs b/apps/photocraft/src/single_instance.rs index 76cb0359925..782b234e2b3 100644 --- a/apps/photocraft/src/single_instance.rs +++ b/apps/photocraft/src/single_instance.rs @@ -186,6 +186,15 @@ pub fn safe_gpu_is_launch_option(gpu_startup_failure: Option<&std::ffi::OsStr>) gpu_startup_failure.is_none() } +/// `options` without the `--safe-gpu` the CPU-compatibility relaunch adds; a person's stays +/// ([`safe_gpu_is_launch_option`]). Every other option is kept. +pub fn without_relaunch_safe_gpu(mut options: Vec, gpu_startup_failure: Option<&std::ffi::OsStr>) -> Vec { + if !safe_gpu_is_launch_option(gpu_startup_failure) { + options.retain(|option| *option != PerProcess::SafeGpu); + } + options +} + /// Why this launch runs as its own instance, or `None` to take part in single-instance. pub fn skip_reason(c: &LaunchContext) -> Option { if !c.per_user_settings { diff --git a/apps/photocraft/src/single_instance/tests.rs b/apps/photocraft/src/single_instance/tests.rs index 4ba1369459b..f608233c5a0 100644 --- a/apps/photocraft/src/single_instance/tests.rs +++ b/apps/photocraft/src/single_instance/tests.rs @@ -269,6 +269,36 @@ fn the_cpu_relaunch_takes_part_in_single_instance() { assert!(!safe_gpu_is_launch_option(Some(std::ffi::OsStr::new("")))); } +/// The filtering `claim_single_instance` applies, through to `skip_reason`: the relaunch's own +/// `--safe-gpu` takes part, a person's stays separate, and the relaunch keeps any other option. +#[test] +fn the_cpu_relaunch_filter_decides_who_takes_part() { + let check = |options: &[PerProcess], failure: Option<&str>| { + let launch_options = without_relaunch_safe_gpu(options.to_vec(), failure.map(std::ffi::OsStr::new)); + let context = LaunchContext { + per_user_settings: true, + new_instance_flag: false, + new_instance_env: None, + control: false, + unreadable_paths: false, + launch_options: &launch_options, + }; + (launch_options.clone(), skip_reason(&context)) + }; + // The CPU relaunch with no other options takes part, whatever its reason says. + for failure in ["wgpu: no adapter", ""] { + assert_eq!(check(&[PerProcess::SafeGpu], Some(failure)), (vec![], None)); + } + // A person's `--safe-gpu` keeps its own process. + let (kept, reason) = check(&[PerProcess::SafeGpu], None); + assert_eq!(kept, [PerProcess::SafeGpu]); + assert!(reason.is_some()); + // The relaunch drops only its own `--safe-gpu`: another option still keeps it separate. + let (kept, reason) = check(&[PerProcess::SafeGpu, PerProcess::GpuAdapterEnv], Some("wgpu: no adapter")); + assert_eq!(kept, [PerProcess::GpuAdapterEnv]); + assert!(reason.is_some()); +} + #[test] fn an_unreachable_instance_falls_back_to_a_standalone_launch() { let dir = temp_dir("unreachable"); From 9882c84dca6ac7fccc9b69ac5ac65829fd80b95d Mon Sep 17 00:00:00 2001 From: Hector Villarreal Date: Fri, 23 Oct 2026 22:59:10 -0600 Subject: [PATCH 03/61] Pencil: a 1 px curve has no holes where it bends (#9003) The 1 px Pencil steps pixel by pixel along each pointer segment, starting from that segment's own columns (or rows). Where the stroke bent, the first step of a segment could land two cells from the last step of the one before, leaving a hole. The walker now fills in the cells between two steps that are not neighbours, so the stroke stays 8-connected as in Photoshop. Straight lines are unchanged. Co-Authored-By: Claude Opus 5.5 --- crates/paint/src/brush_tests.rs | 37 +++++++++++++++++++++++++++++++++ docs/brush-parity.md | 5 +++-- 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/crates/paint/src/brush_tests.rs b/crates/paint/src/brush_tests.rs index 268ca52b95b..a924603b75f 100644 --- a/crates/paint/src/brush_tests.rs +++ b/crates/paint/src/brush_tests.rs @@ -283,6 +283,43 @@ fn pencil_1px_freehand_line_never_breaks_where_it_turns() { assert_eq!(reached.len(), painted.len(), "the line breaks along {path:?}"); } } + +#[test] +fn pencil_1px_curve_has_no_holes() { + // #9003: a curve drawn with the 1 px Pencil broke where it bent. Each segment steps from its + // own column, so a pixel could be skipped between the end of one segment and the next. + let b = BrushSettings { aliased: true, hardness: 1.0, size: 1.0, ..brush() }; + let curves: [Vec; 3] = [ + (0..70).map(|i| StrokePoint::new(6.0 + 0.75 * f64::from(i), 24.0 + 13.0 * (f64::from(i) / 7.0).sin(), 1.0)).collect(), + (0..60).map(|i| StrokePoint::new(30.0 + 20.0 * (f64::from(i) / 9.5).cos(), 24.0 + 14.0 * (f64::from(i) / 9.5).sin(), 1.0)).collect(), + vec![ + StrokePoint::new(4.3, 30.6, 1.0), + StrokePoint::new(9.8, 8.2, 1.0), + StrokePoint::new(15.1, 30.9, 1.0), + StrokePoint::new(27.6, 12.4, 1.0), + StrokePoint::new(33.2, 31.7, 1.0), + ], + ]; + for (k, pts) in curves.iter().enumerate() { + let s = paint(&b, pts, 64, 48); + let painted: std::collections::BTreeSet<(i32, i32)> = + (0..48).flat_map(|y| (0..64).map(move |x| (x, y))).filter(|&(x, y)| s.rgba(x, y)[3] > 0.0).collect(); + let Some(&start) = painted.iter().next() else { panic!("curve {k}: nothing painted") }; + let mut seen = std::collections::BTreeSet::from([start]); + let mut todo = vec![start]; + while let Some((x, y)) = todo.pop() { + for (dx, dy) in [(-1, -1), (0, -1), (1, -1), (-1, 0), (1, 0), (-1, 1), (0, 1), (1, 1)] { + let q = (x + dx, y + dy); + if painted.contains(&q) && seen.insert(q) { + todo.push(q); + } + } + } + let holes: Vec<_> = painted.difference(&seen).collect(); + assert!(holes.is_empty(), "curve {k}: the stroke breaks before {holes:?}"); + } +} + // ---------- spacing ---------- #[test] diff --git a/docs/brush-parity.md b/docs/brush-parity.md index acd93b311ec..0a94baa4a08 100644 --- a/docs/brush-parity.md +++ b/docs/brush-parity.md @@ -1,6 +1,6 @@ # Brush and painting parity -> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-07 · **Change:** minor (Angle/Roundness fields left of the Brush Tip Shape widget, labels right-aligned, #3825 partial; the eraser end of the pen switches to the Eraser on Windows with Windows Ink on, #2285; no estimate changed; Art History Brush Opacity on the options bar, #10263; no estimate changed; Shift+right-click menu for every painting tool: Edit Brush… and the tool's own Mode list; Brush Shift+right-click Mode picker and Escape dismissal; Art History Brush row added as partial, 8 of 10 styles, TOOL-213-20, #1610; hard-round built-in presets use 5% spacing to remove stacked-tip outlines and reduce pressure-opacity bands, #8842; Mode for Clone Stamp, Pattern Stamp, History Brush, Healing and Paint Bucket; named, stateful Brush Settings locks and visible keyboard focus; independent Brush Pose tilt-axis overrides; Transfer Wetness/Mix tool applicability; dragged preset tip preview; Hue Jitter amount track; Brush Settings minimum fields follow their Control; checkbox-only rows and non-destructive Smoothing switch; shaped-tip cursor follows the view; Color Replacement is a live toolbar tool; no brush-feel estimate changed; 2026-10-11: Pattern Stamp and Background Eraser draw live, TOOL-213-7) · **Target:** Adobe Photoshop 2026 +> **Last reviewed:** 2026-10-10 · **Last updated:** 2026-11-07 · **Change:** minor (1 px Pencil curves have no holes where they bend, #9003; Angle/Roundness fields left of the Brush Tip Shape widget, labels right-aligned, #3825 partial; the eraser end of the pen switches to the Eraser on Windows with Windows Ink on, #2285; no estimate changed; Art History Brush Opacity on the options bar, #10263; no estimate changed; Shift+right-click menu for every painting tool: Edit Brush… and the tool's own Mode list; Brush Shift+right-click Mode picker and Escape dismissal; Art History Brush row added as partial, 8 of 10 styles, TOOL-213-20, #1610; hard-round built-in presets use 5% spacing to remove stacked-tip outlines and reduce pressure-opacity bands, #8842; Mode for Clone Stamp, Pattern Stamp, History Brush, Healing and Paint Bucket; named, stateful Brush Settings locks and visible keyboard focus; independent Brush Pose tilt-axis overrides; Transfer Wetness/Mix tool applicability; dragged preset tip preview; Hue Jitter amount track; Brush Settings minimum fields follow their Control; checkbox-only rows and non-destructive Smoothing switch; shaped-tip cursor follows the view; Color Replacement is a live toolbar tool; no brush-feel estimate changed; 2026-10-11: Pattern Stamp and Background Eraser draw live, TOOL-213-7) · **Target:** Adobe Photoshop 2026 Painting is where Photoshop users notice differences first, so it gets its own checklist: the brush engine (`crates/paint/src/brush.rs`), the Brush Settings UI @@ -94,7 +94,7 @@ tablets against Photoshop side by side. | Tool | Status | Notes | |---|---|---| -| Brush, Pencil (aliased, Auto Erase), Eraser (Brush/Pencil/Block) | done | Pencil 1 px quality #2139 | +| Brush, Pencil (aliased, Auto Erase), Eraser (Brush/Pencil/Block) | done | Pencil 1 px quality #2139; unbroken curves #9003 | | Mixer Brush (Wet, Load, Mix, Flow, Sample All Layers, Current Brush Load with Load Brush and Clean Brush, automatic Load and Clean) | partial | No live result while dragging, no Alt-click loading (#2247) | | Clone Stamp (mode, opacity, flow, aligned, sample, overlay) | partial | Clone Source W/H link and Alt target cursor (TOOL-213-8) | | Pattern Stamp (mode, aligned, impressionist) | done | | @@ -124,6 +124,7 @@ tablets against Photoshop side by side. | 2026-11-06 | minor | Eraser end of the pen switches to the Eraser on Windows with Windows Ink on (#2285); row stays partial (X11, web); no estimate changed | | 2026-10-30 | minor | Art History Brush Opacity on the options bar, #10263; no estimate changed | | 2026-10-25 | minor | Art History Brush row added as partial (8 of 10 styles, TOOL-213-20, #1610). No brush-feel estimate changed. | +| 2026-10-23 | minor | A 1 px Pencil curve stays 8-connected where it bends: the cells skipped between two segments' pixel steps are filled in (#9003). No brush-feel estimate changed. | | 2026-10-23 | minor | Hard-round built-in presets use 5% spacing (#8842); rendered large-tip outline and pressure-opacity continuity tests cover 8/16/32-bit and 0/49% smoothing. Other presets and user settings retain their spacing; percentages and estimates unchanged. | | 2026-10-14 | minor | Brush Pose tilt overrides are independent end to end (#3825 partial); ABR flags, legacy JSON/commands, presets and three pixel depths covered; no readiness percentage or estimate changed | | 2026-10-13 | minor | Stale "missing tool" row corrected against main: Color Replacement (`paint.colorReplacement`) is a live toolbar tool; no brush-feel estimate changed | From 68f7e579ba48aa58900ce09fe5c8032744753b61 Mon Sep 17 00:00:00 2001 From: Hector Villarreal Date: Fri, 23 Oct 2026 23:22:52 -0600 Subject: [PATCH 04/61] Pencil: bridge only pixel steps, not speed or airbrush steps CodeRabbit finding on #9059 ("Bridge only pixel-grid steps"): the bend bridge ran on every step in pixel-grid mode, so a 1 px Pencil with Spacing off (speed spacing) or airbrush build-up gained dabs those modes leave out on purpose. Only grid_steps' steps are bridged now. New test: pixel_grid_bridges_only_its_own_steps (61 speed steps instead of 21, and 19 airbrush steps instead of 14, without the fix). Co-Authored-By: Claude Opus 5.5 --- crates/paint/src/dynamics.rs | 46 ++++++++++++++++++++++++++++++++---- 1 file changed, 42 insertions(+), 4 deletions(-) diff --git a/crates/paint/src/dynamics.rs b/crates/paint/src/dynamics.rs index b3411b7a0bb..df44df903db 100644 --- a/crates/paint/src/dynamics.rs +++ b/crates/paint/src/dynamics.rs @@ -248,7 +248,8 @@ pub struct PathWalker { /// Pixel-grid stepping for small aliased tips: the dab-centre offset inside a pixel (see /// [`PathWalker::pixel_grid`]). grid: Option, - /// The grid cell of the last pixel-grid step, so the next segment joins it (#8040). + /// The grid cell of the last pixel-grid step, so the next segment joins it (#8040). Only pixel + /// steps set it: speed spacing and airbrush build-up leave their gaps on purpose. cell: Option<(f64, f64)>, } @@ -294,6 +295,7 @@ impl PathWalker { let (dm, dn) = (pm - am, pn - an); let n = (m1 - m0).abs(); if !(n.is_finite() && dn.is_finite()) || n > MAX_GRID_STEPS || dm == 0.0 { + self.cell = None; return false; } let dir = (m1 - m0).signum(); @@ -307,6 +309,7 @@ impl PathWalker { (q.x, q.y) = if steep { (cn, c) } else { (c, cn) }; self.bridge(&q, out); self.emit(q, out); + self.cell = Some((q.x, q.y)); } true } @@ -339,9 +342,6 @@ impl PathWalker { } fn emit(&mut self, point: StrokePoint, out: &mut impl FnMut(StepInput)) { - if let Some(g) = self.grid { - self.cell = Some((grid_cell(point.x, g), grid_cell(point.y, g))); - } let s = StepInput { point, direction: self.dir, initial_direction: self.initial_dir.unwrap_or(self.dir), step: self.step }; self.step += 1; out(s); @@ -363,6 +363,9 @@ impl PathWalker { } } if let Some(f) = self.pending_first.take() { + if let Some(g) = self.grid { + self.cell = Some((grid_cell(f.x, g), grid_cell(f.y, g))); + } self.emit(f, out); } if len > 1e-9 { @@ -1046,3 +1049,38 @@ mod streaming_tests { assert_eq!(dabs.len(), 2_000_001); } } + +#[cfg(test)] +mod grid_bridge_tests { + use super::*; + + fn walk(mut walker: PathWalker, pts: &[StrokePoint]) -> Vec { + let mut steps = Vec::new(); + let mut out = |s: StepInput| steps.push(s.point); + for p in pts { + walker.push(*p, &|_: &StrokePoint| 1.0, &mut out); + } + walker.finish(&mut out); + steps + } + + fn at(x: f64, y: f64, time: f64) -> StrokePoint { + StrokePoint { time, ..StrokePoint::new(x, y, 1.0) } + } + + /// #9059 review: only the pixel steps are bridged. Speed spacing (Spacing off) and airbrush + /// build-up leave out dabs on purpose, and pixel-grid mode must not put them back. + #[test] + fn pixel_grid_bridges_only_its_own_steps() { + // Fast enough that speed-spaced steps land 3 px apart. + let fast = [at(0.0, 0.0, 0.0), at(30.0, 0.0, 80.0), at(30.0, 30.0, 160.0)]; + let speed = walk(PathWalker::new(None).speed_spacing(SPEED_SPACING_MS), &fast); + let speed_grid = walk(PathWalker::new(None).speed_spacing(SPEED_SPACING_MS).pixel_grid(0.5), &fast); + assert_eq!(speed_grid.len(), speed.len(), "speed spacing keeps its gaps"); + // Three airbrush steps on top of the pixel steps, and nothing else. + let seg = [at(0.0, 0.0, 0.0), at(10.0, 0.0, 30.0)]; + let grid = walk(PathWalker::new(None).pixel_grid(0.5), &seg); + let airbrush = walk(PathWalker::new(Some(10.0)).pixel_grid(0.5), &seg); + assert_eq!(airbrush.len(), grid.len() + 3, "airbrush adds only its own steps"); + } +} From 9013edc514aa0c440d0258c34cb20214ec92775a Mon Sep 17 00:00:00 2001 From: Hector Villarreal Date: Fri, 23 Oct 2026 23:25:32 -0600 Subject: [PATCH 05/61] Pencil: a bridged cell blends its neighbours' pressure and time CodeRabbit finding on #9059 ("Interpolate the bridge step's dynamics"): a cell filled in at a bend copied the later step's pressure and time, so pressure dynamics jumped at the bend instead of running across it. The walker keeps its last pixel step and interpolates between the two. New test: a_bridged_cell_blends_its_neighbours_dynamics (the bridged cell repeats the next step's pressure 0.568 and time without the fix). Co-Authored-By: Claude Opus 5.5 --- crates/paint/src/dynamics.rs | 35 ++++++++++++++++++++++++++++------- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/crates/paint/src/dynamics.rs b/crates/paint/src/dynamics.rs index df44df903db..067c9e2c404 100644 --- a/crates/paint/src/dynamics.rs +++ b/crates/paint/src/dynamics.rs @@ -248,9 +248,9 @@ pub struct PathWalker { /// Pixel-grid stepping for small aliased tips: the dab-centre offset inside a pixel (see /// [`PathWalker::pixel_grid`]). grid: Option, - /// The grid cell of the last pixel-grid step, so the next segment joins it (#8040). Only pixel + /// The last pixel-grid step, on its grid cell, so the next segment joins it (#8040). Only pixel /// steps set it: speed spacing and airbrush build-up leave their gaps on purpose. - cell: Option<(f64, f64)>, + cell: Option, } impl PathWalker { @@ -309,7 +309,7 @@ impl PathWalker { (q.x, q.y) = if steep { (cn, c) } else { (c, cn) }; self.bridge(&q, out); self.emit(q, out); - self.cell = Some((q.x, q.y)); + self.cell = Some(q); } true } @@ -318,11 +318,14 @@ impl PathWalker { /// samples its own line, so where a freehand stroke turns, the last pixel of one segment and /// the first of the next can sit two pixels apart, and the 1 px Pencil line breaks (#8040). fn bridge(&mut self, q: &StrokePoint, out: &mut impl FnMut(StepInput)) { - let Some((mut x, mut y)) = self.cell else { return }; + let Some(last) = self.cell else { return }; + let (mut x, mut y) = (last.x, last.y); + let n = (q.x - x).abs().max((q.y - y).abs()).round(); // Only a turn's small gap: a step cut off by the walker's budget is not filled in. - if (q.x - x).abs().max((q.y - y).abs()) > MAX_BRIDGE { + if n > MAX_BRIDGE { return; } + let mut i = 0.0; while (q.x - x).abs() > 1.5 || (q.y - y).abs() > 1.5 { if (q.x - x).abs() > 0.5 { x += (q.x - x).signum(); @@ -330,7 +333,9 @@ impl PathWalker { if (q.y - y).abs() > 0.5 { y += (q.y - y).signum(); } - self.emit(StrokePoint { x, y, ..*q }, out); + // Pressure, tilt and time run on across the filled-in cells too. + i += 1.0; + self.emit(StrokePoint { x, y, ..lerp_pt(&last, q, i / n) }, out); } } @@ -364,7 +369,7 @@ impl PathWalker { } if let Some(f) = self.pending_first.take() { if let Some(g) = self.grid { - self.cell = Some((grid_cell(f.x, g), grid_cell(f.y, g))); + self.cell = Some(StrokePoint { x: grid_cell(f.x, g), y: grid_cell(f.y, g), ..f }); } self.emit(f, out); } @@ -1083,4 +1088,20 @@ mod grid_bridge_tests { let airbrush = walk(PathWalker::new(Some(10.0)).pixel_grid(0.5), &seg); assert_eq!(airbrush.len(), grid.len() + 3, "airbrush adds only its own steps"); } + + /// #9059 review: a cell filled in at a bend takes the pressure and time between its two + /// neighbours, not the later one's, so pressure dynamics change across it. + #[test] + fn a_bridged_cell_blends_its_neighbours_dynamics() { + // Shallow, then steep: the steep segment's first step lands two cells from the last one. + let bend = [(0.3, 0.6), (10.6, 3.0), (13.0, 14.0)]; + let pts: Vec<_> = bend.iter().enumerate().map(|(i, &(x, y))| StrokePoint { pressure: 0.5 * i as f32, ..at(x, y, 100.0 * i as f64) }).collect(); + let steps = walk(PathWalker::new(None).pixel_grid(0.5), &pts); + let cell = |p: &StrokePoint| (grid_cell(p.x, 0.5), grid_cell(p.y, 0.5)); + for w in steps.windows(2) { + let ((ax, ay), (bx, by)) = (cell(&w[0]), cell(&w[1])); + assert!((bx - ax).abs() <= 1.0 && (by - ay).abs() <= 1.0, "8-connected: {:?} then {:?}", w[0], w[1]); + assert!(w[1].time > w[0].time && w[1].pressure > w[0].pressure, "dynamics run on: {:?} then {:?}", w[0], w[1]); + } + } } From 9ff794f042fea3eddf60b23c11d8ece88df63278 Mon Sep 17 00:00:00 2001 From: Hector Villarreal Date: Fri, 23 Oct 2026 23:38:29 -0600 Subject: [PATCH 06/61] Pencil: a pixel segment after speed spacing doesn't step back CodeRabbit finding on #9059 ("Reset stale grid history before bridging after speed spacing"): with Spacing off, a speed-spaced segment left the last pixel cell from before it, so a following segment without a time interval bridged from there, stepping back and repeating a dab. A speed-spaced segment now clears the grid history. New test: a_pixel_segment_after_speed_spacing_does_not_step_back (steps go 0.5, 2.5, 1.5, 2.5, 3.5, 4.5 without the fix). Co-Authored-By: Claude Opus 5.5 --- crates/paint/src/dynamics.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/crates/paint/src/dynamics.rs b/crates/paint/src/dynamics.rs index 067c9e2c404..ab4ac6d989a 100644 --- a/crates/paint/src/dynamics.rs +++ b/crates/paint/src/dynamics.rs @@ -394,6 +394,8 @@ impl PathWalker { } } Some(iv) => { + // The stroke moves on without pixel steps: a later pixel segment starts afresh. + self.cell = None; self.speed_acc += dt; let max_n = (len / MIN_SPEED_STEP).ceil().max(1.0) as usize; let mut n = 0; @@ -1089,6 +1091,17 @@ mod grid_bridge_tests { assert_eq!(airbrush.len(), grid.len() + 3, "airbrush adds only its own steps"); } + /// #9059 review: a speed-spaced segment moves the stroke on without pixel steps, so a pixel + /// segment after it starts afresh instead of bridging from the cell before it. + #[test] + fn a_pixel_segment_after_speed_spacing_does_not_step_back() { + let pts = [at(0.5, 0.5, 0.0), at(2.5, 0.5, 8.0), at(4.5, 0.5, 8.0)]; + let steps = walk(PathWalker::new(None).speed_spacing(SPEED_SPACING_MS).pixel_grid(0.5), &pts); + let xs: Vec = steps.iter().map(|p| p.x).collect(); + assert!(xs.windows(2).all(|w| w[1] > w[0]), "forward only, each cell once: {xs:?}"); + assert!(steps.windows(2).all(|w| w[1].time >= w[0].time), "time runs on: {steps:?}"); + } + /// #9059 review: a cell filled in at a bend takes the pressure and time between its two /// neighbours, not the later one's, so pressure dynamics change across it. #[test] From a810dafb5cddcbe3e216f94b12c1580f35750a74 Mon Sep 17 00:00:00 2001 From: Hector Villarreal Date: Wed, 11 Nov 2026 08:30:24 -0600 Subject: [PATCH 07/61] #9059: a test per refinement that fails on main, after merging main (tanish2k09's review) Pixel-step-only bridging and "no step back after speed spacing" are one change (the bridge's cell comes from pixel steps only and is dropped by a speed-spaced move), so one test shows it: a_pixel_segment_after_speed_spacing_leaves_its_gap fails on main (a cell is filled in after the last speed step) and passes here. a_bridged_cell_blends_its_neighbours_dynamics fails on main (the filled-in cell takes the later point's pressure and time). The earlier pixel_grid_bridges_only_its_own_steps passes on main as well, so it is dropped. --- crates/paint/src/dynamics.rs | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/crates/paint/src/dynamics.rs b/crates/paint/src/dynamics.rs index 9dfe110157b..9b5df403aab 100644 --- a/crates/paint/src/dynamics.rs +++ b/crates/paint/src/dynamics.rs @@ -1111,30 +1111,18 @@ mod grid_bridge_tests { StrokePoint { time, ..StrokePoint::new(x, y, 1.0) } } - /// #9059 review: only the pixel steps are bridged. Speed spacing (Spacing off) and airbrush - /// build-up leave out dabs on purpose, and pixel-grid mode must not put them back. + /// #9059 review: the bridge joins pixel steps only. Speed spacing leaves its gaps on purpose + /// (Spacing off: faster movement spreads the dabs out), so a pixel segment after one starts + /// afresh instead of filling the gap back in from the cell before it. #[test] - fn pixel_grid_bridges_only_its_own_steps() { - // Fast enough that speed-spaced steps land 3 px apart. - let fast = [at(0.0, 0.0, 0.0), at(30.0, 0.0, 80.0), at(30.0, 30.0, 160.0)]; - let speed = walk(PathWalker::new(None).speed_spacing(SPEED_SPACING_MS), &fast); - let speed_grid = walk(PathWalker::new(None).speed_spacing(SPEED_SPACING_MS).pixel_grid(0.5), &fast); - assert_eq!(speed_grid.len(), speed.len(), "speed spacing keeps its gaps"); - // Three airbrush steps on top of the pixel steps, and nothing else. - let seg = [at(0.0, 0.0, 0.0), at(10.0, 0.0, 30.0)]; - let grid = walk(PathWalker::new(None).pixel_grid(0.5), &seg); - let airbrush = walk(PathWalker::new(Some(10.0)).pixel_grid(0.5), &seg); - assert_eq!(airbrush.len(), grid.len() + 3, "airbrush adds only its own steps"); - } - - /// #9059 review: a speed-spaced segment moves the stroke on without pixel steps, so a pixel - /// segment after it starts afresh instead of bridging from the cell before it. - #[test] - fn a_pixel_segment_after_speed_spacing_does_not_step_back() { - let pts = [at(0.5, 0.5, 0.0), at(2.5, 0.5, 8.0), at(4.5, 0.5, 8.0)]; + fn a_pixel_segment_after_speed_spacing_leaves_its_gap() { + // A fast 8 px move in 60 ms: speed steps about every 1.07 px, the last (at 7.97) half a pixel + // short of the move's end. The segment after it has no timestamps, so it takes pixel steps. + let pts = [at(0.5, 0.5, 0.0), at(8.5, 0.5, 60.0), at(12.5, 0.5, 60.0)]; let steps = walk(PathWalker::new(None).speed_spacing(SPEED_SPACING_MS).pixel_grid(0.5), &pts); let xs: Vec = steps.iter().map(|p| p.x).collect(); - assert!(xs.windows(2).all(|w| w[1] > w[0]), "forward only, each cell once: {xs:?}"); + assert!(xs.iter().all(|x| !(8.0..9.4).contains(x)), "no cell filled in after the last speed step: {xs:?}"); + assert!(xs.windows(2).all(|w| w[1] > w[0]), "forward only: {xs:?}"); assert!(steps.windows(2).all(|w| w[1].time >= w[0].time), "time runs on: {steps:?}"); } From aec5cee320cf088a3bda8a7578e22a802d82ea1f Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 24 Nov 2026 22:56:23 +0000 Subject: [PATCH 08/61] Add Black & White adjustment presets --- crates/ui-egui/src/dialogs/adjust_editors.rs | 13 +-- .../adjust_editors/black_white_presets.rs | 96 +++++++++++++++++++ .../src/dialogs/adjust_editors/session.rs | 16 +++- .../src/dialogs/adjust_editors/ui_tests.rs | 92 ++++++++++++++++++ 4 files changed, 205 insertions(+), 12 deletions(-) create mode 100644 crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs diff --git a/crates/ui-egui/src/dialogs/adjust_editors.rs b/crates/ui-egui/src/dialogs/adjust_editors.rs index b1a687f321a..3bc8a0fd511 100644 --- a/crates/ui-egui/src/dialogs/adjust_editors.rs +++ b/crates/ui-egui/src/dialogs/adjust_editors.rs @@ -17,9 +17,9 @@ use craft::behavior::{EditEvent, EditEvents, Mixed}; use craft::color_ui::ui::gradient::{ColorStop, GradientStops}; use craft::draw::ui::gradient::{GradientGroup, GradientItem, GradientMap, GradientMapEditor, GradientMapOutput}; use craft::imaging::ui::adjust::{ - AdjustDialogCx, AdjustField, AdjustSliders, AdjustWords, BlackWhite, BlackWhiteEditor, BrightnessContrast, BrightnessContrastEditor, ChannelMixer, - ChannelMixerEditor, ColorBalance, ColorBalanceEditor, ColorBalanceTone, CurvesPanel, HueSaturation, HueSaturationEditor, Levels, LevelsPanel, PhotoFilter, - PhotoFilterEditor, SelectiveColor, SelectiveColorEditor, ThresholdEditor, ToneChannels, ToneCurves, ToneSpace, + AdjustDialogCx, AdjustField, AdjustSliders, AdjustWords, BlackWhite, BrightnessContrast, BrightnessContrastEditor, ChannelMixer, ChannelMixerEditor, + ColorBalance, ColorBalanceEditor, ColorBalanceTone, CurvesPanel, HueSaturation, HueSaturationEditor, Levels, LevelsPanel, PhotoFilter, PhotoFilterEditor, + SelectiveColor, SelectiveColorEditor, ThresholdEditor, ToneChannels, ToneCurves, ToneSpace, }; use craft::imaging::ui::histogram::{ChannelColor, HistogramData}; use craft::theme::Srgba; @@ -35,6 +35,7 @@ use serde_json::{Value, json}; use crate::PhotocraftApp; +mod black_white_presets; mod session; pub mod values; @@ -306,11 +307,7 @@ fn show(kind: &str, setup: &EditorSetup, ui: &mut Ui, value: &mut AdjustValue, c let out = editor.show(ui); lifted(out.edit.events, |value| AdjustValue::ColorBalance { value }) } - ("blackWhite", AdjustValue::BlackWhite { value }) => { - let out = BlackWhiteEditor::new("Black & White", Bind::bound(value)).context(context).show(ui); - let ask = if out.auto { Some(AdjustAsk::Auto) } else { out.pick_color.map(AdjustAsk::PickColor) }; - AdjustOut { ask, edit: out.edit.events.map(|value| AdjustValue::BlackWhite { value }) } - } + ("blackWhite", AdjustValue::BlackWhite { value }) => black_white_presets::show(ui, value, context), ("photoFilter", AdjustValue::PhotoFilter { value }) => { let out = PhotoFilterEditor::new("Photo Filter", Bind::bound(value)).context(context).show(ui); AdjustOut { ask: out.pick_color.map(AdjustAsk::PickColor), edit: out.edit.events.map(|value| AdjustValue::PhotoFilter { value }) } diff --git a/crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs b/crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs new file mode 100644 index 00000000000..6d338a5b9f5 --- /dev/null +++ b/crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs @@ -0,0 +1,96 @@ +//! Original Black & White recipes for tonal shifts and the effect of color filters. + +use std::sync::Arc; + +use craft::behavior::{EditEvent, EditEvents, Mixed}; +use craft::imaging::ui::adjust::{AdjustContext, AdjustWords, BlackWhite, BlackWhiteEditor}; +use craft::ui::contract::{Bind, Entry, Show as _, ShowContainer as _}; +use craft::ui::form::Field; +use craft::ui::pickers::Select; +use craft::ui::runtime::env::Env; +use egui::Ui; + +use super::{AdjustAsk, AdjustOut, AdjustValue}; + +type Mix = [f64; 6]; + +/// The presets change the grayscale mix and keep the layer's tint settings. +fn entries() -> [Entry>; 14] { + [ + Entry::new(Some(BlackWhite::DEFAULT_WEIGHTS), tl!("Default")), + Entry::new(Some([22.0, 38.0, 25.0, 36.0, 10.0, 50.0]), tl!("Darker")), + Entry::new(Some([60.0, 77.0, 64.0, 78.0, 47.0, 92.0]), tl!("Lighter")), + Entry::new(Some([8.0; 6]), tl!("Deep Shadows")), + Entry::new(Some([92.0; 6]), tl!("Bright Highlights")), + Entry::new(Some([48.0; 6]), tl!("Even Color Weights")), + Entry::new(Some([86.0, 65.0, 33.0, 23.0, 15.0, 72.0]), tl!("Red Filter")), + Entry::new(Some([64.0, 91.0, 64.0, 41.0, 13.0, 53.0]), tl!("Yellow Filter")), + Entry::new(Some([28.0, 67.0, 91.0, 74.0, 17.0, 45.0]), tl!("Green Filter")), + Entry::new(Some([24.0, 35.0, 45.0, 77.0, 92.0, 53.0]), tl!("Blue Filter")), + Entry::new(Some([100.0, 73.0, 24.0, 7.0, 5.0, 64.0]), tl!("Strong Red Filter")), + Entry::new(Some([4.0, 12.0, 27.0, 71.0, 100.0, 44.0]), tl!("Strong Blue Filter")), + Entry::new(Some([58.0, 89.0, 97.0, 38.0, 8.0, 33.0]), tl!("Infrared Foliage")), + Entry::new(None, tl!("Custom")), + ] +} + +/// A manual edit can land on exactly the weights of a named recipe. Remember that edit locally +/// so its value still shows as Custom. The Properties inspector scopes this memory to its target. +#[derive(Clone, Copy, PartialEq)] +struct ManualValue { + weights: Mix, + tint: Option<[u8; 3]>, +} + +impl From for ManualValue { + fn from(value: BlackWhite) -> Self { + let [r, g, b, _] = value.tint_color.to_rgba().0; + Self { weights: value.weights, tint: value.tint.then_some([r, g, b]) } + } +} + +fn manual_id(ui: &Ui) -> egui::Id { + ui.make_persistent_id("black-white-manual-value") +} + +/// The Properties host applies accepted Color Picker colors and Auto outside the editor's pass. +pub(super) fn mark_custom(ui: &Ui, value: &AdjustValue) { + if let AdjustValue::BlackWhite { value } = value { + ui.data_mut(|d| d.insert_temp(manual_id(ui), ManualValue::from(*value))); + } +} + +pub(super) fn show(ui: &mut Ui, value: &mut BlackWhite, context: AdjustContext) -> AdjustOut { + let id = manual_id(ui); + let mut manual = ui.data(|d| d.get_temp::(id)); + let entries = entries(); + let shown = (manual != Some((*value).into()) && entries.iter().any(|entry| entry.value() == Some(&Some(value.weights)))).then_some(value.weights); + let label = tl!("Preset"); + let picked = Field::new(label).show(ui, |ui, _| Select::new(label, Bind::given(shown), &entries).show(ui).events.committed().copied()).inner.flatten(); + let mut edit = EditEvents::new(); + if let Some(picked) = picked { + manual = picked.is_none().then(|| (*value).into()); + if let Some(weights) = picked + && weights != value.weights + { + let before = *value; + value.weights = weights; + edit.push(EditEvent::set(Mixed::Same(before), *value, Arc::from(label), None)); + } + } + + let out = BlackWhiteEditor::new("Black & White", Bind::bound(&mut *value)).context(context).show(ui); + if let Some(after) = out.edit.events.committed() { + let words = Env::of(ui).words::(); + let reset = matches!(out.edit.events.ended(), Some(EditEvent::Set { label, .. }) if label.as_ref() == words.default_button.as_str()); + manual = (!reset).then(|| (*after).into()); + } + ui.data_mut(|d| match manual { + Some(value) => d.insert_temp(id, value), + None => d.remove::(id), + }); + + let ask = if out.auto { Some(AdjustAsk::Auto) } else { out.pick_color.map(AdjustAsk::PickColor) }; + edit.extend(out.edit.events); + AdjustOut { ask, edit: edit.map(|value| AdjustValue::BlackWhite { value }) } +} diff --git a/crates/ui-egui/src/dialogs/adjust_editors/session.rs b/crates/ui-egui/src/dialogs/adjust_editors/session.rs index 2c0b85ca459..5ec90aa8cae 100644 --- a/crates/ui-egui/src/dialogs/adjust_editors/session.rs +++ b/crates/ui-egui/src/dialogs/adjust_editors/session.rs @@ -13,7 +13,7 @@ use photocraft_engine::adjust_params; use serde_json::{Value, json}; use super::values::{self, ValueCx}; -use super::{AdjustAsk, AdjustValue, EditorSetup, answer_color, black_white_auto, editor, gradient_presets, is_gray, swatches}; +use super::{AdjustAsk, AdjustValue, EditorSetup, answer_color, black_white_auto, black_white_presets, editor, gradient_presets, is_gray, swatches}; use crate::PhotocraftApp; use crate::color_picker_ui::PickWindow; use crate::theme::Tokens; @@ -189,7 +189,7 @@ pub fn layer_editor(app: &mut PhotocraftApp, ui: &mut egui::Ui, id: LayerId, adj record.session.track(session_target(doc, id), app.properties_hidden, &committed); app.properties_tracked = true; } - follow_color_pick(app, id, &mut record, &committed, &vcx); + follow_color_pick(app, ui, id, &mut record, &committed, &vcx); let mut value = match &app.live_adjust { Some((layer, params)) if *layer == id => values::from_params(kind, params, &vcx).unwrap_or_else(|_| committed.clone()), _ => committed.clone(), @@ -240,7 +240,12 @@ pub fn layer_editor(app: &mut PhotocraftApp, ui: &mut egui::Ui, id: LayerId, adj target.extend(weights); } match values::from_params(kind, ¶ms, &vcx) { - Ok(auto) => commit(app, id, &mut record, &committed, &auto, &vcx, None), + Ok(auto) => { + if auto != committed { + black_white_presets::mark_custom(ui, &auto); + } + commit(app, id, &mut record, &committed, &auto, &vcx, None); + } Err(err) => app.ui.status = err, } } @@ -288,7 +293,7 @@ fn commit( /// A colour well's Color Picker while it is open: its colour previews on the layer. Once it /// closed, OK's colour is one edit and Cancel (or OK without a colour) leaves the layer as it was. -fn follow_color_pick(app: &mut PhotocraftApp, id: LayerId, record: &mut PropertiesAdjust, committed: &AdjustValue, vcx: &ValueCx) { +fn follow_color_pick(app: &mut PhotocraftApp, ui: &egui::Ui, id: LayerId, record: &mut PropertiesAdjust, committed: &AdjustValue, vcx: &ValueCx) { let Some(pick) = record.pick.take() else { return }; match app.framework.dialogs.get_by_id::(pick.dialog).map(ColorPickerDialog::current) { Some(current) => { @@ -304,6 +309,9 @@ fn follow_color_pick(app: &mut PhotocraftApp, id: LayerId, record: &mut Properti Some((key, color)) if key == pick.key && Some(color) != pick.opened => { let mut answered = pick.before; if answer_color(&mut answered, &key, color) { + if answered != *committed { + black_white_presets::mark_custom(ui, &answered); + } commit(app, id, record, committed, &answered, vcx, None); } else { app.live_adjust = None; diff --git a/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs b/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs index fa23887d654..1a2b8307cac 100644 --- a/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs +++ b/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs @@ -492,3 +492,95 @@ fn black_white_auto_button_sets_the_weights() { assert_ne!(after, before, "the red and blue are told apart"); assert_eq!(history_len(&h), steps + 1); } + +fn assert_black_white_preset(h: &Harness<'_, Box>, name: &str) { + assert_eq!(h.get_by_role_and_label(Role::ComboBox, "Preset").accesskit_node().value().as_deref(), Some(name)); +} + +#[test] +fn black_white_presets_apply_through_properties_and_undo() { + let mut h = app_harness("blackWhite", "rgb", 8); + let (id, _) = layer(&h); + h.state_mut().run("layer.setAdjustment", json!({"layer": id.0, "tint": true, "tintColor": "#336699"})).unwrap(); + h.run_steps(4); + let (_, before) = layer(&h); + let Adjustment::BlackWhite { weights: original, tint: original_tint } = &before else { panic!("{before:?}") }; + let history = history_len(&h); + let pixel = h.state_mut().run("document.pixel", json!({"x": 10, "y": 10})).unwrap(); + assert_black_white_preset(&h, "Default"); + + h.get_by_role_and_label(Role::ComboBox, "Preset").click(); + h.run_steps(3); + h.get_by_role_and_label(Role::ListBoxOption, "Darker").click(); + h.run_steps(4); + assert_black_white_preset(&h, "Darker"); + let (_, after) = layer(&h); + let Adjustment::BlackWhite { weights, tint } = &after else { panic!("{after:?}") }; + assert!(weights.iter().zip(original).all(|(weight, original)| weight < original)); + assert_eq!(tint, original_tint); + assert_ne!(h.state_mut().run("document.pixel", json!({"x": 10, "y": 10})).unwrap(), pixel); + assert_eq!(history_len(&h), history + 1); + assert!(h.state().live_adjust.is_none()); + + let ctx = h.ctx.clone(); + let picker = open_picker(&mut h, "Tint Color"); + show_in_picker(&mut h, picker, "#ad632a"); + h.state_mut().framework.dialogs.cancel_by_id(&ctx, picker); + h.run_steps(4); + assert_black_white_preset(&h, "Darker"); + assert_eq!(layer(&h).1, after); + assert_eq!(history_len(&h), history + 1); + + let picker = open_picker(&mut h, "Tint Color"); + show_in_picker(&mut h, picker, "#ad632a"); + crate::dialogs::confirm(h.state_mut(), &ctx, picker).expect("OK is enabled"); + h.run_steps(4); + assert_black_white_preset(&h, "Custom"); + assert_eq!(history_len(&h), history + 2); + + h.state_mut().run("edit.undo", json!({})).unwrap(); + h.run_steps(4); + assert_eq!(layer(&h).1, after); + assert_black_white_preset(&h, "Darker"); + h.state_mut().run("edit.undo", json!({})).unwrap(); + h.run_steps(4); + assert_eq!(layer(&h).1, before); + assert_black_white_preset(&h, "Default"); +} + +#[test] +fn black_white_presets_distinguish_manual_edits_from_named_choices() { + let mut h = app_harness("blackWhite", "rgb", 8); + let (id, defaults) = layer(&h); + let Adjustment::BlackWhite { weights, .. } = &defaults else { panic!("{defaults:?}") }; + let red = weights[0]; + h.state_mut().run("layer.setAdjustment", json!({"layer": id.0, "reds": red + 7.0})).unwrap(); + h.run_steps(4); + assert_black_white_preset(&h, "Custom"); + + h.get_by_role_and_label(Role::SpinButton, "Reds").click(); + h.run_steps(1); + h.key_press_modifiers(egui::Modifiers::COMMAND, egui::Key::A); + h.event(egui::Event::Text(red.to_string())); + h.run_steps(1); + h.key_press(egui::Key::Tab); + h.run_steps(4); + assert_eq!(layer(&h).1, defaults); + assert_black_white_preset(&h, "Custom"); + + h.state_mut().run("layer.newAdjustmentLayer.blackWhite", json!({})).unwrap(); + h.run_steps(4); + assert_black_white_preset(&h, "Default"); + h.state_mut().run("layer.select", json!({"layer": id.0})).unwrap(); + h.run_steps(4); + assert_black_white_preset(&h, "Custom"); + + let history = history_len(&h); + h.get_by_role_and_label(Role::ComboBox, "Preset").click(); + h.run_steps(3); + h.get_by_role_and_label(Role::ListBoxOption, "Default").click(); + h.run_steps(4); + assert_black_white_preset(&h, "Default"); + assert_eq!(layer(&h).1, defaults); + assert_eq!(history_len(&h), history); +} From 0146460e38ddb3938f01773bb974bbd101ce956b Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 24 Nov 2026 23:00:44 +0000 Subject: [PATCH 09/61] Reset the Black & White preset label at default weights --- crates/ui-egui/src/dialogs/adjust_editors.rs | 2 +- .../adjust_editors/black_white_presets.rs | 5 +++ .../src/dialogs/adjust_editors/ui_tests.rs | 35 ++++++++++++------- crates/ui-egui/src/panels/properties.rs | 3 ++ 4 files changed, 32 insertions(+), 13 deletions(-) diff --git a/crates/ui-egui/src/dialogs/adjust_editors.rs b/crates/ui-egui/src/dialogs/adjust_editors.rs index 3bc8a0fd511..d3cb0617211 100644 --- a/crates/ui-egui/src/dialogs/adjust_editors.rs +++ b/crates/ui-egui/src/dialogs/adjust_editors.rs @@ -35,7 +35,7 @@ use serde_json::{Value, json}; use crate::PhotocraftApp; -mod black_white_presets; +pub(crate) mod black_white_presets; mod session; pub mod values; diff --git a/crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs b/crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs index 6d338a5b9f5..ca5f03100d4 100644 --- a/crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs +++ b/crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs @@ -53,6 +53,11 @@ fn manual_id(ui: &Ui) -> egui::Id { ui.make_persistent_id("black-white-manual-value") } +pub(crate) fn clear_custom(ui: &Ui) { + ui.data_mut(|d| d.remove::(manual_id(ui))); + ui.ctx().request_repaint(); +} + /// The Properties host applies accepted Color Picker colors and Auto outside the editor's pass. pub(super) fn mark_custom(ui: &Ui, value: &AdjustValue) { if let AdjustValue::BlackWhite { value } = value { diff --git a/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs b/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs index 1a2b8307cac..a4c88a1036b 100644 --- a/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs +++ b/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs @@ -554,19 +554,22 @@ fn black_white_presets_distinguish_manual_edits_from_named_choices() { let (id, defaults) = layer(&h); let Adjustment::BlackWhite { weights, .. } = &defaults else { panic!("{defaults:?}") }; let red = weights[0]; - h.state_mut().run("layer.setAdjustment", json!({"layer": id.0, "reds": red + 7.0})).unwrap(); - h.run_steps(4); - assert_black_white_preset(&h, "Custom"); + let type_default = |h: &mut Harness<'_, Box>| { + h.state_mut().run("layer.setAdjustment", json!({"layer": id.0, "reds": red + 7.0})).unwrap(); + h.run_steps(4); + assert_black_white_preset(h, "Custom"); + h.get_by_role_and_label(Role::SpinButton, "Reds").click(); + h.run_steps(1); + h.key_press_modifiers(egui::Modifiers::COMMAND, egui::Key::A); + h.event(egui::Event::Text(red.to_string())); + h.run_steps(1); + h.key_press(egui::Key::Tab); + h.run_steps(4); + assert_eq!(layer(h).1, defaults); + assert_black_white_preset(h, "Custom"); + }; - h.get_by_role_and_label(Role::SpinButton, "Reds").click(); - h.run_steps(1); - h.key_press_modifiers(egui::Modifiers::COMMAND, egui::Key::A); - h.event(egui::Event::Text(red.to_string())); - h.run_steps(1); - h.key_press(egui::Key::Tab); - h.run_steps(4); - assert_eq!(layer(&h).1, defaults); - assert_black_white_preset(&h, "Custom"); + type_default(&mut h); h.state_mut().run("layer.newAdjustmentLayer.blackWhite", json!({})).unwrap(); h.run_steps(4); @@ -583,4 +586,12 @@ fn black_white_presets_distinguish_manual_edits_from_named_choices() { assert_black_white_preset(&h, "Default"); assert_eq!(layer(&h).1, defaults); assert_eq!(history_len(&h), history); + + type_default(&mut h); + h.get_by_role_and_label(Role::Button, "Reset to defaults").scroll_to_me(); + h.run_steps(2); + h.get_by_role_and_label(Role::Button, "Reset to defaults").click(); + h.run_steps(4); + assert_black_white_preset(&h, "Default"); + assert_eq!(layer(&h).1, defaults); } diff --git a/crates/ui-egui/src/panels/properties.rs b/crates/ui-egui/src/panels/properties.rs index 08dd6ac85c4..e2f6daa62d2 100644 --- a/crates/ui-egui/src/panels/properties.rs +++ b/crates/ui-egui/src/panels/properties.rs @@ -156,6 +156,9 @@ fn adjustment_controls(app: &mut PhotocraftApp, ui: &mut egui::Ui, id: LayerId, let params = crate::adjust_editors::layer_reset(app, id, adj); let _ = app.run("layer.setAdjustment", params); app.live_adjust = None; + if matches!(adj, photocraft_doc::Adjustment::BlackWhite { .. }) { + crate::adjust_editors::black_white_presets::clear_custom(ui); + } } } From d87cdb8792e3ce56b10f1417271de2432c147fe2 Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 24 Nov 2026 23:08:49 +0000 Subject: [PATCH 10/61] Discard the temporary key when storing preset editor state --- .../ui-egui/src/dialogs/adjust_editors/black_white_presets.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs b/crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs index ca5f03100d4..720dee307e7 100644 --- a/crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs +++ b/crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs @@ -91,7 +91,9 @@ pub(super) fn show(ui: &mut Ui, value: &mut BlackWhite, context: AdjustContext) manual = (!reset).then(|| (*after).into()); } ui.data_mut(|d| match manual { - Some(value) => d.insert_temp(id, value), + Some(value) => { + d.insert_temp(id, value); + } None => d.remove::(id), }); From 98681840296d8b9954f184ca5e272d3a53409551 Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 24 Nov 2026 23:31:15 +0000 Subject: [PATCH 11/61] Retarget the adjustment after switching layers in the preset test --- crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs b/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs index a4c88a1036b..65fa0536236 100644 --- a/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs +++ b/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs @@ -575,6 +575,8 @@ fn black_white_presets_distinguish_manual_edits_from_named_choices() { h.run_steps(4); assert_black_white_preset(&h, "Default"); h.state_mut().run("layer.select", json!({"layer": id.0})).unwrap(); + // Layer selection can keep the mask targeted. Return to the adjustment's controls. + h.state_mut().run("channel.target.composite", json!({})).unwrap(); h.run_steps(4); assert_black_white_preset(&h, "Custom"); From 2b1afe637cabe3eba622c8edd3e92b279aa8dfe4 Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 24 Nov 2026 23:55:37 +0000 Subject: [PATCH 12/61] Group Black & White presets and exercise every mix --- .../adjust_editors/black_white_presets.rs | 4 +- .../src/dialogs/adjust_editors/ui_tests.rs | 45 +++++++++++++++++++ 2 files changed, 48 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs b/crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs index 720dee307e7..0c999dd787c 100644 --- a/crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs +++ b/crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs @@ -15,9 +15,10 @@ use super::{AdjustAsk, AdjustOut, AdjustValue}; type Mix = [f64; 6]; /// The presets change the grayscale mix and keep the layer's tint settings. -fn entries() -> [Entry>; 14] { +fn entries() -> [Entry>; 16] { [ Entry::new(Some(BlackWhite::DEFAULT_WEIGHTS), tl!("Default")), + Entry::separator(), Entry::new(Some([22.0, 38.0, 25.0, 36.0, 10.0, 50.0]), tl!("Darker")), Entry::new(Some([60.0, 77.0, 64.0, 78.0, 47.0, 92.0]), tl!("Lighter")), Entry::new(Some([8.0; 6]), tl!("Deep Shadows")), @@ -30,6 +31,7 @@ fn entries() -> [Entry>; 14] { Entry::new(Some([100.0, 73.0, 24.0, 7.0, 5.0, 64.0]), tl!("Strong Red Filter")), Entry::new(Some([4.0, 12.0, 27.0, 71.0, 100.0, 44.0]), tl!("Strong Blue Filter")), Entry::new(Some([58.0, 89.0, 97.0, 38.0, 8.0, 33.0]), tl!("Infrared Foliage")), + Entry::separator(), Entry::new(None, tl!("Custom")), ] } diff --git a/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs b/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs index 65fa0536236..e2ebefaa699 100644 --- a/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs +++ b/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs @@ -497,6 +497,51 @@ fn assert_black_white_preset(h: &Harness<'_, Box>, name: &str) { assert_eq!(h.get_by_role_and_label(Role::ComboBox, "Preset").accesskit_node().value().as_deref(), Some(name)); } +#[test] +fn black_white_presets_each_set_a_distinct_mix_and_keep_tint() { + let mut h = app_harness("blackWhite", "rgb", 8); + // Leave enough vertical space for the complete dropdown to be visible at once. + h.set_size(vec2(1440.0, 1350.0)); + let (id, _) = layer(&h); + h.state_mut().run("layer.setAdjustment", json!({"layer": id.0, "tint": true, "tintColor": "#336699"})).unwrap(); + h.run_steps(4); + let (_, original) = layer(&h); + let Adjustment::BlackWhite { tint: original_tint, .. } = &original else { panic!("{original:?}") }; + + let mut seen = Vec::new(); + for name in [ + "Darker", + "Lighter", + "Deep Shadows", + "Bright Highlights", + "Even Color Weights", + "Red Filter", + "Yellow Filter", + "Green Filter", + "Blue Filter", + "Strong Red Filter", + "Strong Blue Filter", + "Infrared Foliage", + "Default", + ] { + let history = history_len(&h); + h.get_by_role_and_label(Role::ComboBox, "Preset").click(); + h.run_steps(3); + h.get_by_role_and_label(Role::ListBoxOption, name).click(); + h.run_steps(4); + + let (_, applied) = layer(&h); + let Adjustment::BlackWhite { weights, tint } = applied else { panic!("{applied:?}") }; + assert!(!seen.contains(&weights), "{name} must set a distinct mix"); + seen.push(weights); + assert_black_white_preset(&h, name); + assert_eq!(&tint, original_tint, "{name} preserves Tint"); + assert_eq!(history_len(&h), history + 1, "{name} is one history step"); + assert!(h.state().live_adjust.is_none(), "{name} finishes the preview"); + } + assert_eq!(layer(&h).1, original, "Default restores the original mix"); +} + #[test] fn black_white_presets_apply_through_properties_and_undo() { let mut h = app_harness("blackWhite", "rgb", 8); From 4ab8225b5d17d241877bec6ea5188557ebe4ac56 Mon Sep 17 00:00:00 2001 From: Dan Date: Wed, 25 Nov 2026 20:27:28 +0000 Subject: [PATCH 13/61] Keep Default visible in the Black & White preset test --- crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs b/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs index 027ba82e5ec..06fb26c2847 100644 --- a/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs +++ b/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs @@ -493,6 +493,7 @@ fn black_white_auto_button_sets_the_weights() { assert_eq!(history_len(&h), steps + 1); } +#[track_caller] fn assert_black_white_preset(h: &Harness<'_, Box>, name: &str) { assert_eq!(h.get_by_role_and_label(Role::ComboBox, "Preset").accesskit_node().value().as_deref(), Some(name)); } @@ -594,6 +595,8 @@ fn black_white_presets_apply_through_properties_and_undo() { #[test] fn black_white_presets_distinguish_manual_edits_from_named_choices() { let mut h = app_harness("blackWhite", "rgb", 8); + // Opening the dropdown on Custom reveals the last row, so leave room for Default too. + h.set_size(vec2(1440.0, 1350.0)); let (id, defaults) = layer(&h); let Adjustment::BlackWhite { weights, .. } = &defaults else { panic!("{defaults:?}") }; let red = weights[0]; From 6dbbd6383e409386169ecc09899bedba8b789e73 Mon Sep 17 00:00:00 2001 From: tydude001 <291262504+tydude001@users.noreply.github.com> Date: Thu, 26 Nov 2026 14:51:09 -0600 Subject: [PATCH 14/61] Single instance: docs for the CPU relaunch, instance.json cleanup and the 0600 lock (#6654 review) docs/development.md's single-instance paragraph now says that the CPU-compatibility relaunch's own --safe-gpu doesn't keep it out of single-instance, that the primary removes its instance.json (while it still names this process) before freeing the lock, and that instance.lock is 0600 on Unix (the settings folder 0700 when single-instance creates it). Docs only. cargo xtask ci (Fedora 44 toolbox, x86_64): fmt, clippy, layers, scorecard, panic_hunt, doctest and wasm pass. In test, three tests fail in crates this branch doesn't change: photocraft-automation's dropping_a_waited_command_cancels_its_job and photocraft-gpu's a_refresh_that_submits_several_times_is_one_measurement (both also failed on main 2ff8f419c), and photocraft-ui-egui's opening_a_document_changes_state_not_structure, which fails in 2 of 3 full runs of that binary and passes on its own. --- docs/development.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/development.md b/docs/development.md index 18a7610ee08..901bf817d6e 100644 --- a/docs/development.md +++ b/docs/development.md @@ -134,7 +134,7 @@ CRAFT_FONTS_DIR="$PWD/../craft-fonts" cargo test --workspace # runs the Japa ## One instance per user -On Windows and Linux the first PhotoCraft holds an exclusive lock on `instance.lock` in the config directory and listens on a loopback port named in `instance.json` (with a fresh 256-bit token; the file is 0600 on Unix). Inside a Flatpak it listens on a Unix socket instead, `$XDG_RUNTIME_DIR/app//instance.sock` (0600), because Flatpak isolates each sandbox's network namespace, loopback included, unless the app is granted `--share=network`, while that runtime directory is shared by all sandboxes of the app (#1540); the lock, token and protocol are the same. A later launch hands its file arguments there and exits, so files opened from Explorer or a file manager become tabs in the running window (#3708). The primary answers `ok` only once its UI has taken the files; a launch that gets anything else (the primary is starting, hung or closing) keeps retrying the lock for up to 10 s, becoming the primary itself once the old one lets go, and then starts a separate instance, so a file is never acknowledged and lost. When the event loop ends (and before the CPU-compatibility relaunch) the primary refuses new files and frees the lock. It applies only with the per-user settings folder: a portable copy (`PhotoCraftData` beside the executable) or `PHOTOCRAFT_CONFIG_DIR` may be shared between users, so those launches run separately. So do `--new-instance` (or `PHOTOCRAFT_NEW_INSTANCE=1`), every `--control` launch, and launches given a per-process option (`--safe-gpu`, `--present-mode`, `--frame-latency`, `--stroke-trace`, `--in-window-menus`, `--automation-*-root`). A `cargo run` while an installed PhotoCraft is running forwards to it: pass `--new-instance` or set `PHOTOCRAFT_CONFIG_DIR`. macOS gets the same behaviour from LaunchServices (`apple_events.rs`). On native Wayland the running window can't bring itself forward (that takes the launcher's `XDG_ACTIVATION_TOKEN`, and winit 0.30 can't activate an existing window with one), so it asks for attention instead and the taskbar highlights it; X11, XWayland and Windows bring it to the front. Code: `apps/photocraft/src/single_instance.rs`. +On Windows and Linux the first PhotoCraft holds an exclusive lock on `instance.lock` in the config directory (0600 on Unix, narrowed on the next start if an earlier version left it readable; the directory is 0700 when single-instance creates it) and listens on a loopback port named in `instance.json` (with a fresh 256-bit token; the file is 0600 on Unix). Inside a Flatpak it listens on a Unix socket instead, `$XDG_RUNTIME_DIR/app//instance.sock` (0600), because Flatpak isolates each sandbox's network namespace, loopback included, unless the app is granted `--share=network`, while that runtime directory is shared by all sandboxes of the app (#1540); the lock, token and protocol are the same. A later launch hands its file arguments there and exits, so files opened from Explorer or a file manager become tabs in the running window (#3708). The primary answers `ok` only once its UI has taken the files; a launch that gets anything else (the primary is starting, hung or closing) keeps retrying the lock for up to 10 s, becoming the primary itself once the old one lets go, and then starts a separate instance, so a file is never acknowledged and lost. When the event loop ends (and before the CPU-compatibility relaunch) the primary refuses new files, removes its `instance.json` (only while it still names this process) and then frees the lock. It applies only with the per-user settings folder: a portable copy (`PhotoCraftData` beside the executable) or `PHOTOCRAFT_CONFIG_DIR` may be shared between users, so those launches run separately. So do `--new-instance` (or `PHOTOCRAFT_NEW_INSTANCE=1`), every `--control` launch, and launches given a per-process option (`--safe-gpu`, `--present-mode`, `--frame-latency`, `--stroke-trace`, `--in-window-menus`, `--automation-*-root`). The CPU-compatibility relaunch is the exception: the `--safe-gpu` it adds itself (it also sets `PHOTOCRAFT_GPU_STARTUP_FAILURE`) doesn't count, so the relaunch takes over as the primary from the launch that failed; a `--safe-gpu` a person passes still runs separately. A `cargo run` while an installed PhotoCraft is running forwards to it: pass `--new-instance` or set `PHOTOCRAFT_CONFIG_DIR`. macOS gets the same behaviour from LaunchServices (`apple_events.rs`). On native Wayland the running window can't bring itself forward (that takes the launcher's `XDG_ACTIVATION_TOKEN`, and winit 0.30 can't activate an existing window with one), so it asks for attention instead and the taskbar highlights it; X11, XWayland and Windows bring it to the front. Code: `apps/photocraft/src/single_instance.rs`. ## Graphics startup and device loss From a2f63044c976b7022d373f42d44c4db0bc4d1582 Mon Sep 17 00:00:00 2001 From: KrataPremium <155114492+kratagit@users.noreply.github.com> Date: Sat, 28 Nov 2026 22:12:11 +0100 Subject: [PATCH 15/61] fix(analysis): name measurement scale history steps after the submenu entry Custom (dialog, preset, script set) adds "Custom Measurement Scale" and Default adds "Set Default Measurement Scale", as the reference application does; an unchanged scale still adds no step. Fixes #17410. --- crates/engine-core/src/cmd/analysis_cmds.rs | 6 +- .../scale_history_names_tests.rs | 60 +++++++++++++++++++ 2 files changed, 65 insertions(+), 1 deletion(-) create mode 100644 crates/engine-core/src/cmd/analysis_cmds/scale_history_names_tests.rs diff --git a/crates/engine-core/src/cmd/analysis_cmds.rs b/crates/engine-core/src/cmd/analysis_cmds.rs index 5e6de123bd6..401737c6fbd 100644 --- a/crates/engine-core/src/cmd/analysis_cmds.rs +++ b/crates/engine-core/src/cmd/analysis_cmds.rs @@ -296,8 +296,10 @@ fn set_scale(s: &mut Session, p: &Value) -> Result { other => return Err(bad(CMD, format!("unknown preset `{other}` (default|custom)"))), }; if next != cur { + // The reference names the step after the submenu entry that made it (#17410). + let label = if preset == "default" { "Set Default Measurement Scale" } else { "Custom Measurement Scale" }; let n = next.clone(); - s.edit("Set Measurement Scale", move |d, _| { + s.edit(label, move |d, _| { d.measurement.scale = n; Ok(()) })?; @@ -1409,4 +1411,6 @@ mod analysis_straighten_enabled_tests; #[path = "analysis_straighten_selection_tests.rs"] mod analysis_straighten_selection_tests; #[cfg(test)] +mod scale_history_names_tests; +#[cfg(test)] mod tests; diff --git a/crates/engine-core/src/cmd/analysis_cmds/scale_history_names_tests.rs b/crates/engine-core/src/cmd/analysis_cmds/scale_history_names_tests.rs new file mode 100644 index 00000000000..de5298f1b3e --- /dev/null +++ b/crates/engine-core/src/cmd/analysis_cmds/scale_history_names_tests.rs @@ -0,0 +1,60 @@ +//! History step names of Image › Analysis › Set Measurement Scale, measured against the reference +//! application (#17410): Custom (the dialog, a preset, a script set) adds one step "Custom +//! Measurement Scale", Default adds one step "Set Default Measurement Scale", and a call that +//! leaves the scale as it is adds no step. + +use super::*; + +const CMD: &str = "image.analysis.setMeasurementScale"; + +fn session() -> Session { + let mut s = crate::session(); + s.execute("file.new", json!({"width": 40, "height": 30, "background": "white"})).unwrap(); + s +} + +fn steps(s: &Session) -> usize { + s.active().unwrap().history.past_len() +} + +fn last_step(s: &Session) -> String { + s.active().unwrap().history.entries().last().cloned().unwrap_or_default() +} + +#[test] +fn custom_and_bare_values_add_one_custom_step() { + for p in [ + json!({"preset": "custom", "pixelLength": 100, "logicalLength": 2.5, "units": "cm"}), + json!({"pixelLength": 100, "logicalLength": 2.5, "units": "cm"}), + json!({"units": "mm"}), + ] { + let mut s = session(); + let before = steps(&s); + s.execute(CMD, p.clone()).unwrap(); + assert_eq!(steps(&s), before + 1, "{p}"); + assert_eq!(last_step(&s), "Custom Measurement Scale", "{p}"); + } +} + +#[test] +fn default_adds_one_default_step() { + let mut s = session(); + s.execute(CMD, json!({"pixelLength": 10, "logicalLength": 1, "units": "cm"})).unwrap(); + let before = steps(&s); + s.execute(CMD, json!({"preset": "default"})).unwrap(); + assert_eq!(steps(&s), before + 1); + assert_eq!(last_step(&s), "Set Default Measurement Scale"); +} + +#[test] +fn unchanged_scale_adds_no_step() { + let mut s = session(); + let before = steps(&s); + s.execute(CMD, json!({"preset": "default"})).unwrap(); + assert_eq!(steps(&s), before, "Default on a default scale"); + let p = json!({"pixelLength": 10, "logicalLength": 1, "units": "cm"}); + s.execute(CMD, p.clone()).unwrap(); + let before = steps(&s); + s.execute(CMD, p).unwrap(); + assert_eq!(steps(&s), before, "the same custom values again"); +} From 9632cc90926bcbbcb3bd4829e5bc55be40b6abb2 Mon Sep 17 00:00:00 2001 From: ruchirguitar Date: Mon, 30 Nov 2026 18:48:39 +0530 Subject: [PATCH 16/61] ui-egui: Digits select in the Character panel (#10996) The Character panel shows the target's digit style (as typed, Western, contextual or an Indic script) and a pick sets it through the type command's digits key. --- .../panels/type_panels_ui/style_options.rs | 21 +++++- .../type_tool/character_panel_digits_tests.rs | 68 +++++++++++++++++++ crates/ui-egui/src/tools/type_tool/panel.rs | 7 +- crates/ui-egui/src/tools/type_tool/values.rs | 26 ++++++- docs/scorecard.md | 2 +- scorecard/type.toml | 2 +- 6 files changed, 120 insertions(+), 6 deletions(-) create mode 100644 crates/ui-egui/src/tools/type_tool/character_panel_digits_tests.rs diff --git a/crates/ui-egui/src/panels/type_panels_ui/style_options.rs b/crates/ui-egui/src/panels/type_panels_ui/style_options.rs index 255a6aeddbf..c69fdf91fc7 100644 --- a/crates/ui-egui/src/panels/type_panels_ui/style_options.rs +++ b/crates/ui-egui/src/panels/type_panels_ui/style_options.rs @@ -7,7 +7,7 @@ use craft::text::ui::character::{ StyleOptionValues, StyleOptionsChange, TextAlign, TextStyleOptions, }; use craft::theme::Rgba; -use photocraft_doc::text::{CharStyle, ParagraphStyle}; +use photocraft_doc::text::{CharStyle, Digits, ParagraphStyle}; use serde_json::{Value, json}; use super::{color_picker, run}; @@ -157,10 +157,29 @@ pub(crate) fn character_values(style: &CharStyle) -> CharacterValues { values.strikethrough = Some(style.strikethrough); values.opentype = opentype; values.language = style.language.clone(); + values.digits = Some(digit_name(style.digits).to_string()); values } /// The values the Paragraph controls show for `style`. +/// The engine's `digits` name of a digit style. +pub(crate) fn digit_name(d: Digits) -> &'static str { + match d { + Digits::AsTyped => "asTyped", + Digits::Western => "western", + Digits::Contextual => "contextual", + Digits::Devanagari => "devanagari", + Digits::Bengali => "bengali", + Digits::Gurmukhi => "gurmukhi", + Digits::Gujarati => "gujarati", + Digits::Odia => "odia", + Digits::Tamil => "tamil", + Digits::Telugu => "telugu", + Digits::Kannada => "kannada", + Digits::Malayalam => "malayalam", + } +} + pub(crate) fn paragraph_values(style: &ParagraphStyle) -> ParagraphValues { use photocraft_doc::text::TextDirection as D; let mut values = ParagraphValues::default(); diff --git a/crates/ui-egui/src/tools/type_tool/character_panel_digits_tests.rs b/crates/ui-egui/src/tools/type_tool/character_panel_digits_tests.rs new file mode 100644 index 00000000000..1e35edee681 --- /dev/null +++ b/crates/ui-egui/src/tools/type_tool/character_panel_digits_tests.rs @@ -0,0 +1,68 @@ +//! The Character panel's Digits select (#10996): it shows the selected layer's digit style, and a pick restyles the +//! selected type layer's digits through the type command, in one history step. + +use egui::accesskit::Role; +use egui::vec2; +use egui_kittest::Harness; +use egui_kittest::kittest::Queryable; +use photocraft_doc::LayerId; +use photocraft_doc::text::Digits; +use serde_json::json; + +use crate::PhotocraftApp; +use crate::app::framework::BuildApp; + +const SELECT: &str = "Digits"; + +/// One selected type layer with digits in its text. +fn one_layer() -> (Box, LayerId) { + let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default()); + app.run("file.new", json!({"width": 800, "height": 600})).unwrap(); + app.sync_views(); + app.ui.tool = crate::state::Tool::Type; + let made = app.run("type.create", json!({"text": "Room 42", "font": "Inter", "size": 24, "x": 40, "y": 80})).unwrap(); + let id = LayerId(made["layer"].as_u64().unwrap()); + app.run("layer.select", json!({"layer": id.0, "mode": "replace"})).unwrap(); + (app, id) +} + +fn harness(app: Box) -> Harness<'static, Box> { + // Wait for the font scan: while it runs the panels repaint every 100 ms and `Harness::run` gives up. + let _ = photocraft_text::shared(); + let mut h = Harness::builder().with_context(app.ctx().clone()).with_size(vec2(760.0, 1200.0)).with_max_steps(16).build_app( + move |ui, app: &mut PhotocraftApp| { + ui.set_width(340.0); + super::character_panel(app, ui, false); + }, + app, + ); + h.run_steps(4); + h +} + +fn digits(app: &PhotocraftApp, id: LayerId) -> Vec { + let text = super::super::text_layer(&app.session.active().unwrap().doc, id).unwrap(); + text.char_runs().into_iter().map(|r| r.style.digits).collect() +} + +fn shown(h: &Harness<'static, Box>) -> String { + h.get_by_role_and_label(Role::ComboBox, SELECT).value().unwrap_or_default() +} + +#[test] +fn a_digits_pick_restyles_the_selected_layer_in_one_history_step() { + let (app, id) = one_layer(); + let before = digits(&app, id); + let steps = app.session.active().unwrap().history.entries().len(); + let mut h = harness(app); + let was = shown(&h); + h.get_by_role_and_label(Role::ComboBox, SELECT).click(); + h.run(); + h.get_by_role_and_label(Role::ListBoxOption, "Devanagari").click(); + h.run(); + let after = digits(h.state(), id); + assert_ne!(after, before, "the pick changed the layer's digits"); + assert!(after.iter().all(|d| *d == Digits::Devanagari), "every run takes the picked style: {after:?}"); + assert_eq!(h.state().session.active().unwrap().history.entries().len(), steps + 1, "one history step"); + assert_ne!(shown(&h), was, "the select shows the new style"); +} diff --git a/crates/ui-egui/src/tools/type_tool/panel.rs b/crates/ui-egui/src/tools/type_tool/panel.rs index e9eb1a7d1f0..32cb870607b 100644 --- a/crates/ui-egui/src/tools/type_tool/panel.rs +++ b/crates/ui-egui/src/tools/type_tool/panel.rs @@ -78,7 +78,8 @@ fn character_controls(app: &mut PhotocraftApp, ui: &mut egui::Ui, unit: DocUnit, let styles = values::style_names(app, &shown); let face = values::face_axes(app); let mut font_state = fonts::font_state(app); - let mut controls = CharacterControls::new(tl!("Character"), &shown, &families, &styles).unit(unit); + let digits = values::digit_entries(); + let mut controls = CharacterControls::new(tl!("Character"), &shown, &families, &styles).unit(unit).digits(&digits); controls = controls.font_picker(font_state.source()); if let Some(face) = &face { controls = controls.axes(face.view()); @@ -147,6 +148,10 @@ fn type_options(app: &mut PhotocraftApp, ui: &mut egui::Ui) { }); } +#[cfg(test)] +#[path = "character_panel_digits_tests.rs"] +mod character_panel_digits_tests; + #[cfg(test)] #[path = "character_panel_anti_alias_tests.rs"] mod character_panel_anti_alias_tests; diff --git a/crates/ui-egui/src/tools/type_tool/values.rs b/crates/ui-egui/src/tools/type_tool/values.rs index c9bdb4fe9e5..6653f9db7d4 100644 --- a/crates/ui-egui/src/tools/type_tool/values.rs +++ b/crates/ui-egui/src/tools/type_tool/values.rs @@ -16,14 +16,14 @@ use craft::text::ui::character::{ use craft::text::ui::type_bar::TypeBarChange; use craft::text::ui::type_options::{TextAntiAlias, TextOrientation}; use craft::ui::runtime::env::UnitKind; -use photocraft_doc::text::{CharStyle, ParagraphStyle}; +use photocraft_doc::text::{CharStyle, Digits, ParagraphStyle}; use super::defaults::{apply, default_styles, formatting_params, open_color_picker, shown_scale, target, target_doc, target_text}; use super::fonts; use super::options_bar::{kerning_at, styles_at}; use super::panel::{OPENTYPE_BUTTONS, toggle_opentype}; use super::{LayerId, PhotocraftApp, byte_of, json, text_layer}; -use crate::panels::type_panels_ui::style_options::{character_values as style_character_values, paragraph_values as style_paragraph_values}; +use crate::panels::type_panels_ui::style_options::{character_values as style_character_values, digit_name, paragraph_values as style_paragraph_values}; /// The unit the type controls show lengths in (Preferences ▸ Units & Rulers ▸ Type); pixels follow the document's /// resolution. Values stay in points. @@ -93,6 +93,27 @@ fn runs_at_target(app: &PhotocraftApp) -> Option<(Vec, Vec Vec<(String, String)> { + [ + (Digits::AsTyped, tl!("As Typed")), + (Digits::Western, tl!("Western")), + (Digits::Contextual, tl!("Contextual")), + (Digits::Devanagari, tl!("Devanagari")), + (Digits::Bengali, tl!("Bengali")), + (Digits::Gurmukhi, tl!("Gurmukhi")), + (Digits::Gujarati, tl!("Gujarati")), + (Digits::Odia, tl!("Odia")), + (Digits::Tamil, tl!("Tamil")), + (Digits::Telugu, tl!("Telugu")), + (Digits::Kannada, tl!("Kannada")), + (Digits::Malayalam, tl!("Malayalam")), + ] + .into_iter() + .map(|(d, label)| (digit_name(d).to_string(), label.to_string())) + .collect() +} + /// The character values at the target: equal values shown, differing ones mixed. Sizes show as the layer appears /// (a 12 pt layer scaled 200 % reads 24 pt). pub(crate) fn character_values(app: &PhotocraftApp) -> CharacterValues { @@ -305,6 +326,7 @@ fn character_step(change: &CharacterChange) -> Option { CharacterChange::Strikethrough(on) => json!({"strikethrough": on}), CharacterChange::OpenType { tag, on, .. } => return Some(Step::OpenType { tag, on: *on }), CharacterChange::Language(tag) => json!({"language": tag}), + CharacterChange::Digits(tag) => json!({"digits": tag}), CharacterChange::Axes(axes) => { let map: serde_json::Map = axes.iter().map(|(tag, v)| (String::from_utf8_lossy(tag).trim().to_string(), json!(v))).collect(); diff --git a/docs/scorecard.md b/docs/scorecard.md index e984cf914e7..4579ee1b59a 100644 --- a/docs/scorecard.md +++ b/docs/scorecard.md @@ -261,7 +261,7 @@ Unread: `general.color_picker`, `workspace.auto_show_hidden_panels`, `workspace. | TYPE-218-8 | Text editing: select all, double/triple/quadruple-click selection, paste, with tests | done | [#218](https://github.com/storytold/photocraft/issues/218) | Like Photoshop, 2 clicks select the word, 3 the laid-out line (a column in vertical type), 4 the paragraph up to the hard return, 5 all text, and the next quick click starts over (#3493; type_tool.rs next_click_count, click_selection, multi_click). Tested through real canvas clicks in point, paragraph and vertical type, with paste replacing the selection and Cmd+A selecting all (type_tool_tests.rs multi_click_selects_word_line_paragraph_and_all_in_point_text, multi_click_separates_wrapped_lines_from_paragraphs, click_counts_cycle_and_restart, click_selection_without_layout_and_on_hostile_input, multi_click_without_a_session_does_nothing) | | TYPE-218-9 | Distort/Perspective/Warp on live type as in Photoshop (was: offer 'Rasterize and continue?'; Photoshop doesn't prompt) | done | [#218](https://github.com/storytold/photocraft/issues/218) | Photoshop 2026 prompts for none of these: Edit › Transform › Warp on live type stays enabled with no rasterize prompt and offers only the warp styles (the mesh can't be dragged), so the type stays editable; Distort, Perspective and the split warps are greyed. PhotoCraft does the same: Warp on type commits the layer's Warp Text in one step (transform_tool.rs enter_type_warp, warp_cmds.rs warp_type_layer, #3004; warp_on_type_takes_a_style_and_keeps_the_type_editable), Distort/Perspective greyed (enable_rules.rs, #2701) | | TYPE-218-10 | Area type: Type tool click inside a closed path or shape wraps text inside it, holes and dents included, PSD round trip | partial | [#218](https://github.com/storytold/photocraft/issues/218) | TextShape::Area (doc text.rs) laid out line by line into the spans the path leaves (text area.rs, layout.rs break_area), type.fillPath (engine type_area_cmds.rs), released to box text by type.detachFromPath, area/path cursors and click-to-place (ui-egui type_tool.rs path_target), .pcraft round trip. Missing: PSD area type (saves as paragraph text over the path's bounds, with an export warning); mixed type sizes in one area paragraph space at its largest line; area type takes paths of at most 4096 anchors: beyond that a Type tool click makes point text (the pointer shows the plain I-beam), and type.fillPath refuses the path with "the path has too many anchor points" (type.attachToPath still takes a subpath of up to 100,000 anchors); a word too wide for every span in the shape overflows its span (box text breaks it at the edge, #6694); the first line starts about 0.24 em lower than in a text box of the same size; Photoshop area type in a PSD opens as box text; the area path has no handles to edit it after the type is placed | -| TYPE-10996-1 | Digit style: digits drawn as typed, Western, by the script of the letters before them, or in an Indic script (Devanagari, Bengali, Gurmukhi, Gujarati, Odia, Tamil, Telugu, Kannada, Malayalam) | partial | [#10996](https://github.com/storytold/photocraft/issues/10996) | CharStyle `digits` (doc text.rs), drawn in shaping (text digits.rs) while the layer text keeps the typed digits; set through the type commands' `digits` key. No Character panel control yet (needs the shared panel in craft-libs); Arabic and Persian digits are #6685; not saved in PSD | +| TYPE-10996-1 | Digit style: digits drawn as typed, Western, by the script of the letters before them, or in an Indic script (Devanagari, Bengali, Gurmukhi, Gujarati, Odia, Tamil, Telugu, Kannada, Malayalam) | partial | [#10996](https://github.com/storytold/photocraft/issues/10996) | CharStyle `digits` (doc text.rs), drawn in shaping (text digits.rs) while the layer text keeps the typed digits; set through the type commands' `digits` key. The Character panel's Digits select sets it; Arabic and Persian digits are #6685; not saved in PSD | ## Automation diff --git a/scorecard/type.toml b/scorecard/type.toml index 579e92e5715..9626765742b 100644 --- a/scorecard/type.toml +++ b/scorecard/type.toml @@ -79,4 +79,4 @@ id = "TYPE-10996-1" target = "Digit style: digits drawn as typed, Western, by the script of the letters before them, or in an Indic script (Devanagari, Bengali, Gurmukhi, Gujarati, Odia, Tamil, Telugu, Kannada, Malayalam)" status = "partial" issue = 10996 -note = "CharStyle `digits` (doc text.rs), drawn in shaping (text digits.rs) while the layer text keeps the typed digits; set through the type commands' `digits` key. No Character panel control yet (needs the shared panel in craft-libs); Arabic and Persian digits are #6685; not saved in PSD" +note = "CharStyle `digits` (doc text.rs), drawn in shaping (text digits.rs) while the layer text keeps the typed digits; set through the type commands' `digits` key. The Character panel's Digits select sets it; Arabic and Persian digits are #6685; not saved in PSD" From 20201d4ed4726f703d47b954641eaa6e57d22b0b Mon Sep 17 00:00:00 2001 From: ruchirguitar Date: Mon, 30 Nov 2026 21:33:36 +0530 Subject: [PATCH 17/61] ui-egui: keep a caret's chosen font across a Digits change before typing A character change at a collapsed caret (Digits, size, tracking...) cleared the font chosen there but not yet typed. The pending font now holds for the new revision on the style the command stored, so the next typed text takes both. --- .../ui-egui/src/tools/type_tool/defaults.rs | 8 ++++++- .../src/tools/type_tool/font_commit_tests.rs | 23 +++++++++++++++++++ .../src/tools/type_tool/insertion_style.rs | 17 ++++++++++++++ 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/tools/type_tool/defaults.rs b/crates/ui-egui/src/tools/type_tool/defaults.rs index 48b9408096d..0c62fbd6698 100644 --- a/crates/ui-egui/src/tools/type_tool/defaults.rs +++ b/crates/ui-egui/src/tools/type_tool/defaults.rs @@ -230,6 +230,8 @@ pub(super) fn apply(app: &mut PhotocraftApp, props: serde_json::Value, coalesce: if insertion_style::set_font(app, &props) { return; } + // A font chosen at the caret and not yet typed outlives another character change there (#10996). + let kept = insertion_style::pending(app).cloned(); app.ui.type_insertion_style = None; let Some(mut p) = formatting_params(app) else { apply_defaults(app, &props); @@ -243,7 +245,11 @@ pub(super) fn apply(app: &mut PhotocraftApp, props: serde_json::Value, coalesce: if let Some(key) = app.ui.text_edit.as_ref().map(|ed| ed.session.clone()).or(coalesce) { p["coalesce"] = json!(key); } - let _ = app.run("type.setStyle", p); + if app.run("type.setStyle", p).is_ok() + && let Some(kept) = kept + { + insertion_style::rebase(app, kept); + } } /// Open the shared Color Picker with a snapshot of the text target. Sampling or cancelling diff --git a/crates/ui-egui/src/tools/type_tool/font_commit_tests.rs b/crates/ui-egui/src/tools/type_tool/font_commit_tests.rs index 9d1c96e054d..7451cf30acf 100644 --- a/crates/ui-egui/src/tools/type_tool/font_commit_tests.rs +++ b/crates/ui-egui/src/tools/type_tool/font_commit_tests.rs @@ -385,3 +385,26 @@ fn an_existing_empty_layer_keeps_its_font_when_committed() { assert_eq!(families(&saved(&h, id)), [FONTS[1]]); } } + +/// A font chosen at the caret survives a Digits change there before typing (#10996): the typed digit takes the +/// chosen font and the picked digit style. +#[test] +fn a_digits_change_at_the_caret_keeps_the_chosen_typing_font() { + let (mut h, id) = fixture(0, "abcdef"); + select(&mut h, [3, 3]); + h.run(); + choose(&mut h, FONTS[1], "enter"); + assert!(super::insertion_style::pending(h.state()).is_some(), "a pending font at the caret"); + super::apply(h.state_mut(), json!({"digits": "devanagari"}), None); + assert!(super::insertion_style::pending(h.state()).is_some(), "the Digits change keeps the pending font"); + super::host::type_text(h.state_mut(), "5"); + h.run(); + assert_eq!(families(&saved(&h, id))[3], FONTS[1], "the typed digit takes the chosen font"); + let t = layer(&h.state().session.active().unwrap().doc, id); + let mut offset = 0; + let digits = t.char_runs().into_iter().find_map(|r| { + offset += r.len; + (offset > 3).then_some(r.style.digits) + }); + assert_eq!(digits, Some(photocraft_doc::text::Digits::Devanagari), "the typed digit takes the picked digit style"); +} diff --git a/crates/ui-egui/src/tools/type_tool/insertion_style.rs b/crates/ui-egui/src/tools/type_tool/insertion_style.rs index 05a2624c99a..a8c33c2e2b0 100644 --- a/crates/ui-egui/src/tools/type_tool/insertion_style.rs +++ b/crates/ui-egui/src/tools/type_tool/insertion_style.rs @@ -49,6 +49,23 @@ pub(super) fn set_font(app: &mut PhotocraftApp, props: &serde_json::Value) -> bo true } +/// Keeps the caret's pending font `kept` after another character change at the same caret: the style the command +/// stored there (in the layer's own units) with the chosen font on it, for the new revision, so the next typed text +/// still takes the chosen font and the change. +pub(super) fn rebase(app: &mut PhotocraftApp, mut kept: TypeInsertionStyle) { + let Some((mut style, _)) = styles_at(app) else { return }; + let Some(st) = app.session.active() else { return }; + let chosen = &kept.style; + style.font_family.clone_from(&chosen.font_family); + style.weight = chosen.weight; + style.italic = chosen.italic; + style.postscript_name.clone_from(&chosen.postscript_name); + style.variations.clone_from(&chosen.variations); + kept.style = style; + kept.revision = st.revision; + app.ui.type_insertion_style = Some(kept); +} + /// How many characters `text` adds once the engine stores it: a CRLF pair becomes one `\n` (a lone CR is one /// character either way), so a pasted Windows line break moves the caret by one, not two. pub(super) fn stored_chars(text: &str) -> usize { From 3b37790849998b06c7313638d4e3a2784ef93e95 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 30 Nov 2026 17:24:55 +0000 Subject: [PATCH 18/61] Tests: speed up concurrent autosave recovery listing (#15937) --- crates/format/tests/it/autosave.rs | 62 +++++++++++++----------------- 1 file changed, 26 insertions(+), 36 deletions(-) diff --git a/crates/format/tests/it/autosave.rs b/crates/format/tests/it/autosave.rs index f6fb88343a2..07d8ff2f54a 100644 --- a/crates/format/tests/it/autosave.rs +++ b/crates/format/tests/it/autosave.rs @@ -340,43 +340,33 @@ fn a_listing_during_an_autosave_sees_the_entry_exactly_once() { let dir = temp_dir("listing-during-autosave"); let doc = Document::new("Busy", photocraft_doc::Size { width: 4, height: 4 }, ColorMode::Rgb, SampleType::U8); save_once(&dir, "busy", doc.clone()); - let done = Arc::new(std::sync::atomic::AtomicBool::new(false)); - let writer = { - let (dir, done) = (dir.clone(), done.clone()); - std::thread::spawn(move || { - // Sets `done` however the thread ends, so a failing writer stops the listing loop - // and `join` reports its panic instead of the test hanging. - struct SetOnDrop(Arc); - impl Drop for SetOnDrop { - fn drop(&mut self) { - self.0.store(true, std::sync::atomic::Ordering::SeqCst); - } - } - let _done = SetOnDrop(done); - let saver = Autosaver::new(&dir, "busy"); - for revision in 2..=200 { - saver.request(Arc::new(doc.clone()), revision, None, SaveOptions::default()); - // Wait for this write, so every revision replaces the sidecar once. - let completed = loop { - let completed = saver.take_completed(); - if !completed.is_empty() { - break completed; - } - std::thread::yield_now(); - }; - assert!(completed.iter().all(|(_, result)| result.is_ok()), "revision {revision}: {completed:?}"); - } - saver.flush() - }) - }; - let mut listings = 0u32; - while !done.load(std::sync::atomic::Ordering::SeqCst) { + let doc = Arc::new(doc); + let saver = Autosaver::new(&dir, "busy"); + let listed_revision = || { let entries = list_recovery(&dir); - let keys: Vec<&str> = entries.iter().map(|e| e.info.key.as_str()).collect(); - assert_eq!(keys, ["busy"], "listing {listings} during an autosave: {entries:?}"); - listings += 1; + let [entry] = entries.as_slice() else { panic!("expected one entry during autosave: {entries:?}") }; + assert_eq!(entry.info.key, "busy"); + entry.info.revision + }; + let deadline = std::time::Instant::now() + std::time::Duration::from_secs(5 * 60); + for revision in 2..=17 { + saver.request_checked(doc.clone(), revision, None, SaveOptions::default()).unwrap(); + loop { + // List on this thread while the autosave worker writes. The preceding sidecar or + // its replacement must supply the revision. A sidecar-less fallback reports zero. + let listed = listed_revision(); + assert!((revision - 1..=revision).contains(&listed), "listed revision {listed} while writing {revision}"); + let completed = saver.take_completed(); + if !completed.is_empty() { + let [(written, result)] = completed.as_slice() else { panic!("expected one completed write: {completed:?}") }; + assert_eq!(*written, revision); + result.as_ref().unwrap(); + break; + } + assert!(std::time::Instant::now() < deadline, "autosave did not complete revision {revision}"); + } + assert_eq!(listed_revision(), revision, "the completed replacement is visible"); } - assert!(writer.join().unwrap().is_some_and(|r| r.is_ok())); - assert!(listings > 0); + assert!(saver.flush().is_some_and(|r| r.is_ok())); std::fs::remove_dir_all(dir).unwrap(); } From 6d5bddb40dd05f36b7b049186fb5b3e1c897da83 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 30 Nov 2026 18:27:53 +0000 Subject: [PATCH 19/61] Tests: focus the Relight halo seam comparison (#15934) --- crates/algo/src/relight.rs | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/crates/algo/src/relight.rs b/crates/algo/src/relight.rs index d36454d238e..c8d8ae863d9 100644 --- a/crates/algo/src/relight.rs +++ b/crates/algo/src/relight.rs @@ -524,17 +524,25 @@ mod tests { #[test] fn tiles_match_a_full_apply_past_the_old_halo() { // Default softness on a 1600 px short side: σ = 32, reach 129 px. The previous - // 97 px halo left a gap, so 128 px tiles seamed. Tile 128 vs one full-frame tile. + // 97 px halo left a gap, so 128 px tiles seamed. let size = 1600; + let tile = 128; let bounds = Rect::new(0, 0, size, size); let s = shaded_sphere(SampleType::F32, size); let p = relight_p(180.0, 40.0, 60.0, 40.0, 0.0, 25.0); assert!(read_radius(sigma(25.0, bounds)) > 97); - let area = output_area(&p, s.content_bounds(), bounds, None); - let full = apply_tiled(&s, &p, area, bounds, None, 4096, None); - let tiled = apply_tiled(&s, &p, area, bounds, None, 128, None); - let inner = Rect::new(0, 0, size, size); - let d = max_diff(&full.read_region(inner), &tiled.read_region(inner)); + let layer = output_area(&p, s.content_bounds(), bounds, None); + // Keep the full-layer grid at the sphere's upper edge. The window includes a seam + // in each direction, partial tiles, and the top edge of the document. + let (x, y) = (layer.x0 + 6 * tile, layer.y0 + tile); + let side = tile + tile / 2; + let area = Rect::new(x, y, x + side, y + side); + let full = apply_tiled(&s, &p, area, bounds, None, side, None); + let tiled = apply_tiled(&s, &p, area, bounds, None, tile, None); + let inside = area.intersect(&bounds); + let expected = full.read_region(inside); + assert!(max_diff(&expected, &s.read_region(inside)) > 1e-4, "the window must be relit"); + let d = max_diff(&expected, &tiled.read_region(inside)); assert!(d <= 1e-4, "tile seam {d}"); } From 1f7acffe9435647bde5db7df5bab5e600e2a355f Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 30 Nov 2026 20:48:24 +0000 Subject: [PATCH 20/61] Tests: reuse canvas captures and batch mip readbacks (#15942) --- .../src/canvas/gpu_canvas/mip_gpu_tests.rs | 70 +++--- .../tests/it/free_transform_preview_canvas.rs | 27 ++- .../tests/it/gpu_tests/adjust_preview_gpu.rs | 21 +- .../ui-egui/tests/it/gpu_tests/canvas_16f.rs | 13 +- .../tests/it/gpu_tests/checker_canvas.rs | 217 +++++++++--------- .../tests/it/gpu_tests/drag_preview_canvas.rs | 2 +- .../tests/it/gpu_tests/live_stroke_canvas.rs | 39 ++-- 7 files changed, 215 insertions(+), 174 deletions(-) diff --git a/crates/ui-egui/src/canvas/gpu_canvas/mip_gpu_tests.rs b/crates/ui-egui/src/canvas/gpu_canvas/mip_gpu_tests.rs index 33dca070fe4..31c6faea62e 100644 --- a/crates/ui-egui/src/canvas/gpu_canvas/mip_gpu_tests.rs +++ b/crates/ui-egui/src/canvas/gpu_canvas/mip_gpu_tests.rs @@ -14,37 +14,48 @@ fn read_mips(gpu: &GpuCanvas, key: u64) -> Vec> { let tile = &doc.tiles[0]; let (device, queue) = (&gpu.rs.device, &gpu.rs.queue); let bpp = texel_bytes(doc.format) as usize; - (0..tile.levels.len()) + // Each level starts after a whole number of padded rows, so each copy offset has + // room for its own texels and meets the copy alignment for both canvas formats. + let mut size = 0; + let levels: Vec<_> = (0..tile.levels.len()) .map(|level| { let (w, h) = ((doc.size[0] >> level).max(1), (doc.size[1] >> level).max(1)); let row = (w as usize * bpp).next_multiple_of(wgpu::COPY_BYTES_PER_ROW_ALIGNMENT as usize); - let buffer = device.create_buffer(&wgpu::BufferDescriptor { - label: Some("mip_test_readback"), - size: (row * h as usize) as u64, - usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::MAP_READ, - mapped_at_creation: false, - }); - let mut encoder = device.create_command_encoder(&Default::default()); - encoder.copy_texture_to_buffer( - wgpu::TexelCopyTextureInfo { texture: &tile.texture, mip_level: level as u32, origin: wgpu::Origin3d::ZERO, aspect: wgpu::TextureAspect::All }, - wgpu::TexelCopyBufferInfo { - buffer: &buffer, - layout: wgpu::TexelCopyBufferLayout { offset: 0, bytes_per_row: Some(row as u32), rows_per_image: Some(h) }, - }, - wgpu::Extent3d { width: w, height: h, depth_or_array_layers: 1 }, - ); - queue.submit([encoder.finish()]); - buffer.slice(..).map_async(wgpu::MapMode::Read, |result| result.unwrap()); - assert!(gpu.health.wait(device, None)); - let data = buffer.slice(..).get_mapped_range().unwrap(); - let mut pixels = Vec::new(); - for y in 0..h as usize { - for x in 0..w as usize { - let offset = y * row + x * bpp; - pixels.push(texel_to_f32(doc.format, &data[offset..offset + bpp])); - } - } - pixels + let offset = size; + size += row * h as usize; + (w, h, row, offset) + }) + .collect(); + let buffer = device.create_buffer(&wgpu::BufferDescriptor { + label: Some("mip_test_readback"), + size: size as u64, + usage: wgpu::BufferUsages::COPY_DST | wgpu::BufferUsages::MAP_READ, + mapped_at_creation: false, + }); + let mut encoder = device.create_command_encoder(&Default::default()); + for (level, &(w, h, row, offset)) in levels.iter().enumerate() { + encoder.copy_texture_to_buffer( + wgpu::TexelCopyTextureInfo { texture: &tile.texture, mip_level: level as u32, origin: wgpu::Origin3d::ZERO, aspect: wgpu::TextureAspect::All }, + wgpu::TexelCopyBufferInfo { + buffer: &buffer, + layout: wgpu::TexelCopyBufferLayout { offset: offset as u64, bytes_per_row: Some(row as u32), rows_per_image: Some(h) }, + }, + wgpu::Extent3d { width: w, height: h, depth_or_array_layers: 1 }, + ); + } + let submission = queue.submit([encoder.finish()]); + let slice = buffer.slice(..); + slice.map_async(wgpu::MapMode::Read, |result| result.expect("map mip readback")); + assert!(gpu.health.wait_idle(device, Some(submission))); + let data = slice.get_mapped_range().expect("read mip snapshot"); + levels + .into_iter() + .map(|(w, h, row, offset)| { + data[offset..offset + row * h as usize] + .chunks_exact(row) + .flat_map(|line| line[..w as usize * bpp].chunks_exact(bpp)) + .map(|texel| texel_to_f32(doc.format, texel)) + .collect() }) .collect() } @@ -232,8 +243,9 @@ fn background_compositor_switch_preserves_pixels(gpu: &GpuCanvas) { } let second = gpu.refresh(key, &doc, Some(damage), None); assert_eq!(second.kind, "gpu-rect", "{:?}", second.fallback); - let actual = read_mips(gpu, key).remove(0); + let (_, _, actual) = gpu.read_texels(key).expect("read updated canvas"); let expected = photocraft_compose::render(&doc, doc.bounds()); + assert_eq!(actual.len(), expected.px.len()); for (got, want) in actual.iter().zip(expected.px.iter()) { for (g, w) in got.iter().zip(want.iter()) { assert!((g - w).abs() < 0.02, "{got:?} != {want:?}"); diff --git a/crates/ui-egui/tests/it/free_transform_preview_canvas.rs b/crates/ui-egui/tests/it/free_transform_preview_canvas.rs index f5890874b7f..2e195feb226 100644 --- a/crates/ui-egui/tests/it/free_transform_preview_canvas.rs +++ b/crates/ui-egui/tests/it/free_transform_preview_canvas.rs @@ -90,12 +90,14 @@ fn button(h: &mut Harness, at: Pos2, pressed: bool) { h.step(); } -/// The rendered frame's RGB at document point `(x, y)`. -fn rgb_at(h: &mut Harness, x: f64, y: f64) -> [u8; 3] { - let p = screen(h, x, y); +/// Sample all points in the same rendered frame. +fn rgb_at(h: &mut Harness, points: [[f64; 2]; N]) -> [[u8; 3]; N] { + let points = points.map(|[x, y]| screen(h, x, y)); let img = h.render().expect("render"); - let px = img.get_pixel(p.x.floor() as u32, p.y.floor() as u32); - [px[0], px[1], px[2]] + points.map(|p| { + let px = img.get_pixel(p.x.floor() as u32, p.y.floor() as u32); + [px[0], px[1], px[2]] + }) } fn is_red(c: [u8; 3]) -> bool { @@ -110,11 +112,12 @@ fn shows_the_layer_inside_the_box(gpu_canvas: bool) { let _gpu = photocraft_testkit::gpu_lock(); let Some(mut h) = harness(gpu_canvas) else { return }; setup(&mut h); - assert!(is_red(rgb_at(&mut h, 150.5, 150.5)), "the layer shows before the transform"); + let [before] = rgb_at(&mut h, [[150.5, 150.5]]); + assert!(is_red(before), "the layer shows before the transform"); control(&mut h, "ui.menu.invoke", json!({"id": "edit.freeTransform"})); assert!(h.state().ui.transform.is_some(), "Free Transform is open"); - let inside = rgb_at(&mut h, 150.5, 150.5); + let [inside] = rgb_at(&mut h, [[150.5, 150.5]]); assert!(is_red(inside), "the layer shows inside the box once Free Transform opens, not the background: {inside:?}"); // Drag the box 60 px right from its middle and hold: the preview follows the pointer. The samples sit off the @@ -125,12 +128,11 @@ fn shows_the_layer_inside_the_box(gpu_canvas: bool) { for i in 1..=6 { pointer_move(&mut h, from + (to - from) * (i as f32 / 6.0)); } - let moved = rgb_at(&mut h, 230.5, 130.5); + let [moved, vacated] = rgb_at(&mut h, [[230.5, 130.5], [120.5, 130.5]]); assert!(is_red(moved), "the moved square shows where the drag took it: {moved:?}"); - let vacated = rgb_at(&mut h, 120.5, 130.5); assert!(is_white(vacated), "the place the square left shows the background: {vacated:?}"); button(&mut h, to, false); - let released = rgb_at(&mut h, 230.5, 130.5); + let [released] = rgb_at(&mut h, [[230.5, 130.5]]); assert!(is_red(released), "the moved square still shows after the release: {released:?}"); } @@ -158,12 +160,13 @@ fn cancelling_shows_no_moved_pixels(gpu_canvas: bool) { pointer_move(&mut h, from + (to - from) * (i as f32 / 6.0)); } button(&mut h, to, false); - assert!(is_red(rgb_at(&mut h, 230.5, 130.5)), "the box moved the square"); + let [before] = rgb_at(&mut h, [[230.5, 130.5]]); + assert!(is_red(before), "the box moved the square"); h.event(egui::Event::Key { key: egui::Key::Escape, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::NONE }); h.step(); assert!(h.state().ui.transform.is_none(), "Escape ended Free Transform"); - let moved = rgb_at(&mut h, 230.5, 130.5); + let [moved, back] = rgb_at(&mut h, [[230.5, 130.5], [150.5, 150.5]]); assert!(is_white(moved), "the cancelling frame shows no moved pixels: {moved:?}"); let back = rgb_at(&mut h, 150.5, 130.5); assert!(is_red(back), "the square is back in its place: {back:?}"); diff --git a/crates/ui-egui/tests/it/gpu_tests/adjust_preview_gpu.rs b/crates/ui-egui/tests/it/gpu_tests/adjust_preview_gpu.rs index f8f56bb371d..3c4ee58a4bd 100644 --- a/crates/ui-egui/tests/it/gpu_tests/adjust_preview_gpu.rs +++ b/crates/ui-egui/tests/it/gpu_tests/adjust_preview_gpu.rs @@ -162,15 +162,22 @@ fn pm(p: &[f32; 4]) -> [f32; 4] { [p[0] * p[3], p[1] * p[3], p[2] * p[3], p[3]] } -fn diffs(a: &[[f32; 4]], b: &[[f32; 4]]) -> Vec { - a.iter().zip(b).map(|(x, y)| (0..4).map(|c| (pm(x)[c] - pm(y)[c]).abs()).fold(0.0, f32::max)).collect() -} - /// Largest difference, ignoring up to `skip` outliers. fn max_diff(a: &[[f32; 4]], b: &[[f32; 4]], skip: usize) -> f32 { - let mut d = diffs(a, b); - d.sort_by(|x, y| y.total_cmp(x)); - d.get(skip).copied().unwrap_or(0.0) + assert_eq!(a.len(), b.len()); + let diffs = a.iter().zip(b).map(|(x, y)| { + let (x, y) = (pm(x), pm(y)); + x.into_iter().zip(y).map(|(x, y)| (x - y).abs()).fold(0.0, f32::max) + }); + if skip == 0 { + diffs.fold(0.0, f32::max) + } else { + let mut diffs = diffs.collect::>(); + if skip >= diffs.len() { + return 0.0; + } + *diffs.select_nth_unstable_by(skip, |x, y| y.total_cmp(x)).1 + } } #[test] diff --git a/crates/ui-egui/tests/it/gpu_tests/canvas_16f.rs b/crates/ui-egui/tests/it/gpu_tests/canvas_16f.rs index fcdd436f7d1..8193a546e6d 100644 --- a/crates/ui-egui/tests/it/gpu_tests/canvas_16f.rs +++ b/crates/ui-egui/tests/it/gpu_tests/canvas_16f.rs @@ -227,9 +227,10 @@ fn screens(cases: Vec>) -> Option> { } harness.run_steps(6); let img = harness.render().expect("render"); - let out = std::env::temp_dir().join(name); - let _ = img.save(&out); - eprintln!("screen: {}", out.display()); + if let Some(dir) = std::env::var_os("PHOTOCRAFT_CANVAS_16F_EVIDENCE_DIR") { + std::fs::create_dir_all(&dir).expect("evidence directory"); + img.save(std::path::Path::new(&dir).join(name)).expect("save UI frame"); + } shown.push(Screen { w: img.width(), h: img.height(), px: img.into_raw() }); if let Some((doc, setup, name)) = cases.next() { harness.state_mut().session.open_document(doc, None); @@ -252,7 +253,9 @@ fn screen_levels(img: &Screen, y: u32, x0: u32, x1: u32) -> (usize, i32) { fn sixteen_bit_gradient_on_screen() { let _gpu = gpu_lock(); // A 16-bit ramp drawn by the app's canvas: smooth, monotonic, no visible steps. - let doc = gradient(SampleType::U16, 2048, 1024, 0.0, 1.0); + // The document still fits down to the same viewport and has more source levels than + // the screen can display. The extra source pixels aren't needed to spot banding. + let doc = gradient(SampleType::U16, 1024, 512, 0.0, 1.0); let Some(img) = screen(doc, &[], "photocraft-canvas-16f-gradient.png") else { return }; let (n, step) = screen_levels(&img, img.h / 2, 150, 600); assert!(n > 100 && step <= 3, "{n} levels, max step {step}"); @@ -263,7 +266,7 @@ fn thirty_two_bit_preview_exposes_values_above_one() { let _gpu = gpu_lock(); // A dark 32-bit ramp brightened +4 stops by View › 32-bit Preview Options: with an 8-bit // canvas texture its 0..1/16 range has 16 codes (banding); the float texture keeps it smooth. - let doc = gradient(SampleType::F32, 2048, 1024, 0.0, 1.0 / 16.0); + let doc = gradient(SampleType::F32, 1024, 512, 0.0, 1.0 / 16.0); // Values above 1.0 are brought into range by a negative exposure instead of clipped: 2.0 // at −3 stops shows as sRGB(lin(2.0) / 8) rather than sRGB(lin(1.0) / 8). let mut flat = Document::new("hdr", Size::new(512, 512), ColorMode::Rgb, SampleType::F32); diff --git a/crates/ui-egui/tests/it/gpu_tests/checker_canvas.rs b/crates/ui-egui/tests/it/gpu_tests/checker_canvas.rs index e3708e45920..709019a6287 100644 --- a/crates/ui-egui/tests/it/gpu_tests/checker_canvas.rs +++ b/crates/ui-egui/tests/it/gpu_tests/checker_canvas.rs @@ -5,9 +5,13 @@ //! These tests render the real app offscreen and read pixels back. They skip when no GPU adapter //! is available. The CPU canvas (no wgpu handed to the app) has its own pixel grid tests at the end. +use photocraft_color::{ColorMode, PixelFormat, SampleType}; +use photocraft_doc::{Document, Layer, LayerContent, Size}; +use photocraft_geom::Rect; +use photocraft_raster::Surface; use photocraft_ui_egui::PhotocraftApp; -use photocraft_ui_egui::control::{ControlRequest, handle}; -use serde_json::{Value, json}; +use photocraft_ui_egui::control::{ControlRequest, Reply, handle}; +use serde_json::json; type Harness = egui_kittest::Harness<'static, Box>; @@ -24,8 +28,11 @@ fn harness_with(gpu: bool) -> Option { } fn harness_with_scale(gpu: bool, ppp: f32) -> Option { + // At 2× the same document pixels take half as many points. Keep the samples + // inside the viewport without reading back a 2800 × 1600 frame. + let size = if ppp > 1.0 { egui::vec2(960.0, 600.0) } else { egui::vec2(1400.0, 800.0) }; let built = std::panic::catch_unwind(|| { - egui_kittest::Harness::builder().with_size(egui::vec2(1400.0, 800.0)).with_pixels_per_point(ppp).with_max_steps(64).wgpu().build_eframe(|cc| { + egui_kittest::Harness::builder().with_size(size).with_pixels_per_point(ppp).with_max_steps(64).wgpu().build_eframe(|cc| { PhotocraftApp::setup_context(&cc.egui_ctx, Default::default()); let mut app = PhotocraftApp::with_context(cc.egui_ctx.clone(), photocraft_engine::Session::new(), Default::default()); if let Some(rs) = cc.wgpu_render_state.as_ref().filter(|_| gpu) { @@ -43,10 +50,11 @@ fn harness_with_scale(gpu: bool, ppp: f32) -> Option { } } -fn control(h: &mut Harness, method: &str, params: Value) { +fn set_view(h: &mut Harness, zoom: f32, center: [f32; 2]) { let ctx = h.ctx.clone(); - let (req, _rx) = ControlRequest::new(method, params); - handle(h.state_mut(), &ctx, &req); + let (req, _rx) = ControlRequest::new("ui.set", json!({"zoom": zoom, "center": center})); + let Reply::Done(reply) = handle(h.state_mut(), &ctx, &req) else { panic!("setting the view did not finish") }; + assert_eq!(reply["ok"], true, "{reply}"); h.run_steps(4); } @@ -87,30 +95,23 @@ impl Shot { } } -/// Opens a `doc` px square document at `zoom` (transparent, or filled black when `black`), renders -/// it with the pixel grid on or off, and returns the screenshot with the document's left and top -/// screen edge and its width in screen pixels. -fn render(h: &mut Harness, zoom: f32, doc: u32, black: bool, grid: bool) -> (Shot, u32, u32, u32) { - render_on(h, true, zoom, doc, black, grid) +fn open_document(h: &mut Harness, doc: u32, black: bool, grid: bool) { + let app = h.state_mut(); + while app.session.active().is_some() { + app.run("file.close", json!({"discard": true})).expect("close"); + } + let background = if black { "white" } else { "transparent" }; + app.run("file.new", json!({"width": doc, "height": doc, "background": background})).expect("new"); + if black { + app.run("edit.fill", json!({"color": "#000000"})).expect("fill"); + } + app.sync_views(); + app.ui.view.show.pixel_grid = grid; } -/// [`render`] on the GPU canvas (`gpu`) or the CPU canvas. -fn render_on(h: &mut Harness, gpu: bool, zoom: f32, doc: u32, black: bool, grid: bool) -> (Shot, u32, u32, u32) { - { - let app = h.state_mut(); - while app.session.active().is_some() { - app.run("file.close", json!({"discard": true})).expect("close"); - } - let background = if black { "white" } else { "transparent" }; - app.run("file.new", json!({"width": doc, "height": doc, "background": background})).expect("new"); - if black { - app.run("edit.fill", json!({"color": "#000000"})).expect("fill"); - } - app.sync_views(); - app.ui.view.show.pixel_grid = grid; - } - control(h, "ui.set", json!({"zoom": zoom, "center": [doc as f32 / 2.0, doc as f32 / 2.0]})); - h.run_steps(3); +/// Zooms the current document and returns the screenshot and the document's physical-pixel bounds. +fn render_on(h: &mut Harness, gpu: bool, zoom: f32, doc: u32, black: bool) -> (Shot, u32, u32, u32) { + set_view(h, zoom, [doc as f32 / 2.0; 2]); assert_eq!(h.state().perf.gpu, gpu, "zoom {zoom}: expected the {} canvas", if gpu { "GPU" } else { "CPU" }); let rendered = h.render().expect("render"); let (width, height) = (rendered.width(), rendered.height()); @@ -136,8 +137,13 @@ fn checker_cells_are_8_screen_pixels_at_every_zoom() { let Some(mut h) = harness() else { return }; h.run_steps(4); // The 8 px cell never changes with the zoom. + let mut current_size = 0; for (zoom, doc) in [(0.5, 64), (1.0, 64), (1.1, 64), (2.0, 32), (3.3, 32), (5.5, 32), (8.0, 32), (13.0, 32), (32.0, 12)] { - let (img, x0, y0, _) = render(&mut h, zoom, doc, false, false); + if current_size != doc { + open_document(&mut h, doc, false, false); + current_size = doc; + } + let (img, x0, y0, _) = render_on(&mut h, true, zoom, doc, false); let n = ((doc as f32 * zoom) / 8.0) as u32; assert!(n >= 2, "zoom {zoom}: test needs at least two cells"); for row in 0..n.min(4) { @@ -170,10 +176,11 @@ fn pixel_grid_shows_above_500_percent_and_lightens_a_dark_pixel_by_about_a_quart let _gpu = photocraft_testkit::gpu_lock(); let Some(mut h) = harness() else { return }; h.run_steps(4); - let (flat, x0, y0, _) = render(&mut h, 5.0, 48, true, true); + open_document(&mut h, 48, true, true); + let (flat, x0, y0, _) = render_on(&mut h, true, 5.0, 48, true); assert!(lit_columns(&flat, x0, y0 + 20, 100).is_empty(), "no grid at 500%"); for zoom in [6.0f32, 8.0, 12.0] { - let (img, x0, y0, _) = render(&mut h, zoom, 48, true, true); + let (img, x0, y0, _) = render_on(&mut h, true, zoom, 48, true); let lit = lit_columns(&img, x0, y0 + (zoom * 3.5) as u32, (zoom * 10.0) as u32); assert_eq!(lit.len(), 10, "zoom {zoom}: grid columns {lit:?}"); assert!(lit.windows(2).all(|p| p[1] - p[0] == zoom as u32), "zoom {zoom}: spacing of {lit:?}"); @@ -187,8 +194,9 @@ fn pixel_grid_is_not_drawn_over_empty_checker() { let _gpu = photocraft_testkit::gpu_lock(); let Some(mut h) = harness() else { return }; h.run_steps(4); + open_document(&mut h, 24, false, true); for zoom in [8.0f32, 16.0] { - let (img, x0, y0, _) = render(&mut h, zoom, 24, false, true); + let (img, x0, y0, _) = render_on(&mut h, true, zoom, 24, false); for y in y0..y0 + 64 { for x in x0..x0 + 64 { let v = img.at(x, y)[0]; @@ -204,10 +212,11 @@ fn cpu_pixel_grid_shows_above_500_percent_over_content() { for ppp in [1.0, 2.0] { let Some(mut h) = harness_with_scale(false, ppp) else { return }; h.run_steps(4); - let (flat, x0, y0, _) = render_on(&mut h, false, 5.0, 48, true, true); + open_document(&mut h, 48, true, true); + let (flat, x0, y0, _) = render_on(&mut h, false, 5.0, 48, true); assert!(lit_columns(&flat, x0, y0 + 20, 100).is_empty(), "no grid at 500%"); for zoom in [6.0f32, 8.0, 12.0] { - let (img, x0, y0, _) = render_on(&mut h, false, zoom, 48, true, true); + let (img, x0, y0, _) = render_on(&mut h, false, zoom, 48, true); let y = y0 + (zoom * 3.5) as u32; let lit = lit_columns(&img, x0, y, (zoom * 10.0) as u32); assert_eq!(lit.len(), 10, "scale {ppp}, zoom {zoom}: one physical pixel per line, columns {lit:?}"); @@ -224,9 +233,12 @@ fn cpu_pixel_grid_is_not_drawn_over_empty_checker() { let Some(mut h) = harness_with(false) else { return }; h.run_steps(4); // The CPU checker has soft cell edges of its own, so compare with and without the grid. + open_document(&mut h, 24, false, false); for zoom in [8.0f32, 16.0] { - let (without, x0, y0, _) = render_on(&mut h, false, zoom, 24, false, false); - let (with, x1, y1, _) = render_on(&mut h, false, zoom, 24, false, true); + h.state_mut().ui.view.show.pixel_grid = false; + let (without, x0, y0, _) = render_on(&mut h, false, zoom, 24, false); + h.state_mut().ui.view.show.pixel_grid = true; + let (with, x1, y1, _) = render_on(&mut h, false, zoom, 24, false); assert_eq!((x0, y0), (x1, y1), "zoom {zoom}: the document moved"); for y in y0..y0 + 64 { for x in x0..x0 + 64 { @@ -236,56 +248,48 @@ fn cpu_pixel_grid_is_not_drawn_over_empty_checker() { } } -/// The pixel grid over a flat `grey` document at 800%: the largest difference, in 8-bit levels, -/// between a grid line and the pixel interior beside it. -fn grid_line_contrast_over_grey(h: &mut Harness, grey: u8) -> i32 { - { - let app = h.state_mut(); - while app.session.active().is_some() { - app.run("file.close", json!({"discard": true})).expect("close"); - } - app.run("file.new", json!({"width": 48, "height": 48, "background": "white"})).expect("new"); - app.run("edit.fill", json!({"color": format!("#{grey:02x}{grey:02x}{grey:02x}")})).expect("fill"); - app.sync_views(); - app.ui.view.show.pixel_grid = true; - } - control(h, "ui.set", json!({"zoom": 8.0, "center": [24.0, 24.0]})); - h.run_steps(3); - assert!(h.state().perf.gpu, "expected the GPU canvas"); - let rendered = h.render().expect("render"); - let img = Shot { w: rendered.width(), px: rendered.into_raw() }; - let r = h.state().last_canvas_rect; - let (cx, cy) = (r.center().x as u32, r.center().y as u32); - // The median of an 8 px block is a pixel interior whichever line the block straddles. - let mut block: Vec = (0..64).map(|i| img.at(cx + i % 8, cy + i / 8)[0] as i32).collect(); - block.sort_unstable(); - let interior = block[32]; - // Walk out to the document edge: the pasteboard is far darker than any grid line. - let near = |x: u32, y: u32| (img.at(x, y)[0] as i32 - interior).abs() < 50; - let x0 = (0..=cx).rev().take_while(|x| near(*x, cy)).last().unwrap_or(cx); - let y0 = (0..=cy).rev().take_while(|y| near(cx, *y)).last().unwrap_or(cy); - // Pixel (col, row) owns the grid line on its left and top edge, 8 screen px apart. - let y = y0 + 8 * 3 + 4; - (2..6).map(|col| (img.at(x0 + 8 * col, y)[0] as i32 - img.at(x0 + 8 * col + 4, y)[0] as i32).abs()).max().unwrap_or(0) -} - #[test] fn pixel_grid_does_not_flip_colour_across_mid_tones() { let _gpu = photocraft_testkit::gpu_lock(); let Some(mut h) = harness() else { return }; h.run_steps(4); - // 0x87 and 0x90 sit either side of luma 0.55, where the line used to switch from a full white - // line to a full black one. Both now give a faint line, so neighbouring cells match. - for grey in [0x87u8, 0x90] { - let c = grid_line_contrast_over_grey(&mut h, grey); - assert!(c <= 14, "grey {grey:#04x}: grid line differs from its pixel by {c} levels, want a faint line"); + // Put both sides of the old luma cutoff and the stronger dark/light lines in one frame. + // Sample inside each swatch so an edge between swatches cannot pass as a grid line. + let greys = [0x87u8, 0x90, 0x60, 0xd0, 0xff]; + let mut doc = Document::new("grid midtones", Size::new(40, 16), ColorMode::Rgb, SampleType::U8); + let mut surface = Surface::new(doc.pixel_format()); + for (i, grey) in greys.into_iter().enumerate() { + let x = i as i32 * 8; + let v = f32::from(grey) / 255.0; + surface.fill_rect(Rect::new(x, 0, x + 8, 16), &[v, v, v, 1.0]); } - // The fade must not remove the grid where it is needed: dark and light pixels keep a clear - // line (white over 0x60, black over 0xd0 and white; black itself is in the unit tests, as the - // dark pasteboard defeats this walk to the document edge). - for grey in [0x60u8, 0xd0, 0xff] { - let c = grid_line_contrast_over_grey(&mut h, grey); - assert!(c >= 20, "grey {grey:#04x}: grid line differs from its pixel by only {c} levels"); + doc.layers.push(Layer::new("swatches", LayerContent::Raster(surface))); + let app = h.state_mut(); + app.session.add_document(doc, None); + app.sync_views(); + app.ui.view.show.pixel_grid = true; + set_view(&mut h, 8.0, [20.0, 8.0]); + assert!(h.state().perf.gpu); + let img = h.render().expect("render swatches"); + let center = h.state().last_canvas_rect.center(); + let x0 = (center.x - 20.0 * 8.0).round() as u32; + let y = (center.y + 3.5 * 8.0).round() as u32; + for (i, grey) in greys.into_iter().enumerate() { + let x = x0 + i as u32 * 64; + let contrast = (2..6) + .map(|col| { + let edge = x + 8 * col; + let inside = img.get_pixel(edge + 4, y)[0]; + assert!(inside.abs_diff(grey) <= 1, "wrong swatch at {edge}: {inside} vs {grey}"); + (edge - 1..=edge + 1).map(|sx| img.get_pixel(sx, y)[0].abs_diff(inside)).max().expect("grid line") + }) + .max() + .expect("swatch columns"); + if i < 2 { + assert!(contrast <= 14, "grey {grey:#04x}: grid line differs from its pixel by {contrast} levels, want a faint line"); + } else { + assert!(contrast >= 20, "grey {grey:#04x}: grid line differs from its pixel by only {contrast} levels"); + } } } @@ -296,8 +300,7 @@ fn pixel_grid_does_not_flip_colour_across_mid_tones() { /// it, which the `inside` assertion reads: on the GPU canvas its texture (`Rgba8Unorm` for 8-bit, `Rgba16Float` for /// 16/32-bit, see `canvas_16f.rs`). So every canvas and scale runs 8-bit, and the GPU canvas adds 16-bit at 1x and /// 32-bit at 2x. -fn grid_depths(gpu: bool, ppp: f32) -> Vec { - use photocraft_color::SampleType; +fn grid_depths(gpu: bool, ppp: f32) -> Vec { match (gpu, ppp > 1.0) { (true, false) => vec![SampleType::U8, SampleType::U16], (true, true) => vec![SampleType::U8, SampleType::F32], @@ -307,36 +310,42 @@ fn grid_depths(gpu: bool, ppp: f32) -> Vec { fn pixel_grid_is_solid_and_visible_at_scale(gpu: bool, ppp: f32) { let _gpu = photocraft_testkit::gpu_lock(); - use photocraft_color::{ColorMode, PixelFormat}; - use photocraft_doc::{Document, Layer, LayerContent, Size}; - use photocraft_geom::Rect; - use photocraft_raster::Surface; let Some(mut h) = harness_with_scale(gpu, ppp) else { return }; for depth in grid_depths(gpu, ppp) { - for v in [0.0, 1.0] { - let mut doc = Document::new("grid contrast", Size::new(32, 16), ColorMode::Rgb, depth); - let mut surface = Surface::new(PixelFormat::new(ColorMode::Rgb, depth, true)); - surface.fill_rect(Rect::new(0, 0, 32, 16), &[v, v, v, 1.0]); - doc.layers.push(Layer::new("opaque", LayerContent::Raster(surface))); - let app = h.state_mut(); - app.session.add_document(doc, None); - app.sync_views(); - app.ui.view.show.pixel_grid = true; - for zoom in [7.119, 8.0, 22.825] { - control(&mut h, "ui.set", json!({"zoom": zoom, "center": [16.0, 8.0]})); - assert_eq!(h.state().perf.gpu, gpu); - let img = h.render().expect("render opaque grid"); - let center = h.state().last_canvas_rect.center() * ppp; - let x0 = center.x - 16.0 * zoom; - let y = (center.y + 3.25 * zoom).floor() as u32; + let mut doc = Document::new("grid contrast", Size::new(32, 16), ColorMode::Rgb, depth); + let mut surface = Surface::new(PixelFormat::new(ColorMode::Rgb, depth, true)); + // Both neutral fills take the same grid draw path, with opposite line contrast. + // Separate rows let them share one readback at each depth and zoom. + surface.fill_rect(Rect::new(0, 0, 32, 8), &[0.0, 0.0, 0.0, 1.0]); + surface.fill_rect(Rect::new(0, 8, 32, 16), &[1.0; 4]); + doc.layers.push(Layer::new("opaque", LayerContent::Raster(surface))); + let app = h.state_mut(); + app.session.add_document(doc, None); + app.sync_views(); + app.ui.view.show.pixel_grid = true; + // The 8-bit case also covers the threshold on both canvases at both display scales. + let zooms: &[f32] = if depth == SampleType::U8 { &[5.0, 7.119, 8.0, 22.825] } else { &[7.119, 8.0, 22.825] }; + for &zoom in zooms { + set_view(&mut h, zoom, [16.0, 8.0]); + assert_eq!(h.state().perf.gpu, gpu); + assert_eq!(h.ctx.pixels_per_point(), ppp); + let img = h.render().expect("render opaque grid"); + let center = h.state().last_canvas_rect.center() * ppp; + let x0 = center.x - 16.0 * zoom; + for (v, dy) in [(0, -2.75), (255, 3.25)] { + let y = (center.y + dy * zoom).floor() as u32; for x in 2..30 { let edge = (x0 + x as f32 * zoom).floor() as u32; for sy in y..y + 3 { let inside = img.get_pixel((x0 + (x as f32 + 0.5) * zoom).floor() as u32, sy)[0]; - assert_eq!(inside, (v * 255.0) as u8); + assert_eq!(inside, v); let contrast = (edge - 1..=edge + 1).map(|sx| img.get_pixel(sx, sy)[0].abs_diff(inside)).max().expect("line"); - assert!(contrast >= 28, "{gpu:?}/{depth:?}, scale {ppp}, zoom {zoom}, fill {v}, ({x}, {sy}): invisible grid ({contrast})"); + if zoom == 5.0 { + assert_eq!(contrast, 0, "grid visible at 500%, {gpu:?}/{depth:?}, scale {ppp}, fill {v}"); + } else { + assert!(contrast >= 28, "{gpu:?}/{depth:?}, scale {ppp}, zoom {zoom}, fill {v}, ({x}, {sy}): invisible grid ({contrast})"); + } } } } diff --git a/crates/ui-egui/tests/it/gpu_tests/drag_preview_canvas.rs b/crates/ui-egui/tests/it/gpu_tests/drag_preview_canvas.rs index 208dac9e950..a3facea0240 100644 --- a/crates/ui-egui/tests/it/gpu_tests/drag_preview_canvas.rs +++ b/crates/ui-egui/tests/it/gpu_tests/drag_preview_canvas.rs @@ -246,8 +246,8 @@ fn marquee_previews_show_while_dragging_on_white_and_black_at_1x_and_2x() { } // Each move's frame shows the outline where the pointer is now (no stale frame). pointer_move(&mut h, 340.0, 250.0); - let img = render(&mut h); if tool == "rectMarquee" { + let img = render(&mut h); let [top, right, ..] = edges(&h, a, [340.0, 250.0]); for (ink, test) in inks() { assert!(coverage(&img, ppp, top.0, top.1, test) > 0.3, "{tool} @{ppp}x: top edge follows the pointer ({ink})"); diff --git a/crates/ui-egui/tests/it/gpu_tests/live_stroke_canvas.rs b/crates/ui-egui/tests/it/gpu_tests/live_stroke_canvas.rs index 1556fb0e04c..1071f4214b2 100644 --- a/crates/ui-egui/tests/it/gpu_tests/live_stroke_canvas.rs +++ b/crates/ui-egui/tests/it/gpu_tests/live_stroke_canvas.rs @@ -141,7 +141,6 @@ fn frames(h: &mut Harness, c: Case) -> (Pixels, Pixels, Pixels, bool) { // The smoothing tool option syncs on the first frame with the Brush: set it after. h.state_mut().session.tools.brush.smoothing.amount = c.smoothing; let canvas = |h: &mut Harness| { - h.run_steps(3); let r = h.state().last_canvas_rect.shrink(4.0); let img = h.render().expect("render"); let mut px = Vec::new(); @@ -152,6 +151,7 @@ fn frames(h: &mut Harness, c: Case) -> (Pixels, Pixels, Pixels, bool) { } px }; + h.run_steps(3); let before = canvas(h); let pressure = |t: f64| if c.pressure { 0.3 + 0.7 * t } else { 1.0 }; control(h, "ui.pointer", json!({"events": [{"kind": "down", "x": 100, "y": 100, "pressure": pressure(0.0)}]})); @@ -168,11 +168,12 @@ fn frames(h: &mut Harness, c: Case) -> (Pixels, Pixels, Pixels, bool) { // The pointer stays held at its last point, as a mouse held still repeats its position. let held = |h: &mut Harness| { control(h, "ui.pointer", json!({"events": [{"kind": "move", "x": last.0, "y": last.1, "pressure": pressure(1.0)}]})); - canvas(h) + h.run_steps(3); }; - let drawing = settled(h, held); + let drawing = settled(h, held, canvas); let gpu = h.state().perf.gpu && !c.flip; control(h, "ui.pointer", json!({"events": [{"kind": "up", "x": last.0, "y": last.1}]})); + h.run_steps(3); let done = canvas(h); (before, drawing, done, gpu) } @@ -180,22 +181,28 @@ fn frames(h: &mut Harness, c: Case) -> (Pixels, Pixels, Pixels, bool) { /// The canvas once the live stroke has stopped changing (#13477). The stroke paints on its own /// thread and a frame waits only a few real ms for it, so on a slow machine its newest step /// arrives late, and only a later pointer event shows it; release would then paint the rest. -/// `picture` holds the pointer still and takes a picture, with short real waits between them, -/// until the stroke is idle and three pictures in a row match (matching pixels alone don't prove -/// a slow step has finished): at most `TRIES` times, so a canvas that never settles fails -/// instead of hanging or comparing an unsettled picture. -fn settled(h: &mut Harness, picture: impl Fn(&mut Harness) -> Pixels) -> Pixels { +/// Keep feeding the held pointer until the stroke is idle and three pictures in a row match. +/// A busy stroke can't be stable, so advance those frames without a GPU readback. +fn settled(h: &mut Harness, held: impl Fn(&mut Harness), picture: impl Fn(&mut Harness) -> Pixels) -> Pixels { const TRIES: usize = 80; - let mut last = picture(h); + let mut last = None; let mut unchanged = 0; - for _ in 0..TRIES { - std::thread::sleep(std::time::Duration::from_millis(25)); - let next = picture(h); - unchanged = if next == last { unchanged + 1 } else { 0 }; - last = next; - if unchanged >= 2 && !h.state().live_stroke_busy() { - return last; + for attempt in 0..=TRIES { + if attempt != 0 { + std::thread::sleep(std::time::Duration::from_millis(25)); } + held(h); + if h.state().live_stroke_busy() { + last = None; + unchanged = 0; + continue; + } + let next = picture(h); + unchanged = if last.as_ref() == Some(&next) { unchanged + 1 } else { 0 }; + if unchanged >= 2 { + return next; + } + last = Some(next); } panic!("the live stroke did not settle before release"); } From b2a6a823a226087c6d029be2b6f7f87aa94c48cd Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 30 Nov 2026 20:51:50 +0000 Subject: [PATCH 21/61] Tests: reuse the Camera Raw histogram harness (#15928) --- .../ui-egui/tests/it/camera_raw_histogram.rs | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/crates/ui-egui/tests/it/camera_raw_histogram.rs b/crates/ui-egui/tests/it/camera_raw_histogram.rs index f90da8ef974..0136b99ceca 100644 --- a/crates/ui-egui/tests/it/camera_raw_histogram.rs +++ b/crates/ui-egui/tests/it/camera_raw_histogram.rs @@ -37,23 +37,23 @@ fn request(h: &mut Harness<'_, Box>, params: Value) -> Value { #[test] fn histogram_matches_visible_preview_at_all_supported_depths_and_cancel_commit_are_reversible() { + let mut h = Harness::builder().with_step_dt(1.0 / 60.0).with_size(egui::vec2(1200.0, 800.0)).build_eframe(|cc| { + PhotocraftApp::setup_context(&cc.egui_ctx, AppTheme::pro()); + PhotocraftApp::with_context(cc.egui_ctx.clone(), photocraft_engine::Session::new(), Default::default()) + }); for mode in ["rgb", "grayscale"] { for depth in [8, 16, 32] { - let mut h = Harness::builder().with_step_dt(1.0 / 60.0).with_size(egui::vec2(1200.0, 800.0)).build_eframe(move |cc| { - PhotocraftApp::setup_context(&cc.egui_ctx, AppTheme::pro()); - let mut app = PhotocraftApp::with_context(cc.egui_ctx.clone(), photocraft_engine::Session::new(), Default::default()); - app.run("file.new", json!({"width": 16, "height": 8, "mode": mode, "depth": depth})).unwrap(); - app.run("layer.new.layer", json!({})).unwrap(); - app.run("edit.fill", json!({"color": "#808080"})).unwrap(); - app - }); + let app = h.state_mut(); + app.run("file.new", json!({"width": 16, "height": 8, "mode": mode, "depth": depth})).unwrap(); + app.run("layer.new.layer", json!({})).unwrap(); + app.run("edit.fill", json!({"color": "#808080"})).unwrap(); h.run_steps(3); let original = h.state().session.active().unwrap().doc.clone(); let steps = h.state().session.active().unwrap().history.past_len(); let initial = request(&mut h, json!({})); assert_eq!(initial["histogram"]["samples"], 128); let changed = request(&mut h, json!({"ui": {"set": {"exposure": 1.0}}})); - assert_ne!(changed["histogram"]["red"], initial["histogram"]["red"]); + assert_ne!(changed["histogram"]["red"], initial["histogram"]["red"], "{mode}/{depth}: exposure must change the histogram"); assert_eq!(h.state().session.active().unwrap().history.past_len(), steps); request(&mut h, json!({"ui": {"cancel": true}})); assert!(std::sync::Arc::ptr_eq(&h.state().session.active().unwrap().doc, &original), "Cancel leaves the document alone"); @@ -64,6 +64,10 @@ fn histogram_matches_visible_preview_at_all_supported_depths_and_cancel_commit_a h.state_mut().run("edit.redo", json!({})).unwrap(); let committed = request(&mut h, json!({})); assert_eq!(committed["histogram"]["red"], changed["histogram"]["red"], "{mode}/{depth}: graph and committed pixels disagree"); + request(&mut h, json!({"ui": {"cancel": true}})); + assert!(described(&h).is_null(), "{mode}/{depth}: Camera Raw must close"); + h.state_mut().run("file.close", json!({"discard": true})).unwrap(); + assert!(h.state().session.active().is_none(), "{mode}/{depth}: the next case needs a fresh document"); } } } From 00ce7f9edd80254d6abe06e8edd3ed76ae8233d9 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 30 Nov 2026 20:52:06 +0000 Subject: [PATCH 22/61] Tests: compare blend previews with CPU pixels directly --- .../src/canvas/blend_viewport_gpu_tests.rs | 52 +++++++++++-------- .../gpu_tests/arbitrary_rotation_preview.rs | 19 ++++--- .../tests/it/gpu_tests/ui_scale_canvas.rs | 16 ++---- 3 files changed, 47 insertions(+), 40 deletions(-) diff --git a/crates/ui-egui/src/canvas/blend_viewport_gpu_tests.rs b/crates/ui-egui/src/canvas/blend_viewport_gpu_tests.rs index e3297baeee4..39064abf626 100644 --- a/crates/ui-egui/src/canvas/blend_viewport_gpu_tests.rs +++ b/crates/ui-egui/src/canvas/blend_viewport_gpu_tests.rs @@ -48,12 +48,11 @@ fn blend_hover_pattern_tiles_and_multiple_views_reuse_current_pixels() { app.ui.view.pattern_preview = true; crate::blend_preview::hover(&mut app, &[photocraft_doc::LayerId(layer)], Some(BlendMode::Multiply)); assert!(ensure_gpu(&mut app, &ctx, 0, a, None)); - assert_visible_pixels(&mut app, b); let bounds = app.session.active().unwrap().doc.bounds(); - assert_visible_pixels(&mut app, bounds); + assert_visible_pixels(&mut app, &[bounds]); crate::blend_preview::hover(&mut app, &[photocraft_doc::LayerId(layer)], None); assert!(ensure_gpu(&mut app, &ctx, 0, a, None)); - assert_visible_pixels(&mut app, bounds); + assert_visible_pixels(&mut app, &[bounds]); app.ui.view.pattern_preview = false; for mode in [BlendMode::Multiply, BlendMode::Screen] { @@ -64,16 +63,16 @@ fn blend_hover_pattern_tiles_and_multiple_views_reuse_current_pixels() { app.perf.last_refresh_px = 0; assert!(ensure_gpu(&mut app, &ctx, 0, visible, None)); assert_eq!(app.perf.last_refresh_px, 0, "unchanged views must retain coverage together"); - assert_visible_pixels(&mut app, visible.intersect(&bounds)); + assert_visible_pixels(&mut app, &[visible.intersect(&bounds)]); } } // Enabling periodic display during an existing hover must catch up the unseen gap too. app.ui.view.pattern_preview = true; assert!(ensure_gpu(&mut app, &ctx, 0, a, None)); - assert_visible_pixels(&mut app, bounds); + assert_visible_pixels(&mut app, &[bounds]); crate::blend_preview::hover(&mut app, &[photocraft_doc::LayerId(layer)], None); assert!(ensure_gpu(&mut app, &ctx, 0, a, None)); - assert_visible_pixels(&mut app, bounds); + assert_visible_pixels(&mut app, &[bounds]); } #[test] @@ -96,12 +95,12 @@ fn blend_hover_during_background_redraw_restores_committed_pixels() { let panned = DRect::new(2048, 1024, 2304, 1280); assert!(ensure_gpu(&mut app, &ctx, 0, panned, None)); settle_redraw(&mut app); - assert_visible_pixels(&mut app, panned); + assert_visible_pixels(&mut app, &[panned]); crate::blend_preview::hover(&mut app, &[photocraft_doc::LayerId(layer)], None); assert!(ensure_gpu(&mut app, &ctx, 0, panned, None)); settle_redraw(&mut app); let bounds = app.session.active().unwrap().doc.bounds(); - assert_visible_pixels(&mut app, bounds); + assert_visible_pixels(&mut app, &[bounds]); } fn settle_redraw(app: &mut PhotocraftApp) { @@ -115,19 +114,27 @@ fn settle_redraw(app: &mut PhotocraftApp) { } } -fn assert_visible_pixels(app: &mut PhotocraftApp, visible: DRect) { +fn assert_visible_pixels(app: &mut PhotocraftApp, regions: &[DRect]) { let (doc, _) = display_doc(app, 0); let gpu = app.gpu.clone().unwrap(); - let reference = doc.id.0 ^ (1u64 << 60); let (display, _) = canvas_display(app, &doc, None); - gpu.upload_composite(reference, &doc, display.as_deref()); - let (_, size, shown) = gpu.read_texels(doc.id.0).unwrap(); - let (_, _, want) = gpu.read_texels(reference).unwrap(); - for y in visible.y0..visible.y1 { - for x in visible.x0..visible.x1 { - let index = y as usize * size[0] as usize + x as usize; - for channel in 0..4 { - assert!((shown[index][channel] - want[index][channel]).abs() <= 2.0 / 255.0, "preview differs at ({x},{y}) channel{channel}"); + let (format, size, shown) = gpu.read_texels(doc.id.0).expect("read visible canvas"); + assert_eq!(format, eframe::wgpu::TextureFormat::Rgba8Unorm); + assert_eq!(size, [doc.size.width, doc.size.height]); + // Compare with a CPU composite encoded the way the canvas stores it. Uploading + // that reference just to read it back again also rebuilt its entire mip chain. + for ®ion in regions { + assert!(doc.bounds().contains_rect(®ion)); + let reference = photocraft_compose::render(&doc, region); + let expected = gpu_canvas::display_texels(format, display.as_deref(), &reference); + let expected = expected.as_chunks::<4>().0; + for y in region.y0..region.y1 { + for x in region.x0..region.x1 { + let actual = shown[y as usize * size[0] as usize + x as usize]; + let index = ((y - region.y0) as usize) * region.width() as usize + (x - region.x0) as usize; + for (channel, (actual, expected)) in actual.into_iter().zip(expected[index]).enumerate() { + assert!((actual - f32::from(expected) / 255.0).abs() <= 2.0 / 255.0, "preview differs at ({x},{y}) channel {channel}"); + } } } } @@ -169,7 +176,7 @@ fn check_blend_viewport(cpu_fallback: bool, multiple_layers: bool) { assert!(ensure_gpu(&mut app, &ctx, 0, visible, None)); println!("BLEND_VIEWPORT kind={} pixels={} expected={} adapter={:?}", app.perf.last_refresh, app.perf.last_refresh_px, 128 * 128, app.perf.gpu_info); assert_eq!(app.perf.last_refresh_px, 128 * 128, "hover must not recomposite offscreen pixels of a full-canvas layer"); - assert_visible_pixels(&mut app, visible); + assert_visible_pixels(&mut app, &[visible]); app.perf.last_refresh_px = 0; assert!(ensure_gpu(&mut app, &ctx, 0, visible, None)); assert_eq!(app.perf.last_refresh_px, 0, "unchanged view and mode must reuse the texture"); @@ -184,8 +191,7 @@ fn check_blend_viewport(cpu_fallback: bool, multiple_layers: bool) { assert_eq!(app.perf.last_refresh_px, 128 * 128); assert!(ensure_gpu(&mut app, &ctx, 0, visible, None)); assert_eq!(app.perf.last_refresh_px, 128 * 128, "returning view must show the current mode"); - assert_visible_pixels(&mut app, visible); - assert_visible_pixels(&mut app, panned); + assert_visible_pixels(&mut app, &[visible, panned]); crate::blend_preview::hover(&mut app, &layers, None); assert!(ensure_gpu(&mut app, &ctx, 0, visible, None)); assert_eq!(gpu.read_texels(id.0).unwrap(), original, "cancel must restore the whole texture, including previously previewed offscreen pixels"); @@ -194,11 +200,11 @@ fn check_blend_viewport(cpu_fallback: bool, multiple_layers: bool) { app.run("layer.setProps", json!({"layer":layer,"blend":"Multiply"})).unwrap(); assert!(ensure_gpu(&mut app, &ctx, 0, visible, None)); let bounds = app.session.active().unwrap().doc.bounds(); - assert_visible_pixels(&mut app, bounds); + assert_visible_pixels(&mut app, &[bounds]); app.run("file.new", json!({"width":512,"height":384,"background":"white"})).unwrap(); assert!(ensure_gpu(&mut app, &ctx, 1, visible, None)); app.session.set_active(0); app.sync_views(); assert!(ensure_gpu(&mut app, &ctx, 0, visible, None)); - assert_visible_pixels(&mut app, bounds); + assert_visible_pixels(&mut app, &[bounds]); } diff --git a/crates/ui-egui/tests/it/gpu_tests/arbitrary_rotation_preview.rs b/crates/ui-egui/tests/it/gpu_tests/arbitrary_rotation_preview.rs index 97ad7528ac3..d5857e040da 100644 --- a/crates/ui-egui/tests/it/gpu_tests/arbitrary_rotation_preview.rs +++ b/crates/ui-egui/tests/it/gpu_tests/arbitrary_rotation_preview.rs @@ -39,22 +39,29 @@ fn harness() -> Option { } } -fn control(h: &mut Harness, method: &str, params: Value) -> Value { +fn request(h: &mut Harness, method: &str, params: Value) -> Value { let ctx = h.ctx.clone(); let (req, _rx) = ControlRequest::new(method, params); let Reply::Done(value) = handle(h.state_mut(), &ctx, &req) else { panic!("{method} did not finish") }; assert_eq!(value["ok"], true, "{method}: {value}"); - h.run_steps(4); value["result"].clone() } +fn control(h: &mut Harness, method: &str, params: Value) -> Value { + let result = request(h, method, params); + h.run_steps(4); + result +} + fn setup(h: &mut Harness, width: u32, height: u32, zoom: f32, center: [f32; 2]) { + // Settle once after the document is filled and positioned. The fixture does not + // need a canvas frame for the old tab, the empty editor or the temporary white fill. while h.state().session.active().is_some() { - control(h, "engine.execute", json!({"command":"file.close","params":{"discard":true}})); + request(h, "engine.execute", json!({"command":"file.close","params":{"discard":true}})); } - control(h, "engine.execute", json!({"command":"prefs.set","params":{"path":"interface.language","value":"en"}})); - control(h, "engine.execute", json!({"command":"file.new","params":{"width":width,"height":height,"background":"white"}})); - control(h, "engine.execute", json!({"command":"edit.fill","params":{"color":"#2266dd"}})); + request(h, "engine.execute", json!({"command":"prefs.set","params":{"path":"interface.language","value":"en"}})); + request(h, "engine.execute", json!({"command":"file.new","params":{"width":width,"height":height,"background":"white"}})); + request(h, "engine.execute", json!({"command":"edit.fill","params":{"color":"#2266dd"}})); control(h, "ui.set", json!({"zoom":zoom,"center":center})); assert!(h.state().perf.gpu, "the fixture must use the GPU canvas"); } diff --git a/crates/ui-egui/tests/it/gpu_tests/ui_scale_canvas.rs b/crates/ui-egui/tests/it/gpu_tests/ui_scale_canvas.rs index c661370ea64..3ff626b86ce 100644 --- a/crates/ui-egui/tests/it/gpu_tests/ui_scale_canvas.rs +++ b/crates/ui-egui/tests/it/gpu_tests/ui_scale_canvas.rs @@ -86,26 +86,20 @@ fn assert_document_size_is_physical(gpu: bool) { let Some(mut h) = harness(gpu) else { return }; h.run_steps(4); const DOC: u32 = 60; + let app = h.state_mut(); + app.run("file.new", json!({"width": DOC, "height": DOC, "background": "white"})).expect("new"); + app.run("edit.fill", json!({"color": "#000000"})).expect("fill"); + app.sync_views(); // A fractional and an integer UI scale: the canvas sees the scale only as `pixels_per_point` (device px per doc px // = zoom x ppp), and its sampling branches on that product being below 1, whole (or 2 and up) or fractional // (`gpu_canvas::callback::filter_mode`). 125% gives 1.25 and 2.5 at the two zooms, as 150% would; 200% gives 2 and // 4, covering 100%'s 1 and 2, where a dropped ppp could not show anyway (#15652). for ui_scale in ["125", "200"] { - { - let app = h.state_mut(); - while app.session.active().is_some() { - app.run("file.close", json!({"discard": true})).expect("close"); - } - app.run("prefs.set", json!({"values": {"interface.uiScale": ui_scale}})).expect("ui scale"); - app.run("file.new", json!({"width": DOC, "height": DOC, "background": "white"})).expect("new"); - app.run("edit.fill", json!({"color": "#000000"})).expect("fill"); - app.sync_views(); - } + h.state_mut().run("prefs.set", json!({"values": {"interface.uiScale": ui_scale}})).expect("ui scale"); h.run_steps(6); assert_eq!(h.state().perf.gpu, gpu, "UI Scale {ui_scale}: expected the {} canvas", if gpu { "GPU" } else { "CPU" }); for zoom in [1.0f32, 2.0] { control(&mut h, "ui.set", json!({"zoom": zoom, "center": [DOC as f32 / 2.0, DOC as f32 / 2.0]})); - h.run_steps(4); let (w, hgt) = document_physical_size(&mut h); let want = (DOC as f32 * zoom).round() as i64; assert!( From 9aca66db9d0503436442b8808fa09530a97d3811 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 30 Nov 2026 21:03:44 +0000 Subject: [PATCH 23/61] Tests: sample both cancellation points from the captured frame --- crates/ui-egui/tests/it/free_transform_preview_canvas.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/ui-egui/tests/it/free_transform_preview_canvas.rs b/crates/ui-egui/tests/it/free_transform_preview_canvas.rs index 2e195feb226..050549e99cc 100644 --- a/crates/ui-egui/tests/it/free_transform_preview_canvas.rs +++ b/crates/ui-egui/tests/it/free_transform_preview_canvas.rs @@ -166,9 +166,8 @@ fn cancelling_shows_no_moved_pixels(gpu_canvas: bool) { h.event(egui::Event::Key { key: egui::Key::Escape, physical_key: None, pressed: true, repeat: false, modifiers: Modifiers::NONE }); h.step(); assert!(h.state().ui.transform.is_none(), "Escape ended Free Transform"); - let [moved, back] = rgb_at(&mut h, [[230.5, 130.5], [150.5, 150.5]]); + let [moved, back] = rgb_at(&mut h, [[230.5, 130.5], [150.5, 130.5]]); assert!(is_white(moved), "the cancelling frame shows no moved pixels: {moved:?}"); - let back = rgb_at(&mut h, 150.5, 130.5); assert!(is_red(back), "the square is back in its place: {back:?}"); } From f8d9f92a7af36f5ad4bad205302d4b5df8c7042b Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 30 Nov 2026 21:40:29 +0000 Subject: [PATCH 24/61] Tests: wait for a new Camera Raw preview revision (#15928) --- .../ui-egui/tests/it/camera_raw_histogram.rs | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/crates/ui-egui/tests/it/camera_raw_histogram.rs b/crates/ui-egui/tests/it/camera_raw_histogram.rs index 0136b99ceca..e6c2af6106e 100644 --- a/crates/ui-egui/tests/it/camera_raw_histogram.rs +++ b/crates/ui-egui/tests/it/camera_raw_histogram.rs @@ -11,13 +11,13 @@ fn described(h: &Harness<'_, Box>) -> Value { /// Runs the app's frames until the develop of the settings in force has landed, and returns the dialog's /// description. The develop waits on the framework's queue until a request finishes it, as the agent entry /// point's `waitPreview` does. -fn settled(h: &mut Harness<'_, Box>) -> Value { - h.run_steps(2); +fn settled(h: &mut Harness<'_, Box>, previous_revision: u64) -> Value { for _ in 0..2000 { craft::ui::runtime::pending::finish_jobs(&h.ctx, std::time::Duration::from_secs(30)); h.run_steps(1); let now = described(h); - if now["previewPending"] == false && !now["histogram"].is_null() { + let advanced = now["previewRevision"].as_u64().is_some_and(|revision| revision > previous_revision); + if advanced && now["previewPending"] == false && !now["histogram"].is_null() { return now; } std::thread::sleep(std::time::Duration::from_millis(5)); @@ -25,14 +25,9 @@ fn settled(h: &mut Harness<'_, Box>) -> Value { panic!("the Camera Raw preview never finished"); } -/// A control request, then the develop it asks for. -fn request(h: &mut Harness<'_, Box>, params: Value) -> Value { +fn request(h: &mut Harness<'_, Box>, params: Value) { let ctx = h.ctx.clone(); - let reply = camera_raw_ui::menu(h.state_mut(), &ctx, "filter.cameraRaw", ¶ms).unwrap().unwrap(); - if described(h).is_null() { - return reply; - } - settled(h) + camera_raw_ui::menu(h.state_mut(), &ctx, "filter.cameraRaw", ¶ms).unwrap().unwrap(); } #[test] @@ -47,12 +42,14 @@ fn histogram_matches_visible_preview_at_all_supported_depths_and_cancel_commit_a app.run("file.new", json!({"width": 16, "height": 8, "mode": mode, "depth": depth})).unwrap(); app.run("layer.new.layer", json!({})).unwrap(); app.run("edit.fill", json!({"color": "#808080"})).unwrap(); - h.run_steps(3); + h.run_steps(1); let original = h.state().session.active().unwrap().doc.clone(); let steps = h.state().session.active().unwrap().history.past_len(); - let initial = request(&mut h, json!({})); + request(&mut h, json!({})); + let initial = settled(&mut h, 0); assert_eq!(initial["histogram"]["samples"], 128); - let changed = request(&mut h, json!({"ui": {"set": {"exposure": 1.0}}})); + request(&mut h, json!({"ui": {"set": {"exposure": 1.0}}})); + let changed = settled(&mut h, initial["previewRevision"].as_u64().unwrap()); assert_ne!(changed["histogram"]["red"], initial["histogram"]["red"], "{mode}/{depth}: exposure must change the histogram"); assert_eq!(h.state().session.active().unwrap().history.past_len(), steps); request(&mut h, json!({"ui": {"cancel": true}})); @@ -62,7 +59,8 @@ fn histogram_matches_visible_preview_at_all_supported_depths_and_cancel_commit_a h.state_mut().run("edit.undo", json!({})).unwrap(); assert!(std::sync::Arc::ptr_eq(&h.state().session.active().unwrap().doc, &original)); h.state_mut().run("edit.redo", json!({})).unwrap(); - let committed = request(&mut h, json!({})); + request(&mut h, json!({})); + let committed = settled(&mut h, 0); assert_eq!(committed["histogram"]["red"], changed["histogram"]["red"], "{mode}/{depth}: graph and committed pixels disagree"); request(&mut h, json!({"ui": {"cancel": true}})); assert!(described(&h).is_null(), "{mode}/{depth}: Camera Raw must close"); From b47c7afb0445427eadb815ffb3ac9c87d8025628 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 30 Nov 2026 21:42:02 +0000 Subject: [PATCH 25/61] Tests: sample canvas matrices and shrink GPU fixtures --- .../src/canvas/blend_viewport_gpu_tests.rs | 60 +++++++------- .../src/canvas/gpu_canvas/mip_gpu_tests.rs | 78 +++++++++++-------- .../tests/it/gpu_tests/adjust_preview_gpu.rs | 31 +++++--- .../gpu_tests/arbitrary_rotation_preview.rs | 6 +- .../tests/it/gpu_tests/checker_canvas.rs | 47 +++++++---- .../tests/it/gpu_tests/drag_preview_canvas.rs | 11 ++- .../tests/it/gpu_tests/live_stroke_canvas.rs | 4 +- 7 files changed, 147 insertions(+), 90 deletions(-) diff --git a/crates/ui-egui/src/canvas/blend_viewport_gpu_tests.rs b/crates/ui-egui/src/canvas/blend_viewport_gpu_tests.rs index 39064abf626..ec81aeb9956 100644 --- a/crates/ui-egui/src/canvas/blend_viewport_gpu_tests.rs +++ b/crates/ui-egui/src/canvas/blend_viewport_gpu_tests.rs @@ -36,14 +36,14 @@ fn blend_hover_pattern_tiles_and_multiple_views_reuse_current_pixels() { let Some(rs) = render_state() else { return }; let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), Default::default()); app.set_wgpu(rs); - // Half the 1024 × 768 canvas these views were first written for (see `check_blend_viewport`): `a` still runs off - // the right edge and `b` still lies apart from it. - app.run("file.new", json!({"width":512,"height":384,"background":"#336699"})).unwrap(); + // One view crosses the right edge; the other sits apart from it. The + // intervening pixels still have to be refreshed when Pattern Preview opens. + app.run("file.new", json!({"width":256,"height":192,"background":"#336699"})).unwrap(); let layer = app.run("layer.new.layer", json!({})).unwrap()["layer"].as_u64().unwrap(); app.run("edit.fill", json!({"color":"#cc8844"})).unwrap(); let ctx = app.ctx().clone(); - let a = DRect::new(362, 100, 662, 250); - let b = DRect::new(0, 100, 150, 250); + let a = DRect::new(181, 50, 331, 125); + let b = DRect::new(0, 50, 75, 125); assert!(ensure_gpu(&mut app, &ctx, 0, a, None)); app.ui.view.pattern_preview = true; crate::blend_preview::hover(&mut app, &[photocraft_doc::LayerId(layer)], Some(BlendMode::Multiply)); @@ -118,15 +118,21 @@ fn assert_visible_pixels(app: &mut PhotocraftApp, regions: &[DRect]) { let (doc, _) = display_doc(app, 0); let gpu = app.gpu.clone().unwrap(); let (display, _) = canvas_display(app, &doc, None); - let (format, size, shown) = gpu.read_texels(doc.id.0).expect("read visible canvas"); - assert_eq!(format, eframe::wgpu::TextureFormat::Rgba8Unorm); + let format = eframe::wgpu::TextureFormat::Rgba8Unorm; + // Prepare the CPU reference while the GPU can still be drawing. Each requested + // region is compared to the same captured canvas texture. + let references: Vec<_> = regions + .iter() + .map(|®ion| { + assert!(doc.bounds().contains_rect(®ion)); + let reference = photocraft_compose::render(&doc, region); + (region, gpu_canvas::display_texels(format, display.as_deref(), &reference)) + }) + .collect(); + let (actual_format, size, shown) = gpu.read_texels(doc.id.0).expect("read visible canvas"); + assert_eq!(actual_format, format); assert_eq!(size, [doc.size.width, doc.size.height]); - // Compare with a CPU composite encoded the way the canvas stores it. Uploading - // that reference just to read it back again also rebuilt its entire mip chain. - for ®ion in regions { - assert!(doc.bounds().contains_rect(®ion)); - let reference = photocraft_compose::render(&doc, region); - let expected = gpu_canvas::display_texels(format, display.as_deref(), &reference); + for (region, expected) in references { let expected = expected.as_chunks::<4>().0; for y in region.y0..region.y1 { for x in region.x0..region.x1 { @@ -145,11 +151,9 @@ fn check_blend_viewport(cpu_fallback: bool, multiple_layers: bool) { let Some(rs) = render_state() else { return }; let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), Default::default()); app.set_wgpu(rs); - // Every view and count below is half of the 1024 × 768 fixture first used: the clip to the view - // (`blend_preview::clip_damage`) and the catch-up (`blend_preview::uncovered`) are rectangle arithmetic with no - // size threshold, and the canvas stays far below the background redraw's (that case is - // `blend_hover_during_background_redraw_restores_committed_pixels`). The whole-canvas pixel checks cost a quarter. - app.run("file.new", json!({"width":512,"height":384,"background":"#336699"})).unwrap(); + // View clipping and catch-up use rectangles at any size. The visible, + // expanded and disjoint views below still require different refreshes. + app.run("file.new", json!({"width":256,"height":192,"background":"#336699"})).unwrap(); let layer = app.run("layer.new.layer", json!({})).unwrap()["layer"].as_u64().unwrap(); app.run("edit.fill", json!({"color":"#cc8844"})).unwrap(); if cpu_fallback { @@ -163,7 +167,7 @@ fn check_blend_viewport(cpu_fallback: bool, multiple_layers: bool) { layers.push(photocraft_doc::LayerId(other)); } let ctx = app.ctx().clone(); - let visible = DRect::new(128, 128, 256, 256); + let visible = DRect::new(64, 64, 128, 128); assert!(ensure_gpu(&mut app, &ctx, 0, visible, None)); assert!(app.redraws.is_empty(), "small fixture must finish synchronously"); if cpu_fallback { @@ -174,23 +178,23 @@ fn check_blend_viewport(cpu_fallback: bool, multiple_layers: bool) { let original = gpu.read_texels(id.0).unwrap(); crate::blend_preview::hover(&mut app, &layers, Some(BlendMode::Multiply)); assert!(ensure_gpu(&mut app, &ctx, 0, visible, None)); - println!("BLEND_VIEWPORT kind={} pixels={} expected={} adapter={:?}", app.perf.last_refresh, app.perf.last_refresh_px, 128 * 128, app.perf.gpu_info); - assert_eq!(app.perf.last_refresh_px, 128 * 128, "hover must not recomposite offscreen pixels of a full-canvas layer"); + println!("BLEND_VIEWPORT kind={} pixels={} expected={} adapter={:?}", app.perf.last_refresh, app.perf.last_refresh_px, 64 * 64, app.perf.gpu_info); + assert_eq!(app.perf.last_refresh_px, 64 * 64, "hover must not recomposite offscreen pixels of a full-canvas layer"); assert_visible_pixels(&mut app, &[visible]); app.perf.last_refresh_px = 0; assert!(ensure_gpu(&mut app, &ctx, 0, visible, None)); assert_eq!(app.perf.last_refresh_px, 0, "unchanged view and mode must reuse the texture"); - let zoomed_out = DRect::new(64, 64, 320, 320); + let zoomed_out = DRect::new(32, 32, 160, 160); assert!(ensure_gpu(&mut app, &ctx, 0, zoomed_out, None)); - assert_eq!(app.perf.last_refresh_px, 256 * 256, "zooming out catches up the larger visible area"); - let panned = DRect::new(320, 128, 448, 256); + assert_eq!(app.perf.last_refresh_px, 128 * 128, "zooming out catches up the larger visible area"); + let panned = DRect::new(160, 64, 224, 128); assert!(ensure_gpu(&mut app, &ctx, 0, panned, None)); - assert_eq!(app.perf.last_refresh_px, 128 * 128, "newly exposed pixels must catch up without a mode change"); + assert_eq!(app.perf.last_refresh_px, 64 * 64, "newly exposed pixels must catch up without a mode change"); crate::blend_preview::hover(&mut app, &layers, Some(BlendMode::Screen)); assert!(ensure_gpu(&mut app, &ctx, 0, panned, None)); - assert_eq!(app.perf.last_refresh_px, 128 * 128); + assert_eq!(app.perf.last_refresh_px, 64 * 64); assert!(ensure_gpu(&mut app, &ctx, 0, visible, None)); - assert_eq!(app.perf.last_refresh_px, 128 * 128, "returning view must show the current mode"); + assert_eq!(app.perf.last_refresh_px, 64 * 64, "returning view must show the current mode"); assert_visible_pixels(&mut app, &[visible, panned]); crate::blend_preview::hover(&mut app, &layers, None); assert!(ensure_gpu(&mut app, &ctx, 0, visible, None)); @@ -201,7 +205,7 @@ fn check_blend_viewport(cpu_fallback: bool, multiple_layers: bool) { assert!(ensure_gpu(&mut app, &ctx, 0, visible, None)); let bounds = app.session.active().unwrap().doc.bounds(); assert_visible_pixels(&mut app, &[bounds]); - app.run("file.new", json!({"width":512,"height":384,"background":"white"})).unwrap(); + app.run("file.new", json!({"width":256,"height":192,"background":"white"})).unwrap(); assert!(ensure_gpu(&mut app, &ctx, 1, visible, None)); app.session.set_active(0); app.sync_views(); diff --git a/crates/ui-egui/src/canvas/gpu_canvas/mip_gpu_tests.rs b/crates/ui-egui/src/canvas/gpu_canvas/mip_gpu_tests.rs index 31c6faea62e..851a1ee455e 100644 --- a/crates/ui-egui/src/canvas/gpu_canvas/mip_gpu_tests.rs +++ b/crates/ui-egui/src/canvas/gpu_canvas/mip_gpu_tests.rs @@ -135,40 +135,44 @@ fn canvas_textures_the_gpu_refuses_leave_it_working(gpu: &GpuCanvas) { } fn check_mips(gpu: &GpuCanvas) { - for depth in [SampleType::U8, SampleType::U16, SampleType::F32] { - // 767 × 431 is a single tile (`DEFAULT_TILE`) with odd sides down the chain (767, 383, 191, 95 and 431, - // 215, 107, 53), and its levels 1 and 2 are over `WHOLE_MIP_SIDE` (128), so the patch below redraws two - // levels by their damage (`mip_damage`) before the chain is redrawn whole: the paths 1791 × 1083 took, at - // a sixth of the pixels. The larger driver case stays in `partial_updates_match_a_full_rebuild_at_every_mip_level`. - for (w, h) in [(767, 431), (513, 1), (1, 513)] { - let mut full = Buffer::filled(Rect::from_xywh(0, 0, w, h), [0.25, 0.5, 0.75, 1.0]); - // Reusing the key also covers replacing textures after a size or depth change. - gpu.upload_buffer_full(1, &full, depth); - for (level, pixels) in read_mips(gpu, 1).iter().enumerate() { - for pixel in pixels { - assert!((pixel[3] - 1.0).abs() < 0.001, "{depth:?} {w}x{h} mip {level}: {pixel:?}"); - for (actual, expected) in pixel.iter().zip([0.25, 0.5, 0.75, 1.0]) { - assert!((actual - expected).abs() < 0.005, "{depth:?} {w}x{h} mip {level}: {pixel:?}"); - } + use SampleType::{F32, U8, U16}; + // 519 is odd and still gives two damage-redrawn levels above WHOLE_MIP_SIDE + // (259 and 129), followed by whole levels. Both stored formats use this path + // on each backend, and the thin horizontal and vertical cases reach 1 × 1. + // U16 and F32 use the same float texture and mip pipeline for these values. + let depths_and_sizes: &[(SampleType, u32, u32)] = if photocraft_testkit::full_sweep() { + &[(U8, 767, 431), (U8, 513, 1), (U8, 1, 513), (U16, 767, 431), (U16, 513, 1), (U16, 1, 513), (F32, 767, 431), (F32, 513, 1), (F32, 1, 513)] + } else { + &[(U8, 519, 267), (U16, 519, 267), (F32, 1, 513), (U8, 513, 1)] + }; + for &(depth, w, h) in depths_and_sizes { + let mut full = Buffer::filled(Rect::from_xywh(0, 0, w, h), [0.25, 0.5, 0.75, 1.0]); + // Reusing the key also covers replacing textures after a size or depth change. + gpu.upload_buffer_full(1, &full, depth); + for (level, pixels) in read_mips(gpu, 1).iter().enumerate() { + for pixel in pixels { + assert!((pixel[3] - 1.0).abs() < 0.001, "{depth:?} {w}x{h} mip {level}: {pixel:?}"); + for (actual, expected) in pixel.iter().zip([0.25, 0.5, 0.75, 1.0]) { + assert!((actual - expected).abs() < 0.005, "{depth:?} {w}x{h} mip {level}: {pixel:?}"); } } - let patch = Rect::from_xywh((w / 2) as i32, (h / 2) as i32, (w / 3).max(1), (h / 3).max(1)); - let changed = Buffer::filled(patch, [1.0, 0.0, 0.0, 1.0]); - assert!(gpu.upload_buffer_rect(1, &changed)); - for y in patch.y0..patch.y1 { - for x in patch.x0..patch.x1 { - full.px[y as usize * w as usize + x as usize] = [1.0, 0.0, 0.0, 1.0]; - } + } + let patch = Rect::from_xywh((w / 2) as i32, (h / 2) as i32, (w / 3).max(1), (h / 3).max(1)); + let changed = Buffer::filled(patch, [1.0, 0.0, 0.0, 1.0]); + assert!(gpu.upload_buffer_rect(1, &changed)); + for y in patch.y0..patch.y1 { + for x in patch.x0..patch.x1 { + full.px[y as usize * w as usize + x as usize] = [1.0, 0.0, 0.0, 1.0]; } - gpu.upload_buffer_full(2, &full, depth); - let partial = read_mips(gpu, 1); - let rebuilt = read_mips(gpu, 2); - for (level, (actual, expected)) in partial.iter().zip(&rebuilt).enumerate() { - for (a, b) in actual.iter().zip(expected) { - assert!((a[3] - 1.0).abs() < 0.001, "partial {depth:?} mip {level}: {a:?}"); - for (a, b) in a.iter().zip(b) { - assert!((a - b).abs() < 0.005, "partial/full mismatch {depth:?} {w}x{h} mip {level}: {a} != {b}"); - } + } + gpu.upload_buffer_full(2, &full, depth); + let partial = read_mips(gpu, 1); + let rebuilt = read_mips(gpu, 2); + for (level, (actual, expected)) in partial.iter().zip(&rebuilt).enumerate() { + for (a, b) in actual.iter().zip(expected) { + assert!((a[3] - 1.0).abs() < 0.001, "partial {depth:?} mip {level}: {a:?}"); + for (a, b) in a.iter().zip(b) { + assert!((a - b).abs() < 0.005, "partial/full mismatch {depth:?} {w}x{h} mip {level}: {a} != {b}"); } } } @@ -188,7 +192,17 @@ fn partial_updates_match_a_full_rebuild_at_every_mip_level() { return; }; let gpu = GpuCanvas::new(&rs); - for (depth, w, h) in [(SampleType::U8, 255, 255), (SampleType::U8, 1024, 768), (SampleType::F32, 512, 512), (SampleType::F32, 1791, 1083)] { + let adapter = rs.adapter.get_info(); + // Keep the allocation/layout sweep on physical Vulkan devices, where the + // scissor regression was observed, and in the full sweep. Software adapters + // still exercise both texture formats, whole and partial redraws, and both dabs. + let sizes: &[(SampleType, u32, u32)] = + if photocraft_testkit::full_sweep() || (adapter.backend == wgpu::Backend::Vulkan && adapter.device_type != wgpu::DeviceType::Cpu) { + &[(SampleType::U8, 255, 255), (SampleType::U8, 1024, 768), (SampleType::F32, 512, 512), (SampleType::F32, 1791, 1083)] + } else { + &[(SampleType::U8, 255, 255), (SampleType::F32, 519, 267)] + }; + for &(depth, w, h) in sizes { let mut full = Buffer::filled(Rect::from_xywh(0, 0, w, h), [0.0; 4]); for (i, px) in full.px.iter_mut().enumerate() { let (x, y) = (i as u32 % w, i as u32 / w); diff --git a/crates/ui-egui/tests/it/gpu_tests/adjust_preview_gpu.rs b/crates/ui-egui/tests/it/gpu_tests/adjust_preview_gpu.rs index 3c4ee58a4bd..e50213f8c37 100644 --- a/crates/ui-egui/tests/it/gpu_tests/adjust_preview_gpu.rs +++ b/crates/ui-egui/tests/it/gpu_tests/adjust_preview_gpu.rs @@ -188,11 +188,12 @@ fn preview_layer_composites_on_the_gpu_like_the_command() { // command's CPU result (adds the command's rounding to the layer depth). let (tol_gpu, tol_cmd) = (2.0 / 255.0, 2.5 / 255.0); let mut worst = 0.0f32; + let full_sweep = photocraft_testkit::full_sweep(); for mode in [ColorMode::Rgb, ColorMode::Grayscale] { - for depth in [SampleType::U8, SampleType::U16, SampleType::F32] { + for (depth_index, depth) in [SampleType::U8, SampleType::U16, SampleType::F32].into_iter().enumerate() { for selection in [false, true] { let (doc, target) = document(mode, depth, selection); - for kind in photocraft_ui_egui::adjust_editors::KINDS { + for (kind_index, kind) in photocraft_ui_egui::adjust_editors::KINDS.into_iter().enumerate() { let params = sample(kind); let preview = match preview_document(&doc, target, kind, ¶ms) { Ok(p) => p, @@ -209,18 +210,28 @@ fn preview_layer_composites_on_the_gpu_like_the_command() { // The GPU holds 16- and 32-bit layers as half floats: Threshold and Posterize // may flip a few pixels sitting right at a step (1 % allowed). let skip = if matches!(kind, "threshold" | "posterize") && depth != SampleType::U8 { (b.width() * b.height()) as usize / 100 } else { 0 }; - let on_gpu = render_to_vec(&mut comp, &device, &queue, &preview, b).unwrap_or_else(|e| panic!("{what}: {e:?}")); + // The selection is a mask on the same preview layer and does not change + // the adjustment shader. Keep every shader at every mode and depth, with + // both mask paths represented there. The full sweep crosses the mask + // axis with every shader on the GPU. + let check_gpu = full_sweep || selection == (kind_index + depth_index).is_multiple_of(2); let on_cpu = photocraft_compose::render(&preview, b).into_px(); - let d = max_diff(&on_gpu, &on_cpu, skip); - assert!(d <= tol_gpu, "{what}: GPU vs CPU {:.2}/255", d * 255.0); let mut s = photocraft_engine::Session::new(); s.add_document(doc.clone(), None); s.select_layer(target).unwrap(); - s.execute(&format!("image.adjustments.{kind}"), params.clone()).unwrap(); + s.execute(&format!("image.adjustments.{kind}"), params).unwrap(); let cmd = photocraft_compose::render(&s.active().unwrap().doc, b).into_px(); - let d = max_diff(&on_gpu, &cmd, skip); - worst = worst.max(d); - assert!(d <= tol_cmd, "{what}: GPU preview vs command {:.2}/255", d * 255.0); + if check_gpu { + let on_gpu = render_to_vec(&mut comp, &device, &queue, &preview, b).unwrap_or_else(|e| panic!("{what}: {e:?}")); + let d = max_diff(&on_gpu, &on_cpu, skip); + assert!(d <= tol_gpu, "{what}: GPU vs CPU {:.2}/255", d * 255.0); + let d = max_diff(&on_gpu, &cmd, skip); + worst = worst.max(d); + assert!(d <= tol_cmd, "{what}: GPU preview vs command {:.2}/255", d * 255.0); + } else { + let d = max_diff(&on_cpu, &cmd, skip); + assert!(d <= tol_cmd, "{what}: CPU preview vs command {:.2}/255", d * 255.0); + } } } } @@ -291,7 +302,7 @@ fn proxy_preview_composites_on_the_gpu() { let (doc, target) = document(ColorMode::Rgb, SampleType::U8, selection); let proxy = proxy_base(&base_document(&doc, target).unwrap(), 2); // Render the full document too, so both share the compositor's resident textures. - render_to_vec(&mut comp, &device, &queue, &doc, doc.bounds()).unwrap(); + comp.render(&device, &queue, &doc, doc.bounds(), |_, _| {}).unwrap(); for kind in photocraft_ui_egui::adjust_editors::KINDS { let p = proxy_with_settings(&proxy, kind, &sample(kind)).unwrap(); let on_gpu = render_to_vec(&mut comp, &device, &queue, &p, p.bounds()).unwrap(); diff --git a/crates/ui-egui/tests/it/gpu_tests/arbitrary_rotation_preview.rs b/crates/ui-egui/tests/it/gpu_tests/arbitrary_rotation_preview.rs index d5857e040da..88d506e0107 100644 --- a/crates/ui-egui/tests/it/gpu_tests/arbitrary_rotation_preview.rs +++ b/crates/ui-egui/tests/it/gpu_tests/arbitrary_rotation_preview.rs @@ -136,18 +136,18 @@ fn size_changing_rotation_preview_is_visible_and_preserves_the_panned_center() { setup(&mut h, width, height, zoom, center); assert_eq!(photocraft_ui_egui::proxy::factor(&h.state().session.active().unwrap().doc), factor); let id = open_previewing(&mut h); - let source = blue(&mut h, &format!("{width}x{height}-{degrees}-zero")).0; - assert!(source > 5_000, "the unrotated blue image must be visible outside the dialog"); angle(&mut h, &id, degrees); h.get_by_label("Preview").click(); h.run_steps(4); assert!(!preview_on(&h)); - assert!(blue(&mut h, &format!("{width}x{height}-{degrees}-off")).0 > 5_000, "Preview off shows the original image"); + let (original, original_top, original_bottom) = blue(&mut h, &format!("{width}x{height}-{degrees}-off")); + assert!(original > 5_000, "Preview off shows the original image"); h.get_by_label("Preview").click(); h.run_steps(4); assert!(preview_on(&h)); let (count, top, bottom) = blue(&mut h, &format!("{width}x{height}-{degrees}-on")); assert!(count > 5_000, "{width}x{height}, {degrees}°, factor {factor}: rotated blue pixels disappeared ({count} remain)"); + assert!(bottom - top > original_bottom - original_top, "{degrees}°: the rotated preview should be taller"); let rect = photocraft_ui_egui::canvas::active_view(h.state()).expect("a shown view").rect; let expected_y = rect.center().y + (height as f32 / 2.0 - center[1]) * zoom; let actual_y = (top + bottom) as f32 / 2.0; diff --git a/crates/ui-egui/tests/it/gpu_tests/checker_canvas.rs b/crates/ui-egui/tests/it/gpu_tests/checker_canvas.rs index 709019a6287..693dc984444 100644 --- a/crates/ui-egui/tests/it/gpu_tests/checker_canvas.rs +++ b/crates/ui-egui/tests/it/gpu_tests/checker_canvas.rs @@ -30,7 +30,7 @@ fn harness_with(gpu: bool) -> Option { fn harness_with_scale(gpu: bool, ppp: f32) -> Option { // At 2× the same document pixels take half as many points. Keep the samples // inside the viewport without reading back a 2800 × 1600 frame. - let size = if ppp > 1.0 { egui::vec2(960.0, 600.0) } else { egui::vec2(1400.0, 800.0) }; + let size = if ppp > 1.0 { egui::vec2(820.0, 570.0) } else { egui::vec2(900.0, 640.0) }; let built = std::panic::catch_unwind(|| { egui_kittest::Harness::builder().with_size(size).with_pixels_per_point(ppp).with_max_steps(64).wgpu().build_eframe(|cc| { PhotocraftApp::setup_context(&cc.egui_ctx, Default::default()); @@ -123,7 +123,8 @@ fn render_on(h: &mut Harness, gpu: bool, zoom: f32, doc: u32, black: bool) -> (S return (img, origin.x.round() as u32, origin.y.round() as u32, (doc as f32 * zoom).round() as u32); } let r = h.state().last_canvas_rect; - let (cx, cy) = (r.center().x as u32, r.center().y as u32); + let center = r.center() * h.ctx.pixels_per_point(); + let (cx, cy) = (center.x as u32, center.y as u32); let (x0, w) = longest_run((0..width).map(|x| is_checker_grey(img.at(x, cy)))); let (y0, hgt) = longest_run((0..height).map(|y| is_checker_grey(img.at(cx, y)))); let doc_px = (doc as f32 * zoom).round() as i64; @@ -136,9 +137,22 @@ fn checker_cells_are_8_screen_pixels_at_every_zoom() { let _gpu = photocraft_testkit::gpu_lock(); let Some(mut h) = harness() else { return }; h.run_steps(4); - // The 8 px cell never changes with the zoom. + // The checker draws in physical pixels, independent of the document zoom. + // Sample reduced, 1:1, fractional and magnified views, including 2× displays. + let zooms_1x: &[(f32, u32)] = if photocraft_testkit::full_sweep() { + &[(0.5, 64), (1.0, 64), (1.1, 64), (2.0, 32), (3.3, 32), (5.5, 32), (8.0, 32), (13.0, 32), (32.0, 12)] + } else { + &[(0.5, 64), (1.0, 64), (1.1, 64)] + }; + let zooms_2x = [(8.0, 32), (32.0, 12)]; + let cases = zooms_1x.iter().map(|&(zoom, doc)| (1.0, zoom, doc)).chain(zooms_2x.into_iter().map(|(zoom, doc)| (2.0, zoom, doc))); let mut current_size = 0; - for (zoom, doc) in [(0.5, 64), (1.0, 64), (1.1, 64), (2.0, 32), (3.3, 32), (5.5, 32), (8.0, 32), (13.0, 32), (32.0, 12)] { + for (ppp, zoom, doc) in cases { + if h.ctx.pixels_per_point() != ppp { + h.input_mut().viewports.get_mut(&egui::ViewportId::ROOT).expect("root viewport").native_pixels_per_point = Some(ppp); + h.run_steps(4); + } + assert_eq!(h.ctx.pixels_per_point(), ppp); if current_size != doc { open_document(&mut h, doc, false, false); current_size = doc; @@ -176,11 +190,11 @@ fn pixel_grid_shows_above_500_percent_and_lightens_a_dark_pixel_by_about_a_quart let _gpu = photocraft_testkit::gpu_lock(); let Some(mut h) = harness() else { return }; h.run_steps(4); - open_document(&mut h, 48, true, true); - let (flat, x0, y0, _) = render_on(&mut h, true, 5.0, 48, true); + open_document(&mut h, 24, true, true); + let (flat, x0, y0, _) = render_on(&mut h, true, 5.0, 24, true); assert!(lit_columns(&flat, x0, y0 + 20, 100).is_empty(), "no grid at 500%"); for zoom in [6.0f32, 8.0, 12.0] { - let (img, x0, y0, _) = render_on(&mut h, true, zoom, 48, true); + let (img, x0, y0, _) = render_on(&mut h, true, zoom, 24, true); let lit = lit_columns(&img, x0, y0 + (zoom * 3.5) as u32, (zoom * 10.0) as u32); assert_eq!(lit.len(), 10, "zoom {zoom}: grid columns {lit:?}"); assert!(lit.windows(2).all(|p| p[1] - p[0] == zoom as u32), "zoom {zoom}: spacing of {lit:?}"); @@ -212,11 +226,11 @@ fn cpu_pixel_grid_shows_above_500_percent_over_content() { for ppp in [1.0, 2.0] { let Some(mut h) = harness_with_scale(false, ppp) else { return }; h.run_steps(4); - open_document(&mut h, 48, true, true); - let (flat, x0, y0, _) = render_on(&mut h, false, 5.0, 48, true); + open_document(&mut h, 24, true, true); + let (flat, x0, y0, _) = render_on(&mut h, false, 5.0, 24, true); assert!(lit_columns(&flat, x0, y0 + 20, 100).is_empty(), "no grid at 500%"); for zoom in [6.0f32, 8.0, 12.0] { - let (img, x0, y0, _) = render_on(&mut h, false, zoom, 48, true); + let (img, x0, y0, _) = render_on(&mut h, false, zoom, 24, true); let y = y0 + (zoom * 3.5) as u32; let lit = lit_columns(&img, x0, y, (zoom * 10.0) as u32); assert_eq!(lit.len(), 10, "scale {ppp}, zoom {zoom}: one physical pixel per line, columns {lit:?}"); @@ -324,9 +338,16 @@ fn pixel_grid_is_solid_and_visible_at_scale(gpu: bool, ppp: f32) { app.session.add_document(doc, None); app.sync_views(); app.ui.view.show.pixel_grid = true; - // The 8-bit case also covers the threshold on both canvases at both display scales. - let zooms: &[f32] = if depth == SampleType::U8 { &[5.0, 7.119, 8.0, 22.825] } else { &[7.119, 8.0, 22.825] }; - for &zoom in zooms { + // Keep the 500% cutoff at each scale. Across the two scales, sample both + // fractional and integer grid alignment, including the largest zoom. + let visible_zooms: &[f32] = if photocraft_testkit::full_sweep() { + &[7.119, 8.0, 22.825] + } else if ppp == 1.0 { + &[7.119] + } else { + &[8.0, 22.825] + }; + for zoom in (depth == SampleType::U8).then_some(5.0).into_iter().chain(visible_zooms.iter().copied()) { set_view(&mut h, zoom, [16.0, 8.0]); assert_eq!(h.state().perf.gpu, gpu); assert_eq!(h.ctx.pixels_per_point(), ppp); diff --git a/crates/ui-egui/tests/it/gpu_tests/drag_preview_canvas.rs b/crates/ui-egui/tests/it/gpu_tests/drag_preview_canvas.rs index a3facea0240..03030efc629 100644 --- a/crates/ui-egui/tests/it/gpu_tests/drag_preview_canvas.rs +++ b/crates/ui-egui/tests/it/gpu_tests/drag_preview_canvas.rs @@ -197,17 +197,22 @@ fn marquee_previews_show_while_dragging_on_white_and_black_at_1x_and_2x() { // which the marquee tool paints through `ToolContext::marching_ants`). White on white (#253) hid the light ants // and black would hide the dark ones; over grey the test sees both inks at once, so an outline missing either // colour fails here as it failed on one of the two documents. (The name is the one CI's slow-test order lists.) - // One harness for both scales: the app derives its scale from the window's native one every frame - // (`prefs_ui/appearance.rs` `interface_zoom`), so the 2x pass sets that, as a move to a HiDPI display does. + // Both shapes paint through the same scale-aware marching-ants painter. + // Sample the rectangle at 1× and the curve at 2× by default; the full + // sweep also covers each shape at the other scale. + let full_sweep = photocraft_testkit::full_sweep(); let Some(mut h) = harness(1.0) else { return }; h.run_steps(4); - for ppp in [1.0f32, 2.0] { + for (ppp, primary) in [(1.0f32, "rectMarquee"), (2.0, "ellipseMarquee")] { if let Some(root) = h.input_mut().viewports.get_mut(&egui::ViewportId::ROOT) { root.native_pixels_per_point = Some(ppp); } h.run_steps(4); assert_eq!(h.ctx.pixels_per_point(), ppp, "the harness runs at {ppp}x"); for tool in ["rectMarquee", "ellipseMarquee"] { + if tool != primary && !full_sweep { + continue; + } setup(&mut h, GREY, tool); let (a, b) = ([100.0, 80.0], [300.0, 220.0]); let before = render(&mut h); diff --git a/crates/ui-egui/tests/it/gpu_tests/live_stroke_canvas.rs b/crates/ui-egui/tests/it/gpu_tests/live_stroke_canvas.rs index 1071f4214b2..bf92a75c034 100644 --- a/crates/ui-egui/tests/it/gpu_tests/live_stroke_canvas.rs +++ b/crates/ui-egui/tests/it/gpu_tests/live_stroke_canvas.rs @@ -155,7 +155,9 @@ fn frames(h: &mut Harness, c: Case) -> (Pixels, Pixels, Pixels, bool) { let before = canvas(h); let pressure = |t: f64| if c.pressure { 0.3 + 0.7 * t } else { 1.0 }; control(h, "ui.pointer", json!({"events": [{"kind": "down", "x": 100, "y": 100, "pressure": pressure(0.0)}]})); - let n = 14; + // Keep the whole curved path and both ends of the pressure ramp. The full + // sweep also exercises the original denser sequence of pointer events. + let n = if photocraft_testkit::full_sweep() { 14 } else { 8 }; let mut last = (100.0, 100.0); for i in 1..=n { let t = f64::from(i) / f64::from(n); From 796bfedfddc3ad5435d0c025ca967557aa520dcb Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 30 Nov 2026 21:45:50 +0000 Subject: [PATCH 26/61] Tests: reuse the CPU adjustment mask matrix --- .../tests/it/gpu_tests/adjust_preview_gpu.rs | 28 ++++++++----------- 1 file changed, 12 insertions(+), 16 deletions(-) diff --git a/crates/ui-egui/tests/it/gpu_tests/adjust_preview_gpu.rs b/crates/ui-egui/tests/it/gpu_tests/adjust_preview_gpu.rs index e50213f8c37..43790c4a406 100644 --- a/crates/ui-egui/tests/it/gpu_tests/adjust_preview_gpu.rs +++ b/crates/ui-egui/tests/it/gpu_tests/adjust_preview_gpu.rs @@ -194,6 +194,12 @@ fn preview_layer_composites_on_the_gpu_like_the_command() { for selection in [false, true] { let (doc, target) = document(mode, depth, selection); for (kind_index, kind) in photocraft_ui_egui::adjust_editors::KINDS.into_iter().enumerate() { + // Keep every shader at every mode and depth, sampling both mask + // paths. The CPU test preview_composite_matches_the_destructive_command + // already compares all combinations; the full GPU sweep keeps them too. + if !full_sweep && selection != (kind_index + depth_index).is_multiple_of(2) { + continue; + } let params = sample(kind); let preview = match preview_document(&doc, target, kind, ¶ms) { Ok(p) => p, @@ -210,28 +216,18 @@ fn preview_layer_composites_on_the_gpu_like_the_command() { // The GPU holds 16- and 32-bit layers as half floats: Threshold and Posterize // may flip a few pixels sitting right at a step (1 % allowed). let skip = if matches!(kind, "threshold" | "posterize") && depth != SampleType::U8 { (b.width() * b.height()) as usize / 100 } else { 0 }; - // The selection is a mask on the same preview layer and does not change - // the adjustment shader. Keep every shader at every mode and depth, with - // both mask paths represented there. The full sweep crosses the mask - // axis with every shader on the GPU. - let check_gpu = full_sweep || selection == (kind_index + depth_index).is_multiple_of(2); + let on_gpu = render_to_vec(&mut comp, &device, &queue, &preview, b).unwrap_or_else(|e| panic!("{what}: {e:?}")); let on_cpu = photocraft_compose::render(&preview, b).into_px(); + let d = max_diff(&on_gpu, &on_cpu, skip); + assert!(d <= tol_gpu, "{what}: GPU vs CPU {:.2}/255", d * 255.0); let mut s = photocraft_engine::Session::new(); s.add_document(doc.clone(), None); s.select_layer(target).unwrap(); s.execute(&format!("image.adjustments.{kind}"), params).unwrap(); let cmd = photocraft_compose::render(&s.active().unwrap().doc, b).into_px(); - if check_gpu { - let on_gpu = render_to_vec(&mut comp, &device, &queue, &preview, b).unwrap_or_else(|e| panic!("{what}: {e:?}")); - let d = max_diff(&on_gpu, &on_cpu, skip); - assert!(d <= tol_gpu, "{what}: GPU vs CPU {:.2}/255", d * 255.0); - let d = max_diff(&on_gpu, &cmd, skip); - worst = worst.max(d); - assert!(d <= tol_cmd, "{what}: GPU preview vs command {:.2}/255", d * 255.0); - } else { - let d = max_diff(&on_cpu, &cmd, skip); - assert!(d <= tol_cmd, "{what}: CPU preview vs command {:.2}/255", d * 255.0); - } + let d = max_diff(&on_gpu, &cmd, skip); + worst = worst.max(d); + assert!(d <= tol_cmd, "{what}: GPU preview vs command {:.2}/255", d * 255.0); } } } From 8502ce2274863c7d0c93d0804c29e5b48695fa80 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 30 Nov 2026 21:58:36 +0000 Subject: [PATCH 27/61] Tests: measure checker cells in display points --- crates/ui-egui/tests/it/gpu_tests/checker_canvas.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/crates/ui-egui/tests/it/gpu_tests/checker_canvas.rs b/crates/ui-egui/tests/it/gpu_tests/checker_canvas.rs index 693dc984444..5d1c58ab5bc 100644 --- a/crates/ui-egui/tests/it/gpu_tests/checker_canvas.rs +++ b/crates/ui-egui/tests/it/gpu_tests/checker_canvas.rs @@ -1,4 +1,4 @@ -//! The transparency checker is made of 8 screen pixel cells (the Medium preference) at every zoom, +//! The transparency checker is made of 8 screen point cells (the Medium preference) at every zoom, //! anchored to the document's top-left corner so the pattern moves with the image. The pixel grid shows above 500% zoom, //! over pixels with content only, never over empty checker. //! @@ -137,7 +137,7 @@ fn checker_cells_are_8_screen_pixels_at_every_zoom() { let _gpu = photocraft_testkit::gpu_lock(); let Some(mut h) = harness() else { return }; h.run_steps(4); - // The checker draws in physical pixels, independent of the document zoom. + // The checker draws in screen points, independent of the document zoom. // Sample reduced, 1:1, fractional and magnified views, including 2× displays. let zooms_1x: &[(f32, u32)] = if photocraft_testkit::full_sweep() { &[(0.5, 64), (1.0, 64), (1.1, 64), (2.0, 32), (3.3, 32), (5.5, 32), (8.0, 32), (13.0, 32), (32.0, 12)] @@ -158,11 +158,12 @@ fn checker_cells_are_8_screen_pixels_at_every_zoom() { current_size = doc; } let (img, x0, y0, _) = render_on(&mut h, true, zoom, doc, false); - let n = ((doc as f32 * zoom) / 8.0) as u32; + let cell = (8.0 * ppp) as u32; + let n = (doc as f32 * zoom) as u32 / cell; assert!(n >= 2, "zoom {zoom}: test needs at least two cells"); for row in 0..n.min(4) { for col in 0..n.min(6) { - let (sx, sy) = (x0 + col * 8 + 4, y0 + row * 8 + 4); + let (sx, sy) = (x0 + col * cell + cell / 2, y0 + row * cell + cell / 2); let got = img.at(sx, sy); let want = if (col + row) % 2 == 0 { LIGHT } else { DARK }; assert!( @@ -172,8 +173,8 @@ fn checker_cells_are_8_screen_pixels_at_every_zoom() { } } // Crisp: every pixel of the row is exactly one of the two greys, no blended edges. - let y = y0 + 4; - for x in x0..x0 + (n * 8).min(48) { + let y = y0 + cell / 2; + for x in x0..x0 + n.min(6) * cell { let v = img.at(x, y)[0]; assert!(v == LIGHT || v == DARK, "zoom {zoom}: blended pixel {v} at ({x}, {y})"); } From 096efeda36f54280ddf2fe436f5f71c9b260ef81 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 30 Nov 2026 22:00:00 +0000 Subject: [PATCH 28/61] Tests: fit the full pixel-grid sweep at 1x --- crates/ui-egui/tests/it/gpu_tests/checker_canvas.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/tests/it/gpu_tests/checker_canvas.rs b/crates/ui-egui/tests/it/gpu_tests/checker_canvas.rs index 5d1c58ab5bc..ae99576baa8 100644 --- a/crates/ui-egui/tests/it/gpu_tests/checker_canvas.rs +++ b/crates/ui-egui/tests/it/gpu_tests/checker_canvas.rs @@ -30,7 +30,14 @@ fn harness_with(gpu: bool) -> Option { fn harness_with_scale(gpu: bool, ppp: f32) -> Option { // At 2× the same document pixels take half as many points. Keep the samples // inside the viewport without reading back a 2800 × 1600 frame. - let size = if ppp > 1.0 { egui::vec2(820.0, 570.0) } else { egui::vec2(900.0, 640.0) }; + let size = if ppp > 1.0 { + egui::vec2(820.0, 570.0) + } else if photocraft_testkit::full_sweep() { + // The full sweep also samples a 730 px wide document at 1×. + egui::vec2(1400.0, 800.0) + } else { + egui::vec2(900.0, 640.0) + }; let built = std::panic::catch_unwind(|| { egui_kittest::Harness::builder().with_size(size).with_pixels_per_point(ppp).with_max_steps(64).wgpu().build_eframe(|cc| { PhotocraftApp::setup_context(&cc.egui_ctx, Default::default()); From 0ac3db44f2c7636b1ef67b7d7e98b42a69d96851 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 30 Nov 2026 22:44:35 +0000 Subject: [PATCH 29/61] Tests: retain all 199 autosave race repetitions --- crates/format/tests/it/autosave.rs | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/crates/format/tests/it/autosave.rs b/crates/format/tests/it/autosave.rs index 07d8ff2f54a..7627348743d 100644 --- a/crates/format/tests/it/autosave.rs +++ b/crates/format/tests/it/autosave.rs @@ -349,23 +349,28 @@ fn a_listing_during_an_autosave_sees_the_entry_exactly_once() { entry.info.revision }; let deadline = std::time::Instant::now() + std::time::Duration::from_secs(5 * 60); - for revision in 2..=17 { + // Each replacement is another opportunity to observe a transient missing sidecar. + for revision in 2..=200 { saver.request_checked(doc.clone(), revision, None, SaveOptions::default()).unwrap(); loop { - // List on this thread while the autosave worker writes. The preceding sidecar or - // its replacement must supply the revision. A sidecar-less fallback reports zero. - let listed = listed_revision(); - assert!((revision - 1..=revision).contains(&listed), "listed revision {listed} while writing {revision}"); let completed = saver.take_completed(); - if !completed.is_empty() { - let [(written, result)] = completed.as_slice() else { panic!("expected one completed write: {completed:?}") }; - assert_eq!(*written, revision); - result.as_ref().unwrap(); - break; + // List on this thread while the autosave worker writes. The preceding sidecar or + // its replacement supplies the revision. A sidecar-less fallback reports zero. + let listed = listed_revision(); + match completed.as_slice() { + [] => { + assert!((revision - 1..=revision).contains(&listed), "listed revision {listed} while writing {revision}"); + assert!(std::time::Instant::now() < deadline, "autosave did not complete revision {revision}"); + } + [(written, result)] => { + assert_eq!(*written, revision); + result.as_ref().unwrap(); + assert_eq!(listed, revision, "the completed replacement is visible"); + break; + } + _ => panic!("expected one completed write: {completed:?}"), } - assert!(std::time::Instant::now() < deadline, "autosave did not complete revision {revision}"); } - assert_eq!(listed_revision(), revision, "the completed replacement is visible"); } assert!(saver.flush().is_some_and(|r| r.is_ok())); std::fs::remove_dir_all(dir).unwrap(); From 83956bb358e0fb3a59d7e94b4c59b4b10b94e652 Mon Sep 17 00:00:00 2001 From: Dan Date: Mon, 30 Nov 2026 22:44:35 +0000 Subject: [PATCH 30/61] Tests: preserve full-frame Relight parity coverage --- crates/algo/src/relight.rs | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) diff --git a/crates/algo/src/relight.rs b/crates/algo/src/relight.rs index c8d8ae863d9..efa96684e8d 100644 --- a/crates/algo/src/relight.rs +++ b/crates/algo/src/relight.rs @@ -524,25 +524,29 @@ mod tests { #[test] fn tiles_match_a_full_apply_past_the_old_halo() { // Default softness on a 1600 px short side: σ = 32, reach 129 px. The previous - // 97 px halo left a gap, so 128 px tiles seamed. + // 97 px halo left a gap, so 128 px tiles seamed. Tile 128 vs one full-frame tile. let size = 1600; - let tile = 128; let bounds = Rect::new(0, 0, size, size); let s = shaded_sphere(SampleType::F32, size); let p = relight_p(180.0, 40.0, 60.0, 40.0, 0.0, 25.0); assert!(read_radius(sigma(25.0, bounds)) > 97); - let layer = output_area(&p, s.content_bounds(), bounds, None); - // Keep the full-layer grid at the sphere's upper edge. The window includes a seam - // in each direction, partial tiles, and the top edge of the document. - let (x, y) = (layer.x0 + 6 * tile, layer.y0 + tile); - let side = tile + tile / 2; - let area = Rect::new(x, y, x + side, y + side); - let full = apply_tiled(&s, &p, area, bounds, None, side, None); - let tiled = apply_tiled(&s, &p, area, bounds, None, tile, None); - let inside = area.intersect(&bounds); - let expected = full.read_region(inside); - assert!(max_diff(&expected, &s.read_region(inside)) > 1e-4, "the window must be relit"); - let d = max_diff(&expected, &tiled.read_region(inside)); + let area = output_area(&p, s.content_bounds(), bounds, None); + let full = apply_tiled(&s, &p, area, bounds, None, 4096, None); + // Keep every tile that contributes checked pixels, including each edge tile's + // original rectangle and halo. The remaining tiles lie wholly outside the canvas. + let tile = 128; + let tile_start = |pixel: i32, origin: i32| origin + (pixel - origin).div_euclid(tile) * tile; + let visible_tiles = Rect::new( + tile_start(bounds.x0, area.x0), + tile_start(bounds.y0, area.y0), + tile_start(bounds.x1 - 1, area.x0) + tile, + tile_start(bounds.y1 - 1, area.y0) + tile, + ) + .intersect(&area); + let tiled = apply_tiled(&s, &p, visible_tiles, bounds, None, tile, None); + let center = size / 2; + assert!(max_diff(&full.pixel(center, center), &s.pixel(center, center)) > 1e-4, "the full frame must be relit"); + let d = max_diff(&full.read_region(bounds), &tiled.read_region(bounds)); assert!(d <= 1e-4, "tile seam {d}"); } From 323cc561499b7c427e3d067e2e55e54de11b5194 Mon Sep 17 00:00:00 2001 From: DingusMcRinkyDinky <127614779+DingusMcRinkyDinky@users.noreply.github.com> Date: Tue, 1 Dec 2026 10:30:55 +0100 Subject: [PATCH 31/61] Edit menu: Puppet Warp, Perspective Warp and Content-Aware Scale are greyed with several layers selected (#18501) With two or more layers at the top of the stack selected, the three items are greyed in the Edit menu and in ui.menu.list, and invoking them anyway (a shortcut, ui.menu.invoke) is refused before any session opens. One pixel layer keeps all three; a group among the selection, layers inside a group and linked layers (not measured) keep today's state. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EZbgszHyuEuWAzxaamteuU --- crates/ui-egui/src/menus/enable_rules.rs | 32 ++++ crates/ui-egui/src/menus/invoke.rs | 4 + .../several_layers_distort_greyed_tests.rs | 156 ++++++++++++++++++ 3 files changed, 192 insertions(+) create mode 100644 crates/ui-egui/src/menus/several_layers_distort_greyed_tests.rs diff --git a/crates/ui-egui/src/menus/enable_rules.rs b/crates/ui-egui/src/menus/enable_rules.rs index 7bd46578ce7..85e3f1ad147 100644 --- a/crates/ui-egui/src/menus/enable_rules.rs +++ b/crates/ui-egui/src/menus/enable_rules.rs @@ -129,9 +129,37 @@ pub fn disabled_for_selection(doc: &Document, selected: &[LayerId], active: Opti !any } +/// Puppet Warp, Perspective Warp and Content-Aware Scale work on one layer: with two or more +/// layers selected the reference greys them (#18501). Measured on layers at the top of the stack; +/// a group among them, or layers inside a group, keep the engine's own rule. +const ONE_LAYER_DISTORTS: [&str; 3] = ["edit.puppetWarp", "edit.perspectiveWarp", "edit.contentAwareScale"]; + +fn several_layers_block(doc: &Document, selected: &[LayerId], id: &str) -> bool { + ONE_LAYER_DISTORTS.contains(&id) + && selected.len() > 1 + && selected.iter().all(|l| doc.layer(*l).is_some_and(|layer| !layer.is_group()) && doc.layers.index().parent(*l).is_none()) +} + +/// Why a menu item that [`disabled`] greys for the layer selection is refused when it is invoked +/// anyway (a shortcut, the control channel's `ui.menu.invoke`), before any session opens. +pub fn refusal(app: &crate::PhotocraftApp, id: &str) -> Option { + let st = app.session.active()?; + several_layers_block(&st.doc, st.selected_layers(), id).then(|| { + let name = match id { + "edit.puppetWarp" => "Puppet Warp", + "edit.perspectiveWarp" => "Perspective Warp", + _ => "Content-Aware Scale", + }; + format!("{name} works on one layer at a time: select a single layer") + }) +} + pub fn disabled(app: &crate::PhotocraftApp, id: &str) -> bool { let Some(st) = app.session.active() else { return false }; let active = st.active_layer.and_then(|a| st.doc.layer(a)); + if several_layers_block(&st.doc, st.selected_layers(), id) { + return true; + } // The split warps edit the open Warp box's grid: with none they are greyed, also on a smart // object with a stored warp, as the reference greys them there (#12494, #12942). if matches!( @@ -521,3 +549,7 @@ mod tests { #[cfg(test)] #[path = "warp_split_enable_tests.rs"] mod warp_split_enable_tests; + +#[cfg(test)] +#[path = "several_layers_distort_greyed_tests.rs"] +mod several_layers_distort_greyed_tests; diff --git a/crates/ui-egui/src/menus/invoke.rs b/crates/ui-egui/src/menus/invoke.rs index 35fbabcd8a6..85e70735659 100644 --- a/crates/ui-egui/src/menus/invoke.rs +++ b/crates/ui-egui/src/menus/invoke.rs @@ -86,6 +86,10 @@ pub fn invoke(app: &mut PhotocraftApp, ctx: &egui::Context, id: &str, params: Va if !keeps_box_drag(id) { crate::type_box_preview::end_drag(app); } + // An item the menu greys for the layer selection opens nothing when invoked anyway (#18501). + if let Some(why) = crate::enable_rules::refusal(app, id) { + return Err(why); + } if crate::discard_ui::intercept(app, id, ¶ms) { return Ok(Value::Null); } diff --git a/crates/ui-egui/src/menus/several_layers_distort_greyed_tests.rs b/crates/ui-egui/src/menus/several_layers_distort_greyed_tests.rs new file mode 100644 index 00000000000..a44a4f67d47 --- /dev/null +++ b/crates/ui-egui/src/menus/several_layers_distort_greyed_tests.rs @@ -0,0 +1,156 @@ +//! Puppet Warp, Perspective Warp and Content-Aware Scale with several layers selected (#18501): +//! greyed in the Edit menu and in `ui.menu.list`, refused when invoked anyway (no session opens, +//! nothing changes); one pixel layer keeps all three, and the cases not measured keep today's state. + +use photocraft_doc::LayerId; +use serde_json::{Value, json}; + +use crate::PhotocraftApp; +use crate::control::{ControlRequest, Reply}; + +const THREE: [&str; 3] = ["edit.puppetWarp", "edit.perspectiveWarp", "edit.contentAwareScale"]; + +fn layer_of(v: Value) -> LayerId { + LayerId(v["layer"].as_u64().unwrap()) +} + +/// A 100 × 100 white document with a new pixel layer holding a block of colour, active. +fn painted_layer(app: &mut PhotocraftApp, name: &str, x: i64, color: &str) -> LayerId { + let layer = layer_of(app.run("layer.new.layer", json!({ "name": name })).unwrap()); + app.run("select.rect", json!({"x": x, "y": 10, "width": 30, "height": 30})).unwrap(); + app.run("edit.fill", json!({"contents": "color", "color": color})).unwrap(); + app.run("select.deselect", json!({})).unwrap(); + layer +} + +fn app_with_two_layers() -> (Box, LayerId, LayerId) { + let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default()); + app.run("file.new", json!({"width": 100, "height": 100, "background": "white"})).unwrap(); + app.sync_views(); + let a = painted_layer(&mut app, "A", 10, "#ff0000"); + let b = painted_layer(&mut app, "B", 50, "#0000ff"); + (app, a, b) +} + +/// The Edit menu row's state as the menu builds it. +fn in_menu(app: &PhotocraftApp, id: &str) -> bool { + let rows = crate::menus::menu_rows(app); + let row = crate::menus::items::row(&rows, id).map(|r| (r.path.clone(), r.enabled)); + let (path, enabled) = row.unwrap_or_else(|| panic!("{id} is in the menu")); + assert_eq!(path.first().map(String::as_str), Some("Edit"), "{id}"); + enabled +} + +fn control(app: &mut PhotocraftApp, method: &str, params: Value) -> Result { + let ctx = app.ctx().clone(); + let (request, _reply) = ControlRequest::new(method, params); + match crate::control::handle(app, &ctx, &request) { + Reply::Done(reply) if reply["ok"] == true => Ok(reply), + Reply::Done(reply) => Err(reply["error"].as_str().unwrap_or_default().to_owned()), + _ => panic!("expected an immediate reply to {method}"), + } +} + +/// `enabled` of `id` in `ui.menu.list`. +fn listed(app: &mut PhotocraftApp, id: &str) -> bool { + let list = control(app, "ui.menu.list", json!({})).unwrap(); + let row = list["result"].as_array().unwrap().iter().find(|row| row["id"] == id).cloned(); + row.unwrap_or_else(|| panic!("{id} is listed"))["enabled"].as_bool().unwrap() +} + +fn no_session(app: &PhotocraftApp) -> bool { + app.distort.puppet.is_none() && app.distort.perspective.is_none() && app.ui.transform.is_none() +} + +fn history_len(app: &PhotocraftApp) -> usize { + app.session.active().unwrap().history.entries().len() +} + +#[test] +fn two_selected_pixel_layers_grey_the_three_and_invoking_them_opens_nothing() { + let (mut app, a, b) = app_with_two_layers(); + app.run("layer.select", json!({"layers": [a.0, b.0]})).unwrap(); + assert_eq!(app.session.active().unwrap().selected_layers().len(), 2); + for id in THREE { + assert!(!in_menu(&app, id), "{id} is greyed in the Edit menu with two layers selected"); + assert!(!listed(&mut app, id), "{id} is disabled in ui.menu.list with two layers selected"); + } + let steps = history_len(&app); + for id in THREE { + let refused = control(&mut app, "ui.menu.invoke", json!({ "id": id })); + let why = refused.expect_err(&format!("{id} is refused with two layers selected")); + assert!(why.contains("one layer at a time"), "{id}: {why}"); + assert!(no_session(&app), "{id} opened a session"); + let ctx = app.ctx().clone(); + assert!(crate::menus::invoke(&mut app, &ctx, id, json!({})).is_err(), "{id} through the menu's own invoke"); + assert!(no_session(&app), "{id} opened a session"); + } + assert_eq!(history_len(&app), steps, "nothing changed"); + assert_eq!(app.session.active().unwrap().selected_layers(), [a, b], "the selection stays"); +} + +#[test] +fn free_transform_and_edit_transform_stay_enabled_with_two_layers() { + let (mut app, a, b) = app_with_two_layers(); + app.run("layer.select", json!({"layers": [a.0, b.0]})).unwrap(); + for id in [ + "edit.freeTransform", + "edit.transform.scale", + "edit.transform.rotate", + "edit.transform.skew", + "edit.transform.distort", + "edit.transform.perspective", + "edit.transform.rotate180", + "edit.transform.rotate90Cw", + "edit.transform.rotate90Ccw", + "edit.transform.flipHorizontal", + "edit.transform.flipVertical", + ] { + assert!(in_menu(&app, id), "{id} stays enabled with two layers selected"); + } +} + +#[test] +fn one_pixel_layer_keeps_all_three() { + let (mut app, _, b) = app_with_two_layers(); + app.run("layer.select", json!({"layer": b.0})).unwrap(); + for id in THREE { + assert!(in_menu(&app, id), "{id} is enabled for one pixel layer"); + assert!(listed(&mut app, id), "{id} is listed enabled for one pixel layer"); + } + control(&mut app, "ui.menu.invoke", json!({"id": "edit.puppetWarp"})).expect("Puppet Warp opens on one layer"); + assert!(app.distort.puppet.is_some(), "the pin mesh is open"); +} + +#[test] +fn the_cases_not_measured_keep_todays_state() { + // Two layers inside a group. + let (mut app, a, b) = app_with_two_layers(); + app.run("layer.select", json!({"layers": [a.0, b.0]})).unwrap(); + app.run("layer.groupLayers", json!({})).unwrap(); + app.run("layer.select", json!({"layers": [a.0, b.0]})).unwrap(); + assert_eq!(app.session.active().unwrap().selected_layers().len(), 2); + for id in THREE { + assert!(in_menu(&app, id), "{id}: two layers inside a group keep today's state"); + } + + // A group and a layer, the layer active. + let (mut app, a, b) = app_with_two_layers(); + app.run("layer.select", json!({"layer": a.0})).unwrap(); + let group = layer_of(app.run("layer.groupLayers", json!({})).unwrap()); + app.run("layer.select", json!({"layers": [group.0, b.0]})).unwrap(); + app.run("layer.select", json!({"layer": b.0, "mode": "add"})).unwrap(); + assert_eq!(app.session.active().unwrap().active_layer, Some(b)); + for id in THREE { + assert!(in_menu(&app, id), "{id}: a group and a layer keep today's state"); + } + + // A linked layer: one layer selected, its partner not. + let (mut app, a, b) = app_with_two_layers(); + app.run("layer.select", json!({"layers": [a.0, b.0]})).unwrap(); + app.run("layer.linkLayers", json!({})).unwrap(); + app.run("layer.select", json!({"layer": b.0})).unwrap(); + for id in THREE { + assert!(in_menu(&app, id), "{id}: a linked layer keeps today's state"); + } +} From c06f404773bd4bebbd22be7dd8d36135e102ef9c Mon Sep 17 00:00:00 2001 From: ruchirguitar Date: Tue, 1 Dec 2026 16:32:29 +0530 Subject: [PATCH 32/61] ui-egui: keep an axis change at the caret over the chosen font's saved axes rebase put the chosen font's saved variations back after every change, so an axis change at the caret reverted. Axes the change sets now win; the others keep their chosen values. --- .../ui-egui/src/tools/type_tool/defaults.rs | 2 +- .../src/tools/type_tool/font_commit_tests.rs | 26 +++++++++++++++++++ .../src/tools/type_tool/insertion_style.rs | 12 ++++++++- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/tools/type_tool/defaults.rs b/crates/ui-egui/src/tools/type_tool/defaults.rs index 0c62fbd6698..b5e483fb240 100644 --- a/crates/ui-egui/src/tools/type_tool/defaults.rs +++ b/crates/ui-egui/src/tools/type_tool/defaults.rs @@ -248,7 +248,7 @@ pub(super) fn apply(app: &mut PhotocraftApp, props: serde_json::Value, coalesce: if app.run("type.setStyle", p).is_ok() && let Some(kept) = kept { - insertion_style::rebase(app, kept); + insertion_style::rebase(app, kept, &props); } } diff --git a/crates/ui-egui/src/tools/type_tool/font_commit_tests.rs b/crates/ui-egui/src/tools/type_tool/font_commit_tests.rs index 7451cf30acf..81fa78c3711 100644 --- a/crates/ui-egui/src/tools/type_tool/font_commit_tests.rs +++ b/crates/ui-egui/src/tools/type_tool/font_commit_tests.rs @@ -408,3 +408,29 @@ fn a_digits_change_at_the_caret_keeps_the_chosen_typing_font() { }); assert_eq!(digits, Some(photocraft_doc::text::Digits::Devanagari), "the typed digit takes the picked digit style"); } + +/// An axis change at the caret after a font was chosen there wins over the chosen font's saved axes; the axes it does +/// not set keep their chosen values. +#[test] +fn an_axis_change_at_the_caret_keeps_its_value_with_the_chosen_typing_font() { + let (mut h, id) = fixture(0, "abcdef"); + h.state_mut().run("type.setStyle", json!({"layer": id.0, "variations": {"wght": 650, "wdth": 95}})).unwrap(); + select(&mut h, [3, 3]); + h.run(); + choose(&mut h, FONTS[1], "enter"); + super::apply(h.state_mut(), json!({"variations": {"wdth": 110}}), None); + super::host::type_text(h.state_mut(), "X"); + h.run(); + assert_eq!(families(&saved(&h, id))[3], FONTS[1], "the typed letter takes the chosen font"); + let mut offset = 0; + let axes = layer(&h.state().session.active().unwrap().doc, id) + .char_runs() + .into_iter() + .find_map(|r| { + offset += r.len; + (offset > 3).then_some(r.style.variations) + }) + .unwrap(); + assert!(axes.iter().any(|v| v.axis == "wdth" && v.value == 110.0), "the changed axis holds: {axes:?}"); + assert!(axes.iter().any(|v| v.axis == "wght" && v.value == 650.0), "an axis the change left keeps its value: {axes:?}"); +} diff --git a/crates/ui-egui/src/tools/type_tool/insertion_style.rs b/crates/ui-egui/src/tools/type_tool/insertion_style.rs index a8c33c2e2b0..aa6e023bd0b 100644 --- a/crates/ui-egui/src/tools/type_tool/insertion_style.rs +++ b/crates/ui-egui/src/tools/type_tool/insertion_style.rs @@ -52,7 +52,7 @@ pub(super) fn set_font(app: &mut PhotocraftApp, props: &serde_json::Value) -> bo /// Keeps the caret's pending font `kept` after another character change at the same caret: the style the command /// stored there (in the layer's own units) with the chosen font on it, for the new revision, so the next typed text /// still takes the chosen font and the change. -pub(super) fn rebase(app: &mut PhotocraftApp, mut kept: TypeInsertionStyle) { +pub(super) fn rebase(app: &mut PhotocraftApp, mut kept: TypeInsertionStyle, props: &serde_json::Value) { let Some((mut style, _)) = styles_at(app) else { return }; let Some(st) = app.session.active() else { return }; let chosen = &kept.style; @@ -61,6 +61,16 @@ pub(super) fn rebase(app: &mut PhotocraftApp, mut kept: TypeInsertionStyle) { style.italic = chosen.italic; style.postscript_name.clone_from(&chosen.postscript_name); style.variations.clone_from(&chosen.variations); + // An axis the change set itself wins over the chosen font's saved value; the others stay as chosen. + if let Some(axes) = props.get("variations").and_then(serde_json::Value::as_object) { + for (axis, value) in axes { + let Some(value) = value.as_f64() else { continue }; + match style.variations.iter_mut().find(|v| v.axis == *axis) { + Some(v) => v.value = value as f32, + None => style.variations.push(photocraft_doc::text::FontVariation { axis: axis.clone(), value: value as f32 }), + } + } + } kept.style = style; kept.revision = st.revision; app.ui.type_insertion_style = Some(kept); From e15b2c4ee1b56680cca98a01d74416300289d7a8 Mon Sep 17 00:00:00 2001 From: DingusMcRinkyDinky <127614779+DingusMcRinkyDinky@users.noreply.github.com> Date: Tue, 1 Dec 2026 14:55:48 +0100 Subject: [PATCH 33/61] Puppet Warp and Perspective Warp: an open session still commits and cancels with several layers selected (#18501) The several-layers refusal now applies only to opening a session. A control call ({"ui": ...}) for a Puppet Warp or Perspective Warp that is already open reaches its controls, so commit, cancel and edits work whatever is selected since; with no session open such a call is still refused. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EZbgszHyuEuWAzxaamteuU --- crates/ui-egui/src/menus/enable_rules.rs | 14 +++++++++-- crates/ui-egui/src/menus/invoke.rs | 2 +- .../several_layers_distort_greyed_tests.rs | 25 +++++++++++++++++++ 3 files changed, 38 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/menus/enable_rules.rs b/crates/ui-egui/src/menus/enable_rules.rs index 85e3f1ad147..30b4203b467 100644 --- a/crates/ui-egui/src/menus/enable_rules.rs +++ b/crates/ui-egui/src/menus/enable_rules.rs @@ -141,8 +141,18 @@ fn several_layers_block(doc: &Document, selected: &[LayerId], id: &str) -> bool } /// Why a menu item that [`disabled`] greys for the layer selection is refused when it is invoked -/// anyway (a shortcut, the control channel's `ui.menu.invoke`), before any session opens. -pub fn refusal(app: &crate::PhotocraftApp, id: &str) -> Option { +/// anyway (a shortcut, the control channel's `ui.menu.invoke`), before any session opens. A +/// control call (`{"ui": …}`) for a Puppet Warp or Perspective Warp already open is not refused: it +/// commits, cancels or edits that session, opened on one layer, whatever is selected since. +pub fn refusal(app: &crate::PhotocraftApp, id: &str, params: &serde_json::Value) -> Option { + let open = match id { + "edit.puppetWarp" => app.distort.puppet.is_some(), + "edit.perspectiveWarp" => app.distort.perspective.is_some(), + _ => false, + }; + if open && params.get("ui").is_some() { + return None; + } let st = app.session.active()?; several_layers_block(&st.doc, st.selected_layers(), id).then(|| { let name = match id { diff --git a/crates/ui-egui/src/menus/invoke.rs b/crates/ui-egui/src/menus/invoke.rs index 85e70735659..4fabc924b3f 100644 --- a/crates/ui-egui/src/menus/invoke.rs +++ b/crates/ui-egui/src/menus/invoke.rs @@ -87,7 +87,7 @@ pub fn invoke(app: &mut PhotocraftApp, ctx: &egui::Context, id: &str, params: Va crate::type_box_preview::end_drag(app); } // An item the menu greys for the layer selection opens nothing when invoked anyway (#18501). - if let Some(why) = crate::enable_rules::refusal(app, id) { + if let Some(why) = crate::enable_rules::refusal(app, id, ¶ms) { return Err(why); } if crate::discard_ui::intercept(app, id, ¶ms) { diff --git a/crates/ui-egui/src/menus/several_layers_distort_greyed_tests.rs b/crates/ui-egui/src/menus/several_layers_distort_greyed_tests.rs index a44a4f67d47..c04e0efe735 100644 --- a/crates/ui-egui/src/menus/several_layers_distort_greyed_tests.rs +++ b/crates/ui-egui/src/menus/several_layers_distort_greyed_tests.rs @@ -154,3 +154,28 @@ fn the_cases_not_measured_keep_todays_state() { assert!(in_menu(&app, id), "{id}: a linked layer keeps today's state"); } } + +/// A Puppet Warp or Perspective Warp opened on one layer still takes its control calls (commit, cancel) when two +/// layers are selected afterwards: the refusal is for opening a new session only. +#[test] +fn an_open_warp_still_commits_and_cancels_with_two_layers_selected() { + for (id, how) in [("edit.puppetWarp", "commit"), ("edit.puppetWarp", "cancel"), ("edit.perspectiveWarp", "commit"), ("edit.perspectiveWarp", "cancel")] { + let (mut app, a, b) = app_with_two_layers(); + app.run("layer.select", json!({"layer": b.0})).unwrap(); + control(&mut app, "ui.menu.invoke", json!({ "id": id })).unwrap_or_else(|e| panic!("{id} opens on one layer: {e}")); + assert!(!no_session(&app), "{id}: a session is open"); + app.run("layer.select", json!({"layers": [a.0, b.0]})).unwrap(); + assert_eq!(app.session.active().unwrap().selected_layers().len(), 2); + let reply = control(&mut app, "ui.menu.invoke", json!({ "id": id, "params": { "ui": { how: true } } })); + reply.unwrap_or_else(|e| panic!("{id} {how} with two layers selected: {e}")); + assert!(no_session(&app), "{id}: {how} closes the session"); + } + // Opening a new session with two layers selected is still refused, also with control params. + let (mut app, a, b) = app_with_two_layers(); + app.run("layer.select", json!({"layers": [a.0, b.0]})).unwrap(); + for id in ["edit.puppetWarp", "edit.perspectiveWarp"] { + let refused = control(&mut app, "ui.menu.invoke", json!({ "id": id, "params": { "ui": { "commit": true } } })); + assert!(refused.is_err_and(|why| why.contains("one layer at a time")), "{id}: no session, so it is refused"); + assert!(no_session(&app), "{id} opened a session"); + } +} From 573984f5ed95e9e6d2d56526ad61a24b7bd38cae Mon Sep 17 00:00:00 2001 From: bflatastic Date: Tue, 1 Dec 2026 21:15:55 +0700 Subject: [PATCH 34/61] ui-egui: keep paragraph_values' doc comment on it --- crates/ui-egui/src/panels/type_panels_ui/style_options.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ui-egui/src/panels/type_panels_ui/style_options.rs b/crates/ui-egui/src/panels/type_panels_ui/style_options.rs index c69fdf91fc7..538be23058c 100644 --- a/crates/ui-egui/src/panels/type_panels_ui/style_options.rs +++ b/crates/ui-egui/src/panels/type_panels_ui/style_options.rs @@ -161,7 +161,6 @@ pub(crate) fn character_values(style: &CharStyle) -> CharacterValues { values } -/// The values the Paragraph controls show for `style`. /// The engine's `digits` name of a digit style. pub(crate) fn digit_name(d: Digits) -> &'static str { match d { @@ -180,6 +179,7 @@ pub(crate) fn digit_name(d: Digits) -> &'static str { } } +/// The values the Paragraph controls show for `style`. pub(crate) fn paragraph_values(style: &ParagraphStyle) -> ParagraphValues { use photocraft_doc::text::TextDirection as D; let mut values = ParagraphValues::default(); From 17adbc6e3cb0ba3e8ac41db77ff29f385e8775de Mon Sep 17 00:00:00 2001 From: ruchirguitar Date: Tue, 1 Dec 2026 21:38:02 +0530 Subject: [PATCH 35/61] Move the craft-libs pin past craft-libs#4514 Picks up the Script select in the font picker's Toolbar layout. --- Cargo.lock | 224 +++++++++++++++++++--------------- Cargo.toml | 84 ++++++------- crates/engine-core/Cargo.toml | 2 +- crates/ipp/Cargo.toml | 2 +- 4 files changed, 171 insertions(+), 141 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d002ee7975c..3274fbe898b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -768,6 +768,17 @@ dependencies = [ "brotli-decompressor 5.0.3", ] +[[package]] +name = "brotli" +version = "9.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9071f285ed78f04f37d675abaaef5de7689e2f30a216c8dc6795465d81910a13" +dependencies = [ + "alloc-no-stdlib 3.0.0", + "alloc-stdlib 0.3.0", + "brotli-decompressor 6.3.2", +] + [[package]] name = "brotli-decompressor" version = "5.0.3" @@ -1365,7 +1376,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-automation", "craft-behavior", @@ -1406,7 +1417,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "crc32fast", "flate2", @@ -1427,18 +1438,19 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "block2 0.6.2", "objc2 0.6.5", "objc2-app-kit 0.3.2", + "objc2-core-graphics", "objc2-foundation 0.3.2", ] [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "rustix 1.1.6", ] @@ -1446,7 +1458,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1471,7 +1483,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1489,7 +1501,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-docpath", @@ -1507,7 +1519,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "egui", ] @@ -1515,7 +1527,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "md-5", "rayon", @@ -1524,12 +1536,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" [[package]] name = "craft-color" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "serde", ] @@ -1537,7 +1549,7 @@ dependencies = [ [[package]] name = "craft-color-transform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-cms", "craft-color", @@ -1547,10 +1559,11 @@ dependencies = [ [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-cms", + "craft-drawingml", "craft-host", "craft-i18n", "craft-keymap", @@ -1567,7 +1580,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-ai-agents", "craft-atomic", @@ -1583,7 +1596,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1593,7 +1606,7 @@ dependencies = [ [[package]] name = "craft-crs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-metadata", "craft-xml", @@ -1603,7 +1616,7 @@ dependencies = [ [[package]] name = "craft-crw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "thiserror 2.0.21", ] @@ -1611,7 +1624,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "rayon", ] @@ -1619,7 +1632,7 @@ dependencies = [ [[package]] name = "craft-develop" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-color", "craft-color-transform", @@ -1634,7 +1647,7 @@ dependencies = [ [[package]] name = "craft-develop-model" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-geom", "craft-metadata", @@ -1646,7 +1659,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1672,7 +1685,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "serde", ] @@ -1680,7 +1693,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1696,15 +1709,27 @@ dependencies = [ "serde_json", ] +[[package]] +name = "craft-drawingml" +version = "0.1.0" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" +dependencies = [ + "chrono", + "craft-xml", + "kurbo 0.13.1", + "log", + "serde", +] + [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" [[package]] name = "craft-file-formats" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-eps", "craft-idml", @@ -1722,7 +1747,7 @@ dependencies = [ [[package]] name = "craft-flags" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-atomic", "dirs", @@ -1732,7 +1757,7 @@ dependencies = [ [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1747,7 +1772,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1767,7 +1792,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1776,7 +1801,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "cap-primitives", "craft-atomic", @@ -1799,12 +1824,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" [[package]] name = "craft-geom" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "serde", ] @@ -1812,7 +1837,7 @@ dependencies = [ [[package]] name = "craft-heif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "heic-rs", "rayon", @@ -1821,7 +1846,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1834,8 +1859,10 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ + "brotli 9.1.3", + "brotli-decompressor 6.3.2", "chrono", "fixed_decimal", "icu_calendar", @@ -1862,7 +1889,7 @@ dependencies = [ [[package]] name = "craft-idml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-xml", "craft-zip", @@ -1872,7 +1899,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-dds", "craft-heif", @@ -1900,7 +1927,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1918,12 +1945,12 @@ dependencies = [ [[package]] name = "craft-ipp" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "thiserror 2.0.21", ] @@ -1931,7 +1958,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-host", "craft-i18n", @@ -1946,7 +1973,7 @@ dependencies = [ [[package]] name = "craft-kra" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-xml", "craft-zip", @@ -1956,7 +1983,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-i18n", @@ -1970,7 +1997,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-host", @@ -1988,7 +2015,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -2000,7 +2027,7 @@ dependencies = [ [[package]] name = "craft-nightly" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "uds_windows", "winsafe", @@ -2009,7 +2036,7 @@ dependencies = [ [[package]] name = "craft-ora" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-xml", "craft-zip", @@ -2019,7 +2046,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-keymap", @@ -2035,7 +2062,7 @@ dependencies = [ [[package]] name = "craft-pcraft-bundle" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "blake3", "craft-atomic", @@ -2048,7 +2075,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "flate2", "serde", @@ -2059,7 +2086,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "bytemuck", "flate2", @@ -2074,7 +2101,7 @@ dependencies = [ [[package]] name = "craft-pdn" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "flate2", "thiserror 2.0.21", @@ -2083,12 +2110,12 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "async-channel", "async-io", "async-process", - "core-graphics2", + "craft-appkit", "craft-atomic", "craft-docpath", "craft-host", @@ -2098,6 +2125,8 @@ dependencies = [ "js-sys", "log", "objc2-app-kit 0.3.2", + "objc2-core-foundation", + "objc2-core-graphics", "rfd", "serde", "serde_json", @@ -2114,7 +2143,7 @@ dependencies = [ [[package]] name = "craft-plist" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "thiserror 2.0.21", ] @@ -2122,7 +2151,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-host", @@ -2146,7 +2175,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "encoding_rs", "flate2", @@ -2157,7 +2186,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "dispatch2", "egui", @@ -2170,7 +2199,7 @@ dependencies = [ [[package]] name = "craft-raw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "chrono", "craft-crw", @@ -2188,7 +2217,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -2207,7 +2236,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-atomic", "craft-host", @@ -2224,7 +2253,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2245,7 +2274,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-keymap", @@ -2257,7 +2286,7 @@ dependencies = [ [[package]] name = "craft-testkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "rustix 1.1.6", "tempfile", @@ -2267,7 +2296,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2290,7 +2319,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2305,7 +2334,7 @@ dependencies = [ [[package]] name = "craft-theme-editor" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-theme", @@ -2316,7 +2345,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-atomic", "craft-behavior", @@ -2331,7 +2360,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "serde", "thiserror 2.0.21", @@ -2341,7 +2370,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "serde", "thiserror 2.0.21", @@ -2350,7 +2379,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-keymap", @@ -2365,7 +2394,7 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "serde", ] @@ -2373,7 +2402,7 @@ dependencies = [ [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2387,9 +2416,10 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", + "craft-font-catalog", "craft-i18n", "craft-keymap", "craft-theme", @@ -2403,7 +2433,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "accesskit", "craft-behavior", @@ -2445,7 +2475,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2456,7 +2486,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-host", @@ -2474,7 +2504,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-host", @@ -2495,7 +2525,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-host", @@ -2515,7 +2545,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-host", @@ -2534,7 +2564,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "base64 0.22.1", "chrono", @@ -2566,7 +2596,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "winsafe", ] @@ -2574,7 +2604,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-appkit", "craft-atomic", @@ -2606,7 +2636,7 @@ dependencies = [ [[package]] name = "craft-xcf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "flate2", "thiserror 2.0.21", @@ -2615,7 +2645,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "quick-xml 0.41.0", "serde", @@ -2625,7 +2655,7 @@ dependencies = [ [[package]] name = "craft-zip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "flate2", "thiserror 2.0.21", @@ -4145,7 +4175,7 @@ dependencies = [ [[package]] name = "hayro" version = "0.7.1" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "bytemuck", "hayro-interpret", @@ -4168,14 +4198,14 @@ version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a14afde3344be69225fec4f6f44f6a219a3a492f9d8301eb25ef608fe4b7014c" dependencies = [ - "brotli", + "brotli 8.0.4", "hayro-postscript", ] [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -4193,7 +4223,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -4217,7 +4247,7 @@ checksum = "bc2d80da85f31c3fdc0366431f44cfd645a9da1e242ed1f4a61f213d9765660f" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "flate2", "hayro-ccitt", @@ -5310,7 +5340,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "arrayvec", "kurbo 0.13.1", @@ -9821,7 +9851,7 @@ dependencies = [ [[package]] name = "vello_common" version = "0.0.8" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "bytemuck", "fearless_simd", @@ -9869,7 +9899,7 @@ dependencies = [ [[package]] name = "vello_cpu" version = "0.0.8" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "bytemuck", "glifo 0.1.1", @@ -11515,14 +11545,14 @@ source = "git+https://github.com/storytold/egui.git?rev=14c39fed181756be6f357c28 [[patch.unused]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" [[patch.unused]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" [[patch.unused]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa#f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" diff --git a/Cargo.toml b/Cargo.toml index 8a8adec3087..30193c16908 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,21 +12,21 @@ rust-version = "1.95" [workspace.dependencies] # The craft framework through its facade (`craft::ui::…`). The egui `[patch]` below must match # `craft::egui_fork::REV` (checked by `cargo xtask ci`). -craft = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa", default-features = false } -craft-tracked = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -craft-ui-macros = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3", default-features = false } +craft-tracked = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-ui-macros = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } # internal photocraft-geom = { path = "crates/geom" } photocraft-color = { path = "crates/color" } photocraft-raster = { path = "crates/raster" } photocraft-doc = { path = "crates/doc" } photocraft-ops = { path = "crates/ops" } -craft-plist = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -photocraft-codecs = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -photocraft-formats = { package = "craft-file-formats", git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa", features = ["raster-codecs", "pdf", "svg", "ora", "kra", "xcf", "pdn", "raw", "psd", "affinity", "pcraft"] } +craft-plist = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +photocraft-codecs = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +photocraft-formats = { package = "craft-file-formats", git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3", features = ["raster-codecs", "pdf", "svg", "ora", "kra", "xcf", "pdn", "raw", "psd", "affinity", "pcraft"] } photocraft-raw = { path = "crates/raw" } -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } photocraft-compose = { path = "crates/compose" } photocraft-gpu = { path = "crates/gpu" } photocraft-paint = { path = "crates/paint" } @@ -48,38 +48,38 @@ photocraft-ipp = { path = "crates/ipp" } # external # ICC colour management: the shared crate (replaces crates/cms; craft-libs#779). -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -craft-print = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-print = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } # HEIC/HEIF: the shared decoder (replaces crates/heif; craft-libs#784). -craft-heif = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa", features = ["raster", "write-raster"] } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -craft-pcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -craft-pcraft-bundle = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -craft-zip = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -craft-ora = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -craft-kra = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -craft-xcf = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -craft-pdn = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } +craft-heif = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3", features = ["raster", "write-raster"] } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-pcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-pcraft-bundle = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-zip = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-ora = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-kra = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-xcf = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-pdn = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } # Keep the shared embedded-image validation API until the framework revision includes it. -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa", features = ["tree-render", "tree-render-system-fonts"] } -craft-raw = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3", features = ["tree-render", "tree-render-system-fonts"] } +craft-raw = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } # Camera-field EXIF reader/writer, shared prerequisite craft-libs#1563. -craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -craft-crs = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -craft-develop = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -craft-develop-model = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } +craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-crs = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-develop = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-develop-model = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } # Interface translations: lookup, fallback, CLDR plurals and language names over the craft-i18n # catalogs that `crates/ui-egui/build.rs` embeds from `CRAFT_I18N_DIR` (storytold/craft-i18n, at # the commit in `craft-i18n.rev`). Already in the tree through craft. -craft-i18n = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } +craft-i18n = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } # craft-update: app-specific pretend versions apply to startup and manual checks. -craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa", features = ["ui"] } +craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3", features = ["ui"] } # Self-contained nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } thiserror = "2" serde = { version = "1", features = ["derive", "rc"] } serde_json = "1" @@ -352,16 +352,16 @@ opt-level = 3 # Keep the complete egui family and native event bridge on reviewed fork commits. [patch.crates-io] -krilla = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -hayro = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -vello_common = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } -vello_cpu = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +hayro = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +vello_common = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +vello_cpu = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" } emath = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" } epaint = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" } diff --git a/crates/engine-core/Cargo.toml b/crates/engine-core/Cargo.toml index 41bb4f31eaf..25bfb4af0c7 100644 --- a/crates/engine-core/Cargo.toml +++ b/crates/engine-core/Cargo.toml @@ -19,7 +19,7 @@ photocraft-geom = { workspace = true } photocraft-color = { workspace = true } craft-cms = { workspace = true } # PCTIP codec from craft-libs#1564; kept at the same shared revision as the workspace. -craft-pcraft-tip = { package = "craft-pcraft-format", git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } +craft-pcraft-tip = { package = "craft-pcraft-format", git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } photocraft-raster = { workspace = true } photocraft-doc = { workspace = true } photocraft-ops = { workspace = true } diff --git a/crates/ipp/Cargo.toml b/crates/ipp/Cargo.toml index 23fc19a72fd..8c4df389b76 100644 --- a/crates/ipp/Cargo.toml +++ b/crates/ipp/Cargo.toml @@ -7,7 +7,7 @@ license.workspace = true rust-version.workspace = true [dependencies] -craft-ipp = { git = "https://github.com/storytold/craft-libs", rev = "f0f9bb38ff21cd1bf7fa68f08f9f0cc7f22983fa" } +craft-ipp = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } [lints] workspace = true From 60cd87cd8e64fd68386def1fc93b8abba51d7586 Mon Sep 17 00:00:00 2001 From: ruchirguitar Date: Tue, 1 Dec 2026 22:28:26 +0530 Subject: [PATCH 36/61] Keep main's other pins after the merge; craft-libs stays at fc3262f --- Cargo.lock | 32 ++++++++++++++++++-------------- Cargo.toml | 28 ++++++++++++++-------------- crates/engine-core/Cargo.toml | 10 ++++++---- 3 files changed, 38 insertions(+), 32 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3274fbe898b..271ff15964a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3072,7 +3072,7 @@ dependencies = [ [[package]] name = "ecolor" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=14c39fed181756be6f357c284354e0ab55b64443#14c39fed181756be6f357c284354e0ab55b64443" +source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" dependencies = [ "bytemuck", "emath", @@ -3106,7 +3106,7 @@ dependencies = [ [[package]] name = "eframe" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=14c39fed181756be6f357c284354e0ab55b64443#14c39fed181756be6f357c284354e0ab55b64443" +source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" dependencies = [ "ahash", "bytemuck", @@ -3143,7 +3143,7 @@ dependencies = [ [[package]] name = "egui" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=14c39fed181756be6f357c284354e0ab55b64443#14c39fed181756be6f357c284354e0ab55b64443" +source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" dependencies = [ "accesskit", "ahash", @@ -3164,7 +3164,7 @@ dependencies = [ [[package]] name = "egui-wgpu" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=14c39fed181756be6f357c284354e0ab55b64443#14c39fed181756be6f357c284354e0ab55b64443" +source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" dependencies = [ "ahash", "bytemuck", @@ -3183,7 +3183,7 @@ dependencies = [ [[package]] name = "egui-winit" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=14c39fed181756be6f357c284354e0ab55b64443#14c39fed181756be6f357c284354e0ab55b64443" +source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" dependencies = [ "accesskit_winit", "arboard", @@ -3209,7 +3209,7 @@ dependencies = [ [[package]] name = "egui_extras" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=14c39fed181756be6f357c284354e0ab55b64443#14c39fed181756be6f357c284354e0ab55b64443" +source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" dependencies = [ "ahash", "egui", @@ -3223,7 +3223,7 @@ dependencies = [ [[package]] name = "egui_glow" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=14c39fed181756be6f357c284354e0ab55b64443#14c39fed181756be6f357c284354e0ab55b64443" +source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" dependencies = [ "bytemuck", "egui", @@ -3236,7 +3236,7 @@ dependencies = [ [[package]] name = "egui_kittest" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=14c39fed181756be6f357c284354e0ab55b64443#14c39fed181756be6f357c284354e0ab55b64443" +source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" dependencies = [ "dify", "eframe", @@ -3262,7 +3262,7 @@ checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" [[package]] name = "emath" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=14c39fed181756be6f357c284354e0ab55b64443#14c39fed181756be6f357c284354e0ab55b64443" +source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" dependencies = [ "bytemuck", "serde", @@ -3355,7 +3355,7 @@ dependencies = [ [[package]] name = "epaint" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=14c39fed181756be6f357c284354e0ab55b64443#14c39fed181756be6f357c284354e0ab55b64443" +source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" dependencies = [ "ahash", "bytemuck", @@ -3382,7 +3382,11 @@ dependencies = [ [[package]] name = "epaint_default_fonts" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=14c39fed181756be6f357c284354e0ab55b64443#14c39fed181756be6f357c284354e0ab55b64443" +source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" +dependencies = [ + "brotli 9.1.3", + "brotli-decompressor 6.3.2", +] [[package]] name = "equivalent" @@ -11530,17 +11534,17 @@ dependencies = [ [[patch.unused]] name = "egui_demo_lib" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=14c39fed181756be6f357c284354e0ab55b64443#14c39fed181756be6f357c284354e0ab55b64443" +source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" [[patch.unused]] name = "egui_inspection" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=14c39fed181756be6f357c284354e0ab55b64443#14c39fed181756be6f357c284354e0ab55b64443" +source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" [[patch.unused]] name = "egui_system_font_provider" version = "0.37.0" -source = "git+https://github.com/storytold/egui.git?rev=14c39fed181756be6f357c284354e0ab55b64443#14c39fed181756be6f357c284354e0ab55b64443" +source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387dd1f9649553f9321#07c20531f89717e461c0f387dd1f9649553f9321" [[patch.unused]] name = "hayro-cmap" diff --git a/Cargo.toml b/Cargo.toml index 30193c16908..c941befcf2b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -362,18 +362,18 @@ hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "fc3 linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } vello_common = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } vello_cpu = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } -ecolor = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" } -emath = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" } -epaint = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" } -epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" } -egui = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" } -egui-winit = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" } -egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" } -egui_glow = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" } -egui_extras = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" } -egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" } -egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" } -eframe = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" } -egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" } -egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "14c39fed181756be6f357c284354e0ab55b64443" } +ecolor = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } +emath = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } +epaint = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } +epaint_default_fonts = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } +egui = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } +egui-winit = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } +egui-wgpu = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } +egui_glow = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } +egui_extras = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } +egui_kittest = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } +egui_system_font_provider = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } +eframe = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } +egui_demo_lib = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } +egui_inspection = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } winit = { git = "https://github.com/storytold/winit.git", rev = "f8b490f135ea439dd31aae100bb5591c63cb076f" } diff --git a/crates/engine-core/Cargo.toml b/crates/engine-core/Cargo.toml index 25bfb4af0c7..be32b115541 100644 --- a/crates/engine-core/Cargo.toml +++ b/crates/engine-core/Cargo.toml @@ -28,7 +28,8 @@ serde = { workspace = true } serde_json = { workspace = true } thiserror = { workspace = true } rayon = { workspace = true } -chrono = { workspace = true } +# New-document XMP dates use the actual local clock on native and web. +chrono = { workspace = true, features = ["clock"] } web-time = { workspace = true } photocraft-paint = { workspace = true } photocraft-algo = { workspace = true } @@ -54,11 +55,12 @@ craft = { workspace = true, features = ["automation", "color-ui", "keymap", "pla # Release tags use the same semantic versions as Cargo. semver = "1" +# Chrono reads the browser clock and time-zone offset through its existing JS bindings. +[target.'cfg(target_arch = "wasm32")'.dependencies] +chrono = { workspace = true, features = ["wasmbind"] } + [target.'cfg(not(target_arch = "wasm32"))'.dependencies] tempfile = "3" -# `clock`: the local time that names History Options' snapshot on save (#2966); already in the -# tree through rmcp. The web build has no local clock here and names it "Snapshot N". -chrono = { workspace = true, features = ["clock"] } # `file_cmds::same_file` on Windows: the volume serial number and file index, so a hard link to a # file is that file (std's `MetadataExt::file_index` is unstable). From 788c0f2d1d273b96a02b2c58e18cba67adfc038e Mon Sep 17 00:00:00 2001 From: Dan Date: Tue, 1 Dec 2026 17:02:08 +0000 Subject: [PATCH 37/61] Restore the original PhotoCraft Black & White presets --- ATTRIBUTION.md | 1 + .../adjust_editors/black_white_presets.rs | 26 ++++++++--------- .../src/dialogs/adjust_editors/ui_tests.rs | 28 +++++++++---------- 3 files changed, 28 insertions(+), 27 deletions(-) diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index 40f765acb92..a1c20d52f68 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -25,6 +25,7 @@ next to them. | `assets/app-icon/photocraft-nightly.png`, `photocraft-nightly-1024.png`, `photocraft-nightly.ico`, `photocraft-nightly.icns` | PhotoCraft nightly deep-background derivatives | @skylartaylor | Original project-owned256 and padded1024 masters at the revision and hashes in [`nightly-provenance.json`](assets/app-icon/nightly-provenance.json); code-generated background-contribution change only, preserving foreground/alpha; no badge or crescent | MIT OR Apache-2.0, [`assets/app-icon/LICENSE.txt`](assets/app-icon/LICENSE.txt) | | `packaging/nightly-archive-tests.py` (runtime-generated temporary files) | Synthetic flat-archive inventory and exclusive-output fixtures; regular-file payloads, not real image/executable validity | @skylartaylor | Original test-generated strings/files and symlinks from the committed script; no external media or user documents | MIT OR Apache-2.0 | | `packaging/macos/dmg/` (all files) | PhotoCraft DMG window background and layout | @XusBadia, from the PhotoCraft app icon | Original work, see [`packaging/macos/dmg/README.md`](packaging/macos/dmg/README.md) | MIT OR Apache-2.0, like the code | +| `crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs` | Built-in Black & White tonal and filter mixes | PhotoCraft contributors (@Bobderto) | Original weights chosen to produce the named tonal and color-filter effects, from [PhotoCraft `2b1afe637`](https://github.com/storytold/photocraft/commit/2b1afe637cabe3eba622c8edd3e92b279aa8dfe4) | MIT OR Apache-2.0 | | `crates/ui-egui/src/theme.rs` (Solarized Dark palette) | Solarized colour scheme used by the Solarized Dark theme | Ethan Schoonover | | MIT, [`LICENSE-solarized.txt`](crates/ui-egui/src/LICENSE-solarized.txt) | | `crates/ui-egui/src/theme.rs` (Breeze Light and Breeze Dark themes) | The Breeze Light and Breeze Dark themes are original colour values on PhotoCraft's Studio layout, chosen to look close to KDE Plasma's Breeze (cool blue-greys, blue accent, 5 px frame radius) so the app blends into a Plasma desktop. None of Breeze's colour values, files or code are copied; the values are a few levels away from its schemes and tuned for text contrast | PhotoCraft contributors | Inspired by the look of KDE Breeze, (its colour schemes are LGPL-2.0-or-later) | Original work | | `crates/ui-egui/src/theme.rs` (Soft Dark and Soft Light themes) | Original colour values and radii for two low-contrast themes on PhotoCraft's Studio layout; no third-party palette, file or code is used | PhotoCraft contributors | Original | Original work | diff --git a/crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs b/crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs index f1673f2d693..0c999dd787c 100644 --- a/crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs +++ b/crates/ui-egui/src/dialogs/adjust_editors/black_white_presets.rs @@ -1,4 +1,4 @@ -//! Preset grayscale mixes for the Black & White adjustment. +//! Original Black & White recipes for tonal shifts and the effect of color filters. use std::sync::Arc; @@ -19,18 +19,18 @@ fn entries() -> [Entry>; 16] { [ Entry::new(Some(BlackWhite::DEFAULT_WEIGHTS), tl!("Default")), Entry::separator(), - Entry::new(Some([0.0, 0.0, 0.0, 110.0, 110.0, 110.0]), tl!("Blue Filter")), - Entry::new(Some([30.0, 50.0, 30.0, 50.0, 10.0, 70.0]), tl!("Darker")), - Entry::new(Some([50.0, 120.0, 90.0, 50.0, 0.0, 0.0]), tl!("Green Filter")), - Entry::new(Some([-50.0, -50.0, -50.0, 150.0, 150.0, 150.0]), tl!("High Contrast Blue Filter")), - Entry::new(Some([120.0, 120.0, -10.0, -50.0, -50.0, 120.0]), tl!("High Contrast Red Filter")), - Entry::new(Some([-40.0, 235.0, 144.0, -68.0, -3.0, -107.0]), tl!("Infrared")), - Entry::new(Some([50.0, 70.0, 50.0, 70.0, 30.0, 90.0]), tl!("Lighter")), - Entry::new(Some([0.0; 6]), tl!("Maximum Black")), - Entry::new(Some([100.0; 6]), tl!("Maximum White")), - Entry::new(Some([128.0, 128.0, 100.0, 100.0, 128.0, 100.0]), tl!("Neutral Density")), - Entry::new(Some([120.0, 110.0, -10.0, -50.0, 0.0, 120.0]), tl!("Red Filter")), - Entry::new(Some([120.0, 110.0, 40.0, -30.0, 0.0, 70.0]), tl!("Yellow Filter")), + Entry::new(Some([22.0, 38.0, 25.0, 36.0, 10.0, 50.0]), tl!("Darker")), + Entry::new(Some([60.0, 77.0, 64.0, 78.0, 47.0, 92.0]), tl!("Lighter")), + Entry::new(Some([8.0; 6]), tl!("Deep Shadows")), + Entry::new(Some([92.0; 6]), tl!("Bright Highlights")), + Entry::new(Some([48.0; 6]), tl!("Even Color Weights")), + Entry::new(Some([86.0, 65.0, 33.0, 23.0, 15.0, 72.0]), tl!("Red Filter")), + Entry::new(Some([64.0, 91.0, 64.0, 41.0, 13.0, 53.0]), tl!("Yellow Filter")), + Entry::new(Some([28.0, 67.0, 91.0, 74.0, 17.0, 45.0]), tl!("Green Filter")), + Entry::new(Some([24.0, 35.0, 45.0, 77.0, 92.0, 53.0]), tl!("Blue Filter")), + Entry::new(Some([100.0, 73.0, 24.0, 7.0, 5.0, 64.0]), tl!("Strong Red Filter")), + Entry::new(Some([4.0, 12.0, 27.0, 71.0, 100.0, 44.0]), tl!("Strong Blue Filter")), + Entry::new(Some([58.0, 89.0, 97.0, 38.0, 8.0, 33.0]), tl!("Infrared Foliage")), Entry::separator(), Entry::new(None, tl!("Custom")), ] diff --git a/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs b/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs index 06fb26c2847..87493748f58 100644 --- a/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs +++ b/crates/ui-egui/src/dialogs/adjust_editors/ui_tests.rs @@ -499,7 +499,7 @@ fn assert_black_white_preset(h: &Harness<'_, Box>, name: &str) { } #[test] -fn black_white_presets_apply_the_requested_weights_and_keep_tint() { +fn black_white_presets_apply_the_authored_weights_and_keep_tint() { let mut h = app_harness("blackWhite", "rgb", 8); // Leave enough vertical space for the complete dropdown to be visible at once. h.set_size(vec2(1440.0, 1350.0)); @@ -510,18 +510,18 @@ fn black_white_presets_apply_the_requested_weights_and_keep_tint() { let Adjustment::BlackWhite { tint: original_tint, .. } = &original else { panic!("{original:?}") }; for (name, expected) in [ - ("Blue Filter", [0.0, 0.0, 0.0, 110.0, 110.0, 110.0]), - ("Darker", [30.0, 50.0, 30.0, 50.0, 10.0, 70.0]), - ("Green Filter", [50.0, 120.0, 90.0, 50.0, 0.0, 0.0]), - ("High Contrast Blue Filter", [-50.0, -50.0, -50.0, 150.0, 150.0, 150.0]), - ("High Contrast Red Filter", [120.0, 120.0, -10.0, -50.0, -50.0, 120.0]), - ("Infrared", [-40.0, 235.0, 144.0, -68.0, -3.0, -107.0]), - ("Lighter", [50.0, 70.0, 50.0, 70.0, 30.0, 90.0]), - ("Maximum Black", [0.0; 6]), - ("Maximum White", [100.0; 6]), - ("Neutral Density", [128.0, 128.0, 100.0, 100.0, 128.0, 100.0]), - ("Red Filter", [120.0, 110.0, -10.0, -50.0, 0.0, 120.0]), - ("Yellow Filter", [120.0, 110.0, 40.0, -30.0, 0.0, 70.0]), + ("Darker", [22.0, 38.0, 25.0, 36.0, 10.0, 50.0]), + ("Lighter", [60.0, 77.0, 64.0, 78.0, 47.0, 92.0]), + ("Deep Shadows", [8.0; 6]), + ("Bright Highlights", [92.0; 6]), + ("Even Color Weights", [48.0; 6]), + ("Red Filter", [86.0, 65.0, 33.0, 23.0, 15.0, 72.0]), + ("Yellow Filter", [64.0, 91.0, 64.0, 41.0, 13.0, 53.0]), + ("Green Filter", [28.0, 67.0, 91.0, 74.0, 17.0, 45.0]), + ("Blue Filter", [24.0, 35.0, 45.0, 77.0, 92.0, 53.0]), + ("Strong Red Filter", [100.0, 73.0, 24.0, 7.0, 5.0, 64.0]), + ("Strong Blue Filter", [4.0, 12.0, 27.0, 71.0, 100.0, 44.0]), + ("Infrared Foliage", [58.0, 89.0, 97.0, 38.0, 8.0, 33.0]), ("Default", [40.0, 60.0, 40.0, 60.0, 20.0, 80.0]), ] { let history = history_len(&h); @@ -532,7 +532,7 @@ fn black_white_presets_apply_the_requested_weights_and_keep_tint() { let (_, applied) = layer(&h); let Adjustment::BlackWhite { weights, tint } = applied else { panic!("{applied:?}") }; - assert_eq!(weights, expected, "{name} applies the requested mix"); + assert_eq!(weights, expected, "{name} applies the authored mix"); assert_black_white_preset(&h, name); assert_eq!(&tint, original_tint, "{name} preserves Tint"); assert_eq!(history_len(&h), history + 1, "{name} is one history step"); From 76c64f19e60be07fe21160a26319e9ce3abefbc3 Mon Sep 17 00:00:00 2001 From: ruchirguitar Date: Tue, 1 Dec 2026 23:21:36 +0530 Subject: [PATCH 38/61] Filter the font menu by script, with the Indic scripts The font pickers offer Latin, the nine Indic scripts, East Asian, Japanese and Thai in the toolbar's Script select (craft-libs#4514). Scorecard row TYPE-10996-2. --- .../src/tools/type_tool/font_picker_tests.rs | 19 ++++++++++++++ crates/ui-egui/src/tools/type_tool/fonts.rs | 25 +++++++++++++++++-- docs/scorecard.md | 3 ++- scorecard/type.toml | 7 ++++++ 4 files changed, 51 insertions(+), 3 deletions(-) diff --git a/crates/ui-egui/src/tools/type_tool/font_picker_tests.rs b/crates/ui-egui/src/tools/type_tool/font_picker_tests.rs index 3cfabae49fb..c9e87099eef 100644 --- a/crates/ui-egui/src/tools/type_tool/font_picker_tests.rs +++ b/crates/ui-egui/src/tools/type_tool/font_picker_tests.rs @@ -233,3 +233,22 @@ fn hovering_a_font_adds_no_history_step_and_a_pick_adds_one() { assert_eq!(layer_font(h.state()), "JetBrains Mono"); assert_eq!(history_len(h.state()), before + 1, "the pick is one history step"); } + +/// The toolbar's Script select offers the Indic scripts (#10996); picking Devanagari narrows the family list and is +/// kept as the pickers' filter. +#[test] +fn the_family_list_filters_by_an_indic_script() { + let mut h = bar_harness(app_with_layer()); + h.run_steps(4); + assert_eq!(h.state().ui.font_filters.script, None, "no script filter at first"); + field(&h).click(); + h.run(); + let families = |h: &Harness<'static, Box>| h.query_all_by_role(Role::TreeItem).count(); + let before = families(&h); + h.get_by_role_and_label(Role::ComboBox, "Script").click(); + h.run(); + h.get_by_label("Devanagari").click(); + h.run(); + assert_eq!(h.state().ui.font_filters.script, Some(craft::font_manager::picker::FontScript::Devanagari)); + assert!(families(&h) < before, "the Latin-only families leave the list ({} of {before} left)", families(&h)); +} diff --git a/crates/ui-egui/src/tools/type_tool/fonts.rs b/crates/ui-egui/src/tools/type_tool/fonts.rs index 034d72a3f8d..db04c76ced3 100644 --- a/crates/ui-egui/src/tools/type_tool/fonts.rs +++ b/crates/ui-egui/src/tools/type_tool/fonts.rs @@ -1,4 +1,4 @@ -use craft::font_manager::picker::{FontFilters, FontPickerSettings, FontPreviewSize}; +use craft::font_manager::picker::{FontFilters, FontPickerSettings, FontPreviewSize, FontScript}; use craft::text::ui::character::FontPickerSource; use craft::ui::contract::Bind; use photocraft_engine::prefs::FontPreview; @@ -95,6 +95,23 @@ pub(super) fn preview_text(app: &PhotocraftApp) -> Option { (!line.is_empty()).then_some(line) } +/// The scripts the font pickers' script row offers: Latin, the Indic scripts, then the East Asian ones and Thai. +const PICKER_SCRIPTS: [FontScript; 13] = [ + FontScript::Latin, + FontScript::Devanagari, + FontScript::Bengali, + FontScript::Gurmukhi, + FontScript::Gujarati, + FontScript::Odia, + FontScript::Tamil, + FontScript::Telugu, + FontScript::Kannada, + FontScript::Malayalam, + FontScript::EastAsian, + FontScript::Japanese, + FontScript::Thai, +]; + /// The font picker's most recent families the settings may hold, whatever the preference says. const MAX_RECENT_FONTS: usize = 50; @@ -137,7 +154,11 @@ impl FontSourceState { /// The picker's source over this state. pub(crate) fn source(&mut self) -> FontPickerSource<'_> { let catalog = photocraft_text::fonts::catalog(); - let mut source = FontPickerSource::new(catalog).settings(Bind::bound(&mut self.settings)).filters(Bind::bound(&mut self.filters)).served(&self.served); + let mut source = FontPickerSource::new(catalog) + .settings(Bind::bound(&mut self.settings)) + .filters(Bind::bound(&mut self.filters)) + .served(&self.served) + .scripts(&PICKER_SCRIPTS); if let Some(text) = self.preview_text.as_deref() { source = source.preview_text(text); } diff --git a/docs/scorecard.md b/docs/scorecard.md index e984cf914e7..016cab7ceb7 100644 --- a/docs/scorecard.md +++ b/docs/scorecard.md @@ -10,7 +10,7 @@ Generated by `cargo xtask scorecard` from `perf/budgets.toml`, `perf/baseline.js | [File compatibility](#file-compatibility) | 11 | 14 | 2 | io corpus: oracle ≥ 148/170, round trip ≥ 169/170; psd-tools corpus: oracle ≥ 249/309, round trip ≥ 308/309; photoshop oracles: oracle ≥ 190/258, round trip ≥ 258/258 | | [Tools](#tools) | 36 | 9 | 0 | | | [Workspace and UI](#workspace-and-ui) | 15 | 6 | 2 | settings that do nothing: 9 of 204 (target 0) | -| [Type](#type) | 5 | 6 | 0 | | +| [Type](#type) | 6 | 6 | 0 | | | [Automation](#automation) | 6 | 4 | 2 | 663 of 663 menu items live (100.0%) | | [Reliability](#reliability) | 5 | 2 | 0 | never-crash lints on 28 of 28 crates; panic_hunt present | | [Distribution](#distribution) | 5 | 5 | 1 | | @@ -261,6 +261,7 @@ Unread: `general.color_picker`, `workspace.auto_show_hidden_panels`, `workspace. | TYPE-218-8 | Text editing: select all, double/triple/quadruple-click selection, paste, with tests | done | [#218](https://github.com/storytold/photocraft/issues/218) | Like Photoshop, 2 clicks select the word, 3 the laid-out line (a column in vertical type), 4 the paragraph up to the hard return, 5 all text, and the next quick click starts over (#3493; type_tool.rs next_click_count, click_selection, multi_click). Tested through real canvas clicks in point, paragraph and vertical type, with paste replacing the selection and Cmd+A selecting all (type_tool_tests.rs multi_click_selects_word_line_paragraph_and_all_in_point_text, multi_click_separates_wrapped_lines_from_paragraphs, click_counts_cycle_and_restart, click_selection_without_layout_and_on_hostile_input, multi_click_without_a_session_does_nothing) | | TYPE-218-9 | Distort/Perspective/Warp on live type as in Photoshop (was: offer 'Rasterize and continue?'; Photoshop doesn't prompt) | done | [#218](https://github.com/storytold/photocraft/issues/218) | Photoshop 2026 prompts for none of these: Edit › Transform › Warp on live type stays enabled with no rasterize prompt and offers only the warp styles (the mesh can't be dragged), so the type stays editable; Distort, Perspective and the split warps are greyed. PhotoCraft does the same: Warp on type commits the layer's Warp Text in one step (transform_tool.rs enter_type_warp, warp_cmds.rs warp_type_layer, #3004; warp_on_type_takes_a_style_and_keeps_the_type_editable), Distort/Perspective greyed (enable_rules.rs, #2701) | | TYPE-218-10 | Area type: Type tool click inside a closed path or shape wraps text inside it, holes and dents included, PSD round trip | partial | [#218](https://github.com/storytold/photocraft/issues/218) | TextShape::Area (doc text.rs) laid out line by line into the spans the path leaves (text area.rs, layout.rs break_area), type.fillPath (engine type_area_cmds.rs), released to box text by type.detachFromPath, area/path cursors and click-to-place (ui-egui type_tool.rs path_target), .pcraft round trip. Missing: PSD area type (saves as paragraph text over the path's bounds, with an export warning); mixed type sizes in one area paragraph space at its largest line; area type takes paths of at most 4096 anchors: beyond that a Type tool click makes point text (the pointer shows the plain I-beam), and type.fillPath refuses the path with "the path has too many anchor points" (type.attachToPath still takes a subpath of up to 100,000 anchors); a word too wide for every span in the shape overflows its span (box text breaks it at the edge, #6694); the first line starts about 0.24 em lower than in a text box of the same size; Photoshop area type in a PSD opens as box text; the area path has no handles to edit it after the type is placed | +| TYPE-10996-2 | Font menu filter by script, with the Indic scripts (Devanagari, Bengali, Gurmukhi, Gujarati, Odia, Tamil, Telugu, Kannada, Malayalam) beside Latin, East Asian, Japanese and Thai | done | [#10996](https://github.com/storytold/photocraft/issues/10996) | The font pickers (options bar, Character panel, Style Options) offer the script row (ui-egui type_tool fonts.rs); coverage is read from the cmap in craft-font-manager. Arabic and Hebrew are not offered yet | | TYPE-10996-1 | Digit style: digits drawn as typed, Western, by the script of the letters before them, or in an Indic script (Devanagari, Bengali, Gurmukhi, Gujarati, Odia, Tamil, Telugu, Kannada, Malayalam) | partial | [#10996](https://github.com/storytold/photocraft/issues/10996) | CharStyle `digits` (doc text.rs), drawn in shaping (text digits.rs) while the layer text keeps the typed digits; set through the type commands' `digits` key. No Character panel control yet (needs the shared panel in craft-libs); Arabic and Persian digits are #6685; not saved in PSD | ## Automation diff --git a/scorecard/type.toml b/scorecard/type.toml index 579e92e5715..df80105c4f0 100644 --- a/scorecard/type.toml +++ b/scorecard/type.toml @@ -74,6 +74,13 @@ status = "partial" issue = 218 note = "TextShape::Area (doc text.rs) laid out line by line into the spans the path leaves (text area.rs, layout.rs break_area), type.fillPath (engine type_area_cmds.rs), released to box text by type.detachFromPath, area/path cursors and click-to-place (ui-egui type_tool.rs path_target), .pcraft round trip. Missing: PSD area type (saves as paragraph text over the path's bounds, with an export warning); mixed type sizes in one area paragraph space at its largest line; area type takes paths of at most 4096 anchors: beyond that a Type tool click makes point text (the pointer shows the plain I-beam), and type.fillPath refuses the path with \"the path has too many anchor points\" (type.attachToPath still takes a subpath of up to 100,000 anchors); a word too wide for every span in the shape overflows its span (box text breaks it at the edge, #6694); the first line starts about 0.24 em lower than in a text box of the same size; Photoshop area type in a PSD opens as box text; the area path has no handles to edit it after the type is placed" +[[item]] +id = "TYPE-10996-2" +target = "Font menu filter by script, with the Indic scripts (Devanagari, Bengali, Gurmukhi, Gujarati, Odia, Tamil, Telugu, Kannada, Malayalam) beside Latin, East Asian, Japanese and Thai" +status = "done" +issue = 10996 +note = "The font pickers (options bar, Character panel, Style Options) offer the script row (ui-egui type_tool fonts.rs); coverage is read from the cmap in craft-font-manager. Arabic and Hebrew are not offered yet" + [[item]] id = "TYPE-10996-1" target = "Digit style: digits drawn as typed, Western, by the script of the letters before them, or in an Indic script (Devanagari, Bengali, Gurmukhi, Gujarati, Odia, Tamil, Telugu, Kannada, Malayalam)" From 553b17b5301fa0751f3fb884adb6f3887bcc5f18 Mon Sep 17 00:00:00 2001 From: ruchirguitar Date: Tue, 1 Dec 2026 23:31:22 +0530 Subject: [PATCH 39/61] Move craft-libs pin to fc3262f6 (craft-libs#4514) Brings in the font picker's Toolbar Script select. --- Cargo.lock | 192 +++++++++++++++++----------------- Cargo.toml | 84 +++++++-------- crates/engine-core/Cargo.toml | 2 +- crates/ipp/Cargo.toml | 2 +- 4 files changed, 140 insertions(+), 140 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 980c2438d55..271ff15964a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1376,7 +1376,7 @@ dependencies = [ [[package]] name = "craft" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-automation", "craft-behavior", @@ -1417,7 +1417,7 @@ dependencies = [ [[package]] name = "craft-affinity" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "crc32fast", "flate2", @@ -1438,7 +1438,7 @@ dependencies = [ [[package]] name = "craft-appkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "block2 0.6.2", "objc2 0.6.5", @@ -1450,7 +1450,7 @@ dependencies = [ [[package]] name = "craft-atomic" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "rustix 1.1.6", ] @@ -1458,7 +1458,7 @@ dependencies = [ [[package]] name = "craft-automation" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -1483,7 +1483,7 @@ dependencies = [ [[package]] name = "craft-behavior" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "accesskit", "bitflags 2.13.2", @@ -1501,7 +1501,7 @@ dependencies = [ [[package]] name = "craft-browse" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-docpath", @@ -1519,7 +1519,7 @@ dependencies = [ [[package]] name = "craft-cloud-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "egui", ] @@ -1527,7 +1527,7 @@ dependencies = [ [[package]] name = "craft-cms" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "md-5", "rayon", @@ -1536,12 +1536,12 @@ dependencies = [ [[package]] name = "craft-codepage" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" [[package]] name = "craft-color" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "serde", ] @@ -1549,7 +1549,7 @@ dependencies = [ [[package]] name = "craft-color-transform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-cms", "craft-color", @@ -1559,7 +1559,7 @@ dependencies = [ [[package]] name = "craft-color-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-cms", @@ -1580,7 +1580,7 @@ dependencies = [ [[package]] name = "craft-control" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-ai-agents", "craft-atomic", @@ -1596,7 +1596,7 @@ dependencies = [ [[package]] name = "craft-control-protocol" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "getrandom 0.3.4", "serde_json", @@ -1606,7 +1606,7 @@ dependencies = [ [[package]] name = "craft-crs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-metadata", "craft-xml", @@ -1616,7 +1616,7 @@ dependencies = [ [[package]] name = "craft-crw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "thiserror 2.0.21", ] @@ -1624,7 +1624,7 @@ dependencies = [ [[package]] name = "craft-dds" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "rayon", ] @@ -1632,7 +1632,7 @@ dependencies = [ [[package]] name = "craft-develop" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-color", "craft-color-transform", @@ -1647,7 +1647,7 @@ dependencies = [ [[package]] name = "craft-develop-model" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-geom", "craft-metadata", @@ -1659,7 +1659,7 @@ dependencies = [ [[package]] name = "craft-dialogs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "block2 0.6.2", "craft-appkit", @@ -1685,7 +1685,7 @@ dependencies = [ [[package]] name = "craft-docpath" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "serde", ] @@ -1693,7 +1693,7 @@ dependencies = [ [[package]] name = "craft-draw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1712,7 +1712,7 @@ dependencies = [ [[package]] name = "craft-drawingml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "chrono", "craft-xml", @@ -1724,12 +1724,12 @@ dependencies = [ [[package]] name = "craft-eps" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" [[package]] name = "craft-file-formats" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-eps", "craft-idml", @@ -1747,7 +1747,7 @@ dependencies = [ [[package]] name = "craft-flags" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-atomic", "dirs", @@ -1757,7 +1757,7 @@ dependencies = [ [[package]] name = "craft-font-catalog" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "fontique", "harfrust 0.13.3", @@ -1772,7 +1772,7 @@ dependencies = [ [[package]] name = "craft-font-manager" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -1792,7 +1792,7 @@ dependencies = [ [[package]] name = "craft-font-os-windows" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "windows-registry", "windows-sys 0.61.2", @@ -1801,7 +1801,7 @@ dependencies = [ [[package]] name = "craft-font-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "cap-primitives", "craft-atomic", @@ -1824,12 +1824,12 @@ dependencies = [ [[package]] name = "craft-fonts-build" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" [[package]] name = "craft-geom" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "serde", ] @@ -1837,7 +1837,7 @@ dependencies = [ [[package]] name = "craft-heif" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "heic-rs", "rayon", @@ -1846,7 +1846,7 @@ dependencies = [ [[package]] name = "craft-host" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "bitflags 2.13.2", "craft-i18n", @@ -1859,7 +1859,7 @@ dependencies = [ [[package]] name = "craft-i18n" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "brotli 9.1.3", "brotli-decompressor 6.3.2", @@ -1889,7 +1889,7 @@ dependencies = [ [[package]] name = "craft-idml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-xml", "craft-zip", @@ -1899,7 +1899,7 @@ dependencies = [ [[package]] name = "craft-image-codecs" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-dds", "craft-heif", @@ -1927,7 +1927,7 @@ dependencies = [ [[package]] name = "craft-imaging" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-color-ui", @@ -1945,12 +1945,12 @@ dependencies = [ [[package]] name = "craft-ipp" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" [[package]] name = "craft-jpeg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "thiserror 2.0.21", ] @@ -1958,7 +1958,7 @@ dependencies = [ [[package]] name = "craft-keymap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-host", "craft-i18n", @@ -1973,7 +1973,7 @@ dependencies = [ [[package]] name = "craft-kra" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-xml", "craft-zip", @@ -1983,7 +1983,7 @@ dependencies = [ [[package]] name = "craft-layers" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-i18n", @@ -1997,7 +1997,7 @@ dependencies = [ [[package]] name = "craft-menu" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-host", @@ -2015,7 +2015,7 @@ dependencies = [ [[package]] name = "craft-metadata" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "brotli-decompressor 6.3.2", "chrono", @@ -2027,7 +2027,7 @@ dependencies = [ [[package]] name = "craft-nightly" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "uds_windows", "winsafe", @@ -2036,7 +2036,7 @@ dependencies = [ [[package]] name = "craft-ora" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-xml", "craft-zip", @@ -2046,7 +2046,7 @@ dependencies = [ [[package]] name = "craft-pages" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-keymap", @@ -2062,7 +2062,7 @@ dependencies = [ [[package]] name = "craft-pcraft-bundle" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "blake3", "craft-atomic", @@ -2075,7 +2075,7 @@ dependencies = [ [[package]] name = "craft-pcraft-format" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "flate2", "serde", @@ -2086,7 +2086,7 @@ dependencies = [ [[package]] name = "craft-pdf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "bytemuck", "flate2", @@ -2101,7 +2101,7 @@ dependencies = [ [[package]] name = "craft-pdn" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "flate2", "thiserror 2.0.21", @@ -2110,7 +2110,7 @@ dependencies = [ [[package]] name = "craft-platform" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "async-channel", "async-io", @@ -2143,7 +2143,7 @@ dependencies = [ [[package]] name = "craft-plist" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "thiserror 2.0.21", ] @@ -2151,7 +2151,7 @@ dependencies = [ [[package]] name = "craft-print" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-host", @@ -2175,7 +2175,7 @@ dependencies = [ [[package]] name = "craft-psd" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "encoding_rs", "flate2", @@ -2186,7 +2186,7 @@ dependencies = [ [[package]] name = "craft-quit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "dispatch2", "egui", @@ -2199,7 +2199,7 @@ dependencies = [ [[package]] name = "craft-raw" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "chrono", "craft-crw", @@ -2217,7 +2217,7 @@ dependencies = [ [[package]] name = "craft-review" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "base64 0.23.1", "craft-behavior", @@ -2236,7 +2236,7 @@ dependencies = [ [[package]] name = "craft-settings" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-atomic", "craft-host", @@ -2253,7 +2253,7 @@ dependencies = [ [[package]] name = "craft-svg" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-image-codecs", "craft-xml", @@ -2274,7 +2274,7 @@ dependencies = [ [[package]] name = "craft-table" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-keymap", @@ -2286,7 +2286,7 @@ dependencies = [ [[package]] name = "craft-testkit" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "rustix 1.1.6", "tempfile", @@ -2296,7 +2296,7 @@ dependencies = [ [[package]] name = "craft-text" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-font-manager", @@ -2319,7 +2319,7 @@ dependencies = [ [[package]] name = "craft-theme" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "bitflags 2.13.2", "craft-tracked", @@ -2334,7 +2334,7 @@ dependencies = [ [[package]] name = "craft-theme-editor" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-theme", @@ -2345,7 +2345,7 @@ dependencies = [ [[package]] name = "craft-theme-store" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-atomic", "craft-behavior", @@ -2360,7 +2360,7 @@ dependencies = [ [[package]] name = "craft-tiff" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "serde", "thiserror 2.0.21", @@ -2370,7 +2370,7 @@ dependencies = [ [[package]] name = "craft-time" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "serde", "thiserror 2.0.21", @@ -2379,7 +2379,7 @@ dependencies = [ [[package]] name = "craft-timeline" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-keymap", @@ -2394,7 +2394,7 @@ dependencies = [ [[package]] name = "craft-tracked" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "serde", ] @@ -2402,7 +2402,7 @@ dependencies = [ [[package]] name = "craft-ui" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-cloud-ui", "craft-ui-canvas", @@ -2416,7 +2416,7 @@ dependencies = [ [[package]] name = "craft-ui-canvas" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-font-catalog", @@ -2433,7 +2433,7 @@ dependencies = [ [[package]] name = "craft-ui-contract" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "accesskit", "craft-behavior", @@ -2475,7 +2475,7 @@ dependencies = [ [[package]] name = "craft-ui-macros" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -2486,7 +2486,7 @@ dependencies = [ [[package]] name = "craft-ui-panels" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-host", @@ -2504,7 +2504,7 @@ dependencies = [ [[package]] name = "craft-ui-patterns" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-host", @@ -2525,7 +2525,7 @@ dependencies = [ [[package]] name = "craft-ui-shell" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-host", @@ -2545,7 +2545,7 @@ dependencies = [ [[package]] name = "craft-ui-widgets" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-behavior", "craft-host", @@ -2564,7 +2564,7 @@ dependencies = [ [[package]] name = "craft-update" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "base64 0.22.1", "chrono", @@ -2596,7 +2596,7 @@ dependencies = [ [[package]] name = "craft-win32" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "winsafe", ] @@ -2604,7 +2604,7 @@ dependencies = [ [[package]] name = "craft-window" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "craft-appkit", "craft-atomic", @@ -2636,7 +2636,7 @@ dependencies = [ [[package]] name = "craft-xcf" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "flate2", "thiserror 2.0.21", @@ -2645,7 +2645,7 @@ dependencies = [ [[package]] name = "craft-xml" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "quick-xml 0.41.0", "serde", @@ -2655,7 +2655,7 @@ dependencies = [ [[package]] name = "craft-zip" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "flate2", "thiserror 2.0.21", @@ -4179,7 +4179,7 @@ dependencies = [ [[package]] name = "hayro" version = "0.7.1" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "bytemuck", "hayro-interpret", @@ -4209,7 +4209,7 @@ dependencies = [ [[package]] name = "hayro-interpret" version = "0.7.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "bitflags 2.13.2", "hayro-cmap", @@ -4227,7 +4227,7 @@ dependencies = [ [[package]] name = "hayro-jbig2" version = "0.3.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "fearless_simd", "hayro-ccitt", @@ -4251,7 +4251,7 @@ checksum = "bc2d80da85f31c3fdc0366431f44cfd645a9da1e242ed1f4a61f213d9765660f" [[package]] name = "hayro-syntax" version = "0.7.2" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "flate2", "hayro-ccitt", @@ -5344,7 +5344,7 @@ checksum = "d4a5ff6bcca6c4867b1c4fd4ef63e4db7436ef363e0ad7531d1558856bae64f4" [[package]] name = "linesweeper" version = "0.5.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "arrayvec", "kurbo 0.13.1", @@ -9855,7 +9855,7 @@ dependencies = [ [[package]] name = "vello_common" version = "0.0.8" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "bytemuck", "fearless_simd", @@ -9903,7 +9903,7 @@ dependencies = [ [[package]] name = "vello_cpu" version = "0.0.8" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" dependencies = [ "bytemuck", "glifo 0.1.1", @@ -11549,14 +11549,14 @@ source = "git+https://github.com/storytold/egui.git?rev=07c20531f89717e461c0f387 [[patch.unused]] name = "hayro-cmap" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" [[patch.unused]] name = "hayro-postscript" version = "0.1.0" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" [[patch.unused]] name = "krilla" version = "0.8.2" -source = "git+https://github.com/storytold/craft-libs?rev=475f6feb712bd2db2f235d9999be61c68477ae39#475f6feb712bd2db2f235d9999be61c68477ae39" +source = "git+https://github.com/storytold/craft-libs?rev=fc3262f68babdb19a98a89c415c84c6b327073d3#fc3262f68babdb19a98a89c415c84c6b327073d3" diff --git a/Cargo.toml b/Cargo.toml index 61da67d493e..c941befcf2b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -12,21 +12,21 @@ rust-version = "1.95" [workspace.dependencies] # The craft framework through its facade (`craft::ui::…`). The egui `[patch]` below must match # `craft::egui_fork::REV` (checked by `cargo xtask ci`). -craft = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39", default-features = false } -craft-tracked = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -craft-ui-macros = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } +craft = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3", default-features = false } +craft-tracked = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-ui-macros = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } # internal photocraft-geom = { path = "crates/geom" } photocraft-color = { path = "crates/color" } photocraft-raster = { path = "crates/raster" } photocraft-doc = { path = "crates/doc" } photocraft-ops = { path = "crates/ops" } -craft-plist = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -photocraft-codecs = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -photocraft-formats = { package = "craft-file-formats", git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39", features = ["raster-codecs", "pdf", "svg", "ora", "kra", "xcf", "pdn", "raw", "psd", "affinity", "pcraft"] } +craft-plist = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-psd = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +photocraft-codecs = { package = "craft-image-codecs", git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +photocraft-formats = { package = "craft-file-formats", git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3", features = ["raster-codecs", "pdf", "svg", "ora", "kra", "xcf", "pdn", "raw", "psd", "affinity", "pcraft"] } photocraft-raw = { path = "crates/raw" } -craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } +craft-affinity = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } photocraft-compose = { path = "crates/compose" } photocraft-gpu = { path = "crates/gpu" } photocraft-paint = { path = "crates/paint" } @@ -48,38 +48,38 @@ photocraft-ipp = { path = "crates/ipp" } # external # ICC colour management: the shared crate (replaces crates/cms; craft-libs#779). -craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -craft-print = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } +craft-cms = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-print = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } # HEIC/HEIF: the shared decoder (replaces crates/heif; craft-libs#784). -craft-heif = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39", features = ["raster", "write-raster"] } -craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -craft-pcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -craft-pcraft-bundle = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -craft-zip = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -craft-ora = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -craft-kra = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -craft-xcf = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -craft-pdn = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } +craft-heif = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-pdf = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3", features = ["raster", "write-raster"] } +craft-xml = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-docpath = { version = "0.1.0", git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-jpeg = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-pcraft-format = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-pcraft-bundle = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-zip = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-ora = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-kra = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-xcf = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-pdn = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } # Keep the shared embedded-image validation API until the framework revision includes it. -craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39", features = ["tree-render", "tree-render-system-fonts"] } -craft-raw = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } +craft-svg = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3", features = ["tree-render", "tree-render-system-fonts"] } +craft-raw = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-tiff = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } # Camera-field EXIF reader/writer, shared prerequisite craft-libs#1563. -craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -craft-crs = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -craft-develop = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -craft-develop-model = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } +craft-metadata = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-crs = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-develop = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +craft-develop-model = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } # Interface translations: lookup, fallback, CLDR plurals and language names over the craft-i18n # catalogs that `crates/ui-egui/build.rs` embeds from `CRAFT_I18N_DIR` (storytold/craft-i18n, at # the commit in `craft-i18n.rev`). Already in the tree through craft. -craft-i18n = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } +craft-i18n = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } # craft-update: app-specific pretend versions apply to startup and manual checks. -craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "475f6feb712bd2db2f235d9999be61c68477ae39", features = ["ui"] } +craft-update = { git = "https://github.com/storytold/craft-libs", version = "=0.1.0", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3", features = ["ui"] } # Self-contained nightly profile isolation, launch protocol, and security fence. -craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } +craft-nightly = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } thiserror = "2" serde = { version = "1", features = ["derive", "rc"] } serde_json = "1" @@ -352,16 +352,16 @@ opt-level = 3 # Keep the complete egui family and native event bridge on reviewed fork commits. [patch.crates-io] -krilla = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -hayro = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -vello_common = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } -vello_cpu = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } +krilla = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +hayro = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +hayro-interpret = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +hayro-syntax = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +hayro-jbig2 = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +hayro-cmap = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +hayro-postscript = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +linesweeper = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +vello_common = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } +vello_cpu = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } ecolor = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } emath = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } epaint = { git = "https://github.com/storytold/egui.git", rev = "07c20531f89717e461c0f387dd1f9649553f9321" } diff --git a/crates/engine-core/Cargo.toml b/crates/engine-core/Cargo.toml index ac24b32f634..be32b115541 100644 --- a/crates/engine-core/Cargo.toml +++ b/crates/engine-core/Cargo.toml @@ -19,7 +19,7 @@ photocraft-geom = { workspace = true } photocraft-color = { workspace = true } craft-cms = { workspace = true } # PCTIP codec from craft-libs#1564; kept at the same shared revision as the workspace. -craft-pcraft-tip = { package = "craft-pcraft-format", git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } +craft-pcraft-tip = { package = "craft-pcraft-format", git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } photocraft-raster = { workspace = true } photocraft-doc = { workspace = true } photocraft-ops = { workspace = true } diff --git a/crates/ipp/Cargo.toml b/crates/ipp/Cargo.toml index b25a5ccd3f7..8c4df389b76 100644 --- a/crates/ipp/Cargo.toml +++ b/crates/ipp/Cargo.toml @@ -7,7 +7,7 @@ license.workspace = true rust-version.workspace = true [dependencies] -craft-ipp = { git = "https://github.com/storytold/craft-libs", rev = "475f6feb712bd2db2f235d9999be61c68477ae39" } +craft-ipp = { git = "https://github.com/storytold/craft-libs", rev = "fc3262f68babdb19a98a89c415c84c6b327073d3" } [lints] workspace = true From 6868bdf2aa9672e9baa06bc2a305d0a94b71d517 Mon Sep 17 00:00:00 2001 From: David Mann Date: Tue, 1 Dec 2026 19:38:19 +0100 Subject: [PATCH 40/61] Configure the scratch disk only when its settings change (#18788) Every preference edit ran scratch::configure, which re-measures memory, probes the scratch folder and restarts a paused disk's backoff (about 17 ms on a machine with a full scratch disk). A dialog with a remembered place edits the preferences on nearly every frame of a drag, so the drag ran at a third of its frame rate. apply_prefs now keeps the settings it configured and configures again only when they change. Co-Authored-By: Claude Opus 5.5 --- crates/engine-core/src/lib.rs | 3 + crates/engine-core/src/prefs.rs | 6 +- crates/engine-core/src/scratch.rs | 97 +++++++++++++++++++++++++------ 3 files changed, 86 insertions(+), 20 deletions(-) diff --git a/crates/engine-core/src/lib.rs b/crates/engine-core/src/lib.rs index 3f6f605c338..5a224dc5a56 100644 --- a/crates/engine-core/src/lib.rs +++ b/crates/engine-core/src/lib.rs @@ -309,6 +309,9 @@ pub struct Session { next_pending_preflight: u64, /// Shared native memory supervision, owned and stopped by the last session using it. scratch_runtime: Option, + /// The scratch disk and memory settings [`Session::apply_prefs`] last configured: an edit of + /// other preferences configures nothing again. + scratch_applied: Option, /// [`photocraft_raster::spill::epoch`] when History's byte limits were last applied: a /// scratch disk that pauses or resumes changes the limit ([`Session::sync_scratch_state`]). scratch_epoch: u64, diff --git a/crates/engine-core/src/prefs.rs b/crates/engine-core/src/prefs.rs index 76d893ed933..8d56154bb35 100644 --- a/crates/engine-core/src/prefs.rs +++ b/crates/engine-core/src/prefs.rs @@ -1902,7 +1902,11 @@ impl Session { /// missing-glyph protection. pub fn apply_prefs(&mut self) { self.scratch_runtime.get_or_insert_with(crate::scratch::Runtime::default); - crate::scratch::configure(self.prefs()); + let scratch = crate::scratch::Settings::of(self.prefs()); + if self.scratch_applied.as_ref() != Some(&scratch) { + crate::scratch::configure(&scratch); + self.scratch_applied = Some(scratch); + } self.scratch_epoch = photocraft_raster::spill::epoch(); let n = self.prefs().performance.history_states.max(1) as usize; let bytes = self.prefs().performance.history_cap_bytes(); diff --git a/crates/engine-core/src/scratch.rs b/crates/engine-core/src/scratch.rs index 9133f76f03b..6c46f158838 100644 --- a/crates/engine-core/src/scratch.rs +++ b/crates/engine-core/src/scratch.rs @@ -129,42 +129,101 @@ mod native { // If configure uses this query even once, it pauses for lack of room. This catches an // override that is missing or is installed after configuring the scratch directory. photocraft_raster::spill::set_volume_space_for_tests(|_| Some((0, 64 << 30))); - super::super::configure(&crate::prefs::Preferences::default()); + super::super::configure(&super::super::Settings::of(&crate::prefs::Preferences::default())); assert!(!photocraft_raster::spill::paused()); let room = (32_u64 << 30) - (64_u64 << 30) / 20; assert_eq!(photocraft_raster::spill::scratch_capacity(), Some(room - room / 64)); } + + /// A preference edit that changes neither Memory Usage nor the scratch disks configures + /// neither again: a dragged dialog remembers its place through a preference edit every + /// frame, and configuring took milliseconds each time. + #[test] + fn unrelated_preference_edits_leave_the_scratch_disk_alone() { + const CHILD: &str = "PHOTOCRAFT_SCRATCH_UNRELATED_EDIT_TEST_CHILD"; + if std::env::var_os(CHILD).is_none() { + let status = std::process::Command::new(std::env::current_exe().unwrap()) + .args(["--exact", "scratch::native::tests::unrelated_preference_edits_leave_the_scratch_disk_alone"]) + .env(CHILD, "1") + .status() + .unwrap(); + assert!(status.success(), "isolated scratch test failed: {status}"); + return; + } + + let mut session = crate::Session::new(); + // As at startup (`prefs_ui::startup`). + session.apply_prefs(); + let configured = photocraft_raster::memory::configuration_generation; + let before = configured(); + session.edit_prefs(|p| { + p.sections.insert("photocraft.test.window".into(), serde_json::json!({"x": 1})); + }); + assert_eq!(configured(), before, "a section edit configured the scratch disk again"); + session.edit_prefs(|p| p.performance.memory_usage_percent = Some(p.performance.memory_usage_percent.unwrap_or(70) - 10)); + assert!(configured() > before, "a Memory Usage edit must reach the memory budgets"); + } } } -pub(crate) fn configure(prefs: &Preferences) { +/// What [`configure`] reads from the preferences. An edit that leaves it the same leaves the +/// scratch disk and the memory budgets as they are ([`crate::Session::apply_prefs`]): configuring +/// them again re-measures memory, probes the scratch folder and restarts a paused disk's backoff, +/// which takes milliseconds, and preference edits come once per frame while a remembered window +/// is dragged. +#[derive(Clone, Debug, PartialEq, Eq)] +pub(crate) struct Settings { + percent: Option, + absolute_mb: u32, + /// The first enabled scratch disk. + #[cfg(not(target_arch = "wasm32"))] + dir: Option, + #[cfg(not(target_arch = "wasm32"))] + size_limit_mb: u32, + /// The tile budget's override (`PHOTOCRAFT_TILE_BUDGET_MB`), when set. + #[cfg(not(target_arch = "wasm32"))] + tile_override: Option, +} + +impl Settings { + pub(crate) fn of(prefs: &Preferences) -> Self { + Settings { + percent: prefs.performance.memory_usage_percent, + // The web build's cap applies here too (effective_memory_usage_mb). + absolute_mb: prefs.performance.effective_memory_usage_mb(), + #[cfg(not(target_arch = "wasm32"))] + dir: prefs + .scratch_disks + .disks + .iter() + .find(|d| d.enabled && !d.path.trim().is_empty()) + .map(|d| if d.path.trim() == "(system temp)" { std::env::temp_dir() } else { std::path::PathBuf::from(d.path.trim()) }), + #[cfg(not(target_arch = "wasm32"))] + size_limit_mb: prefs.scratch_disks.size_limit_mb, + #[cfg(not(target_arch = "wasm32"))] + tile_override: std::env::var_os("PHOTOCRAFT_TILE_BUDGET_MB").is_some().then(|| prefs.performance.tile_budget_bytes()), + } + } +} + +/// Configures the memory budgets and the scratch disk as `settings` say. +pub(crate) fn configure(settings: &Settings) { #[cfg(all(test, not(target_arch = "wasm32")))] photocraft_raster::spill::use_test_volume_space(); let budget = photocraft_raster::memory::configure(photocraft_raster::memory::Policy { - percent: prefs.performance.memory_usage_percent, - // The web build's cap applies here too (effective_memory_usage_mb). - absolute_bytes: u64::from(prefs.performance.effective_memory_usage_mb()).saturating_mul(1 << 20), + percent: settings.percent, + absolute_bytes: u64::from(settings.absolute_mb).saturating_mul(1 << 20), }); #[cfg(not(target_arch = "wasm32"))] { - let dir = prefs - .scratch_disks - .disks - .iter() - .find(|d| d.enabled && !d.path.trim().is_empty()) - .map(|d| if d.path.trim() == "(system temp)" { std::env::temp_dir() } else { std::path::PathBuf::from(d.path.trim()) }); // An unusable or full directory pauses eviction without dropping resident pixels and // is retried with backoff; History's byte limit applies meanwhile (sync_scratch_state). // The reason is exposed in ui.inspect and the application's status bar. - let tiles = if std::env::var_os("PHOTOCRAFT_TILE_BUDGET_MB").is_some() { - prefs.performance.tile_budget_bytes() - } else { - usize::try_from(budget.tile_bytes).unwrap_or(usize::MAX) - }; - let limit = prefs.scratch_disks.size_limit_mb; + let tiles = settings.tile_override.unwrap_or_else(|| usize::try_from(budget.tile_bytes).unwrap_or(usize::MAX)); + let limit = settings.size_limit_mb; photocraft_raster::spill::set_size_cap((limit > 0).then(|| u64::from(limit).saturating_mul(1 << 20))); - let _ = photocraft_raster::spill::configure(dir.as_deref(), tiles); + let _ = photocraft_raster::spill::configure(settings.dir.as_deref(), tiles); } #[cfg(target_arch = "wasm32")] - let _ = (prefs, budget); + let _ = budget; } From 28d4f2d8d3ba45098492726fe00ab1a6538197de Mon Sep 17 00:00:00 2001 From: David Mann Date: Tue, 1 Dec 2026 20:04:26 +0100 Subject: [PATCH 41/61] Store framework sections as remembered state, not a settings edit (#18794) A dialog that remembers its place writes its framework section on every frame of a move or resize. PrefSections::sync stored it with edit_prefs, which moves the settings revision every panel version holds, so the dock rebuilt all its panels each frame and the engine re-applied its preferences. No view reads the sections from the preferences, so they are now stored with PrefsStore::remember: saved, no settings revision. Co-Authored-By: Claude Opus 5.5 --- crates/ui-egui/src/app/framework.rs | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/app/framework.rs b/crates/ui-egui/src/app/framework.rs index 744e8358f8a..ea8e63a4868 100644 --- a/crates/ui-egui/src/app/framework.rs +++ b/crates/ui-egui/src/app/framework.rs @@ -831,8 +831,11 @@ impl PrefSections { .filter_map(|key| Some((key.clone(), serde_json::to_value(t.tables.get(key)?).ok()?))) .filter(|(key, value)| session.prefs().sections.get(key) != Some(value)) .collect(); + // Remembered, not a settings edit: no view reads the sections back from the preferences (the components + // read them here), so the panels keep their versions and the engine applies nothing. A dialog that + // remembers its place writes on every frame of a drag. if !changed.is_empty() { - session.edit_prefs(|p| p.sections.extend(changed)); + session.prefs.remember(|p| p.sections.extend(changed)); } for key in written { let rev = session.section_rev(&key); @@ -986,6 +989,19 @@ mod tests { assert_eq!(store.read("one"), None); } + /// A component's section write is saved, but is no settings edit: the panels' versions hold the settings revision, + /// so an edit would rebuild every panel on each frame a dialog that remembers its place is dragged. + #[test] + fn a_section_write_is_saved_without_a_settings_edit() { + let store = PrefSections::default(); + let mut session = Session::new(); + let (saved, settings) = (session.prefs.rev(), session.prefs.settings_rev()); + store.write("one", table(1)); + store.sync(&mut session); + assert_ne!(session.prefs.rev(), saved, "the write reaches the saved preferences"); + assert_eq!(session.prefs.settings_rev(), settings, "the panels keep their versions"); + } + /// Every theme PhotoCraft has a palette for names a framework built-in. #[test] fn every_palette_theme_is_a_builtin() { From ff8d83aed937ff1fd0d260ca10a79049e84b1348 Mon Sep 17 00:00:00 2001 From: Terra854 Date: Wed, 2 Dec 2026 03:57:30 +0800 Subject: [PATCH 42/61] Add Actual Size view using physical display resolution --- crates/engine-core/src/shell_commands.rs | 1 + crates/ui-egui/Cargo.toml | 9 +- crates/ui-egui/src/menu_catalog.rs | 1 + crates/ui-egui/src/menus/invoke.rs | 1 + crates/ui-egui/src/menus/view_cmds.rs | 5 + .../src/menus/view_cmds/actual_size.rs | 146 ++++++++++++++++++ .../src/menus/view_cmds/actual_size_tests.rs | 77 +++++++++ .../ui-egui/src/menus/view_cmds/dispatch.rs | 13 +- 8 files changed, 250 insertions(+), 3 deletions(-) create mode 100644 crates/ui-egui/src/menus/view_cmds/actual_size.rs create mode 100644 crates/ui-egui/src/menus/view_cmds/actual_size_tests.rs diff --git a/crates/engine-core/src/shell_commands.rs b/crates/engine-core/src/shell_commands.rs index 718454fba30..08dc7b21df9 100644 --- a/crates/engine-core/src/shell_commands.rs +++ b/crates/engine-core/src/shell_commands.rs @@ -58,6 +58,7 @@ pub const SHELL_COMMANDS: &[(&str, &str, &[&str], Option<&str>)] = &[ ("view.zoomOut", "Zoom Out", &["View"], Some("Cmd+-")), ("view.fitOnScreen", "Fit on Screen", &["View"], Some("Cmd+0")), ("view.actualPixels", "100%", &["View"], Some("Cmd+1")), + ("view.actualSize", "Actual Size", &["View"], None), ("view.rotateView", "Rotate View", &[], None), ("view.rotateLeft", "Rotate View Left", &["View"], Some("Alt+Shift+,")), ("view.rotateRight", "Rotate View Right", &["View"], Some("Alt+Shift+.")), diff --git a/crates/ui-egui/Cargo.toml b/crates/ui-egui/Cargo.toml index 647e7decb93..ea1b797f301 100644 --- a/crates/ui-egui/Cargo.toml +++ b/crates/ui-egui/Cargo.toml @@ -69,7 +69,14 @@ sys-locale = "=0.3.2" # symbol (`i18n::decimal_separator`, a registry read): the safe binding the desktop app already # uses, pinned to the same version. [target.'cfg(target_os = "windows")'.dependencies] -winsafe = { version = "=0.0.29", default-features = false, features = ["kernel", "dxgi", "advapi"] } +winsafe = { version = "=0.0.29", default-features = false, features = ["kernel", "dxgi", "advapi", "gdi", "user"] } + +# Safe physical display dimensions for View > Actual Size. Both are already in the lockfile. +[target.'cfg(target_os = "macos")'.dependencies] +core-graphics = "=0.23.2" + +[target.'cfg(target_os = "linux")'.dependencies] +x11rb = { version = "=0.13.2", features = ["randr"] } [dev-dependencies] photocraft-io = { workspace = true, features = ["testgen"] } diff --git a/crates/ui-egui/src/menu_catalog.rs b/crates/ui-egui/src/menu_catalog.rs index 479e8e03689..731634301e9 100644 --- a/crates/ui-egui/src/menu_catalog.rs +++ b/crates/ui-egui/src/menu_catalog.rs @@ -693,6 +693,7 @@ pub static CATALOG: &[(&[&str], &str, Option<&str>, &str)] = &[ (&["View"], "100%", Some("Cmd+1"), "view.actualPixels"), (&["View"], "200%", None, "view.twoHundredPercent"), (&["View"], "Print Size", None, "view.printSize"), + (&["View"], "Actual Size", None, "view.actualSize"), (&["View"], "---", None, "---"), (&["View"], "Flip Horizontal", None, "view.flipHorizontal"), (&["View", "Screen Mode"], "Standard Screen Mode", None, "view.screenMode.standard"), diff --git a/crates/ui-egui/src/menus/invoke.rs b/crates/ui-egui/src/menus/invoke.rs index 8515d08a01a..5d2165aff62 100644 --- a/crates/ui-egui/src/menus/invoke.rs +++ b/crates/ui-egui/src/menus/invoke.rs @@ -60,6 +60,7 @@ fn keeps_box_drag(id: &str) -> bool { "view.zoomOut", "view.fitOnScreen", "view.actualPixels", + "view.actualSize", "view.rotateView", "view.resetView", "view.darkenInterface", diff --git a/crates/ui-egui/src/menus/view_cmds.rs b/crates/ui-egui/src/menus/view_cmds.rs index 7aed10a9462..053535a089c 100644 --- a/crates/ui-egui/src/menus/view_cmds.rs +++ b/crates/ui-egui/src/menus/view_cmds.rs @@ -14,6 +14,7 @@ use serde_json::{Map, Value, json}; use crate::PhotocraftApp; mod arrange; +mod actual_size; pub(crate) mod dialogs; mod dispatch; mod options; @@ -218,3 +219,7 @@ mod save_a_copy_name_tests; #[cfg(test)] #[path = "view_cmds/file_info_title_labels_tests.rs"] mod file_info_title_labels_tests; + +#[cfg(test)] +#[path = "view_cmds/actual_size_tests.rs"] +mod actual_size_tests; diff --git a/crates/ui-egui/src/menus/view_cmds/actual_size.rs b/crates/ui-egui/src/menus/view_cmds/actual_size.rs new file mode 100644 index 00000000000..6da565197d8 --- /dev/null +++ b/crates/ui-egui/src/menus/view_cmds/actual_size.rs @@ -0,0 +1,146 @@ +//! Physical-size viewing. Logical UI scaling is deliberately absent from the PPI calculation. + +use craft::behavior::{canvas::ZoomScheme, kurbo::Size}; +use serde_json::{Value, json}; + +use crate::PhotocraftApp; + +pub(super) fn invoke(app: &mut PhotocraftApp, ctx: &egui::Context, params: &Value) -> Result { + let physical_ppi = display_ppi(ctx); + apply(app, physical_ppi, params) +} + +pub(super) fn apply(app: &mut PhotocraftApp, physical_ppi: Option, params: &Value) -> Result { + if !params.as_object().is_some_and(|object| object.is_empty()) { + return Err("Actual Size takes an empty parameter object".into()); + } + let index = app.session.active_index().ok_or("Actual Size needs an open document")?; + let doc = &app.session.documents().get(index).ok_or("no document")?.doc; + let document_ppi = f64::from(doc.resolution_dpi); + if !document_ppi.is_finite() || document_ppi <= 0.0 { + return Err("Actual Size needs a positive document resolution".into()); + } + let physical_ppi = physical_ppi.filter(|ppi| ppi.is_finite() && *ppi >= 1.0).map(f64::floor); + let fallback = physical_ppi.is_none(); + let preferred = app.session.prefs().units_and_rulers.screen_resolution; + let screen_ppi = physical_ppi.unwrap_or(if preferred >= 1.0 { preferred.floor() } else { preferred }); + let zoom = screen_ppi / document_ppi; + if !zoom.is_finite() || zoom <= 0.0 { + return Err("Actual Size needs a positive screen resolution".into()); + } + let size = Size::new(f64::from(doc.size.width), f64::from(doc.size.height)); + let zoom = ZoomScheme::PHOTOSHOP.clamp(zoom, size) as f32; + app.sync_views(); + let animate = app.session.prefs().general.animated_zoom; + let view = app.ui.views.get_mut(index).ok_or("no document view")?; + view.request_zoom_animation(animate); + view.clear_pending(); + view.zoom = zoom; + let message = if fallback { + tl!("Actual Size uses Screen Resolution because the display's physical size is unavailable").to_string() + } else { + tl!("Actual Size uses the display's physical resolution").to_string() + }; + app.ui.status = message.clone(); + app.ui.status_error = false; + crate::panels::actions::runner::journal_view(app, "view.actualSize", params.clone()); + Ok(json!({"zoom": zoom, "screenPpi": screen_ppi, "fallback": fallback, "status": message})) +} + +/// Invalid or absent device metrics must use the explicit Screen Resolution fallback. +#[cfg(any(test, target_os = "windows", target_os = "macos", target_os = "linux"))] +pub(super) fn physical_ppi(pixels: f64, millimeters: f64) -> Option { + if !pixels.is_finite() || !millimeters.is_finite() || pixels <= 0.0 || millimeters <= 0.0 { + return None; + } + let ppi = pixels * 25.4 / millimeters; + (ppi.is_finite() && (1.0..=10000.0).contains(&ppi)).then_some(ppi.floor()) +} + +#[cfg(target_os = "windows")] +fn display_ppi(ctx: &egui::Context) -> Option { + use winsafe::{HWND, prelude::*}; + + let rect = ctx.input(|input| input.viewport().outer_rect)?; + let scale = f64::from(ctx.pixels_per_point()); + let window = [f64::from(rect.left()) * scale, f64::from(rect.top()) * scale, f64::from(rect.right()) * scale, f64::from(rect.bottom()) * scale]; + if !window.iter().all(|value| value.is_finite()) { + return None; + } + let desktop = HWND::NULL.GetDC().ok()?; + let mut best = (0.0, None); + desktop + .EnumDisplayMonitors(None, |_, device, rect| { + let width = (window[2].min(f64::from(rect.right)) - window[0].max(f64::from(rect.left))).max(0.0); + let height = (window[3].min(f64::from(rect.bottom)) - window[1].max(f64::from(rect.top))).max(0.0); + let area = width * height; + if area > best.0 { + best = ( + area, + physical_ppi(f64::from(device.GetDeviceCaps(winsafe::co::GDC::HORZRES)), f64::from(device.GetDeviceCaps(winsafe::co::GDC::HORZSIZE))), + ); + } + true + }) + .ok()?; + best.1 +} + +#[cfg(target_os = "macos")] +fn display_ppi(ctx: &egui::Context) -> Option { + use core_graphics::display::CGDisplay; + + let window = ctx.input(|input| input.viewport().outer_rect)?; + let native = ctx.native_pixels_per_point().filter(|scale| scale.is_finite() && *scale > 0.0)?; + let factor = f64::from(ctx.pixels_per_point() / native); + let mut best = (0.0, None); + for id in CGDisplay::active_displays().ok()? { + let display = CGDisplay::new(id); + let bounds = display.bounds(); + let width = (f64::from(window.right()) * factor).min(bounds.origin.x + bounds.size.width) - (f64::from(window.left()) * factor).max(bounds.origin.x); + let height = (f64::from(window.bottom()) * factor).min(bounds.origin.y + bounds.size.height) - (f64::from(window.top()) * factor).max(bounds.origin.y); + let area = width.max(0.0) * height.max(0.0); + if area > best.0 { + best = (area, physical_ppi(display.pixels_wide() as f64, display.screen_size().width)); + } + } + best.1 +} + +#[cfg(target_os = "linux")] +fn display_ppi(ctx: &egui::Context) -> Option { + use x11rb::{connection::Connection, protocol::randr::ConnectionExt}; + + // Xwayland's virtual outputs do not describe the native Wayland display's physical size. + if std::env::var_os("WAYLAND_DISPLAY").is_some() { + return None; + } + let window = ctx.input(|input| input.viewport().outer_rect)?; + let factor = f64::from(ctx.pixels_per_point()); + let (connection, screen) = x11rb::connect(None).ok()?; + let root = connection.setup().roots.get(screen)?.root; + let resources = connection.randr_get_screen_resources_current(root).ok()?.reply().ok()?; + let mut best = (0.0, None); + for output in resources.outputs { + let output = connection.randr_get_output_info(output, resources.config_timestamp).ok()?.reply().ok()?; + if output.crtc == 0 { + continue; + } + let crtc = connection.randr_get_crtc_info(output.crtc, resources.config_timestamp).ok()?.reply().ok()?; + let x = f64::from(crtc.x); + let y = f64::from(crtc.y); + let width = (f64::from(window.right()) * factor).min(x + f64::from(crtc.width)) - (f64::from(window.left()) * factor).max(x); + let height = (f64::from(window.bottom()) * factor).min(y + f64::from(crtc.height)) - (f64::from(window.top()) * factor).max(y); + let area = width.max(0.0) * height.max(0.0); + if area > best.0 { + let mode = resources.modes.iter().find(|mode| mode.id == crtc.mode)?; + best = (area, physical_ppi(f64::from(mode.width), f64::from(output.mm_width))); + } + } + best.1 +} + +#[cfg(not(any(target_os = "windows", target_os = "macos", target_os = "linux")))] +fn display_ppi(_ctx: &egui::Context) -> Option { + None +} diff --git a/crates/ui-egui/src/menus/view_cmds/actual_size_tests.rs b/crates/ui-egui/src/menus/view_cmds/actual_size_tests.rs new file mode 100644 index 00000000000..3c68653acff --- /dev/null +++ b/crates/ui-egui/src/menus/view_cmds/actual_size_tests.rs @@ -0,0 +1,77 @@ +use super::actual_size::{apply, physical_ppi}; +use crate::{PhotocraftApp, Services}; +use photocraft_engine::Session; +use serde_json::json; + +#[test] +fn actual_size_uses_whole_physical_ppi_and_keeps_the_document() { + let mut app = PhotocraftApp::new(Session::new(), Services::default()); + app.run("file.new", json!({"width": 3000, "height": 2000})).unwrap(); + app.sync_views(); + for (document_ppi, expected) in [(72.0, 95.0 / 72.0), (300.0, 95.0 / 300.0), (150.0, 95.0 / 150.0), (96.0, 95.0 / 96.0), (36.0, 95.0 / 36.0)] { + app.run("image.imageSize", json!({"resolution": document_ppi, "resample": "none"})).unwrap(); + for screen_ppi in [72.0, 96.0] { + app.run("prefs.set", json!({"path": "unitsAndRulers.screenResolution", "value": screen_ppi})).unwrap(); + app.ui.views[0].center = [126.75, 636.25]; + let before = app.session.active().unwrap().doc.clone(); + let history = app.session.active().unwrap().history.entries().len(); + let dirty = app.session.active().unwrap().is_dirty(); + let result = apply(&mut app, physical_ppi(1920.0, 509.0), &json!({})).unwrap(); + assert!((app.ui.views[0].zoom - expected).abs() < 1e-6); + assert_eq!(app.ui.views[0].center, [126.75, 636.25]); + assert_eq!(result["fallback"], false); + assert_eq!(result["screenPpi"], 95.0); + assert_eq!(app.session.active().unwrap().doc, before); + assert_eq!(app.session.active().unwrap().history.entries().len(), history); + assert_eq!(app.session.active().unwrap().is_dirty(), dirty); + } + } +} + +#[test] +fn actual_size_fallback_is_reported_by_menu_and_automation() { + let mut app = PhotocraftApp::new(Session::new(), Services::default()); + let ctx = app.ctx().clone(); + assert!(!crate::menus::is_enabled(&app, "view.actualSize")); + assert!(crate::menus::invoke(&mut app, &ctx, "view.actualSize", json!({})).is_err()); + app.run("file.new", json!({"width": 320, "height": 240})).unwrap(); + app.run("prefs.set", json!({"path": "unitsAndRulers.screenResolution", "value": 96.5})).unwrap(); + assert!(crate::menus::is_live("view.actualSize")); + assert!(crate::menus::is_enabled(&app, "view.actualSize")); + assert_eq!(super::checked(&app, "view.actualSize"), None); + let result = crate::menus::invoke(&mut app, &ctx, "view.actualSize", json!({})).unwrap(); + assert_eq!(result["fallback"], true, "a headless context has no physical monitor"); + assert_eq!(result["screenPpi"], 96.0); + assert!((app.ui.views[0].zoom - 96.0 / 72.0).abs() < 1e-6); + assert_eq!(result["status"], app.ui.status); + assert!(app.ui.status.contains("Screen Resolution")); + let (request, _receiver) = crate::control::ControlRequest::new("engine.execute", json!({"command": "view.actualSize", "params": {}})); + match crate::control::handle(&mut app, &ctx, &request) { + crate::control::Reply::Done(reply) => { + assert_eq!(reply["result"]["fallback"], true); + assert_eq!(reply["result"]["status"], app.ui.status); + } + _ => panic!("Actual Size should return its fallback result immediately"), + } + let rows = crate::menus::menu_rows(&app); + let positions: Vec<_> = + ["view.printSize", "view.actualSize", "view.flipHorizontal"].map(|id| rows.iter().position(|row| row.command.id == id).unwrap()).into(); + assert!(positions[0] < positions[1] && positions[1] < positions[2]); + let registration = crate::menus::UI_COMMANDS.iter().find(|row| row.0 == "view.actualSize").unwrap(); + assert_eq!(registration.3, None); +} + +#[test] +fn actual_size_rejects_bad_parameters_and_unusable_metrics() { + let mut app = PhotocraftApp::new(Session::new(), Services::default()); + app.run("file.new", json!({"width": 64, "height": 64})).unwrap(); + for params in [json!(null), json!([]), json!({"ppi": 95})] { + assert!(apply(&mut app, Some(95.0), ¶ms).is_err()); + } + for (pixels, mm) in [(0.0, 509.0), (1920.0, 0.0), (f64::NAN, 509.0), (1920.0, f64::INFINITY), (1920.0, 0.001)] { + assert_eq!(physical_ppi(pixels, mm), None); + } + for ppi in [None, Some(f64::NAN), Some(-1.0)] { + assert_eq!(apply(&mut app, ppi, &json!({})).unwrap()["fallback"], true); + } +} diff --git a/crates/ui-egui/src/menus/view_cmds/dispatch.rs b/crates/ui-egui/src/menus/view_cmds/dispatch.rs index 62a94a12779..b8d19a28778 100644 --- a/crates/ui-egui/src/menus/view_cmds/dispatch.rs +++ b/crates/ui-egui/src/menus/view_cmds/dispatch.rs @@ -71,7 +71,13 @@ pub fn handles(id: &str) -> bool { || is_context_task_bar(id) || matches!( id, - "view.extras" | "view.flipHorizontal" | "view.pixelAspectRatioCorrection" | "view.patternPreview" | "view.pixelArtPreview" | "view.rotateView" + "view.extras" + | "view.flipHorizontal" + | "view.pixelAspectRatioCorrection" + | "view.patternPreview" + | "view.pixelArtPreview" + | "view.rotateView" + | "view.actualSize" ) } @@ -91,7 +97,7 @@ pub(super) fn is_enabled_with_engine(app: &PhotocraftApp, id: &str, engine_enabl // Standard again before the next pass (`leave_full_screen_without_document`). "view.screenMode.cycle" | "view.screenMode.cycleBack" => app.ui.text_edit.is_none() && doc, "view.screenMode.fullScreen" | "view.screenMode.fullScreenWithMenuBar" => doc, - "view.rotateView" => doc, + "view.rotateView" | "view.actualSize" => doc, i if i.starts_with("window.arrange.") => arrange_command(&i["window.arrange.".len()..]).is_some_and(|command| { let windows = &app.ui.document_windows; command.arrangement().enabled(app.session.documents().len(), windows.docked.len(), windows.floating.len()) @@ -264,6 +270,9 @@ pub(super) fn no_params(p: &Value) -> bool { /// Run a View/Window/Type shell command, or front an engine command with its dialog. `None` when /// `id` isn't ours. pub fn invoke(app: &mut PhotocraftApp, ctx: &egui::Context, id: &str, params: &Value) -> Option> { + if id == "view.actualSize" { + return Some(super::actual_size::invoke(app, ctx, params)); + } if let Some(result) = crate::panel_docking::command(app, id, params) { return Some(result); } From 82cc01b712bbd22fe7f56cb984ddd64ab402481b Mon Sep 17 00:00:00 2001 From: Terra854 Date: Wed, 2 Dec 2026 03:57:41 +0800 Subject: [PATCH 43/61] Toolbar: dispatch Reset View on Rotate View double-click (#18744) --- crates/ui-egui/src/panels/toolbar.rs | 8 +- .../panels/toolbar_rotate_view_reset_tests.rs | 98 +++++++++++++++++++ 2 files changed, 105 insertions(+), 1 deletion(-) create mode 100644 crates/ui-egui/src/panels/toolbar_rotate_view_reset_tests.rs diff --git a/crates/ui-egui/src/panels/toolbar.rs b/crates/ui-egui/src/panels/toolbar.rs index e3cf32a56cf..5bfdd4983b2 100644 --- a/crates/ui-egui/src/panels/toolbar.rs +++ b/crates/ui-egui/src/panels/toolbar.rs @@ -21,6 +21,9 @@ mod toolbar_docking_tests; #[path = "toolbar_flyout_mark_tests.rs"] mod toolbar_flyout_mark_tests; #[cfg(test)] +#[path = "toolbar_rotate_view_reset_tests.rs"] +mod toolbar_rotate_view_reset_tests; +#[cfg(test)] #[path = "toolbar_tab_reveal_tests.rs"] mod toolbar_tab_reveal_tests; @@ -318,7 +321,7 @@ pub fn toolbar(app: &mut PhotocraftApp, ui: &mut egui::Ui) { if let Some(tool) = out.select { crate::tool_memory::select(app, tool); } - // A double click on Hand fits the image on screen, on Zoom shows it at 100% (Photoshop); with no document open there + // A double click on Hand fits the image on screen, Rotate View resets its angle, and Zoom shows it at 100%; with no document open there // is nothing to do. The framework reports no double click after a modified click. match out.double_clicked { Some(Tool::Hand) => { @@ -327,6 +330,9 @@ pub fn toolbar(app: &mut PhotocraftApp, ui: &mut egui::Ui) { Some(Tool::Zoom) => { let _ = crate::menus::invoke(app, &ctx, "view.actualPixels", json!({})); } + Some(Tool::RotateView) => { + let _ = crate::menus::invoke(app, &ctx, "view.resetView", json!({})); + } _ => {} } if let Some(next) = &out.last_used { diff --git a/crates/ui-egui/src/panels/toolbar_rotate_view_reset_tests.rs b/crates/ui-egui/src/panels/toolbar_rotate_view_reset_tests.rs new file mode 100644 index 00000000000..64a9e28e8e6 --- /dev/null +++ b/crates/ui-egui/src/panels/toolbar_rotate_view_reset_tests.rs @@ -0,0 +1,98 @@ +//! Double-clicking the Rotate View icon in the Hand slot runs Reset View (#18744). + +use super::*; +use egui::{Modifiers, PointerButton}; +use egui_kittest::Harness; +use egui_kittest::kittest::{NodeT, Queryable}; + +fn harness(documents: usize) -> Harness<'static, Box> { + let mut h = Harness::builder().with_size(egui::vec2(1200.0, 1100.0)).with_max_steps(64).build_eframe(move |cc| { + PhotocraftApp::setup_context(&cc.egui_ctx, crate::theme::AppTheme::pro()); + let mut app = PhotocraftApp::with_context(cc.egui_ctx.clone(), photocraft_engine::Session::new(), crate::Services::default()); + for _ in 0..documents { + app.run("file.new", json!({"width": 3000, "height": 2000})).expect("new document"); + } + app.ui.tool = Tool::RotateView; + app.ui.remember_group_tool(Tool::RotateView); + app + }); + h.run_steps(4); + h +} + +/// The shown tool's rail button, excluding the options-bar button and the flyout corner. +fn slot(h: &Harness<'static, Box>, label: &str) -> egui::Pos2 { + h.query_all_by_label(label).rfind(|node| node.rect().width() >= 16.0).expect("the toolbar shows the tool").rect().center() +} + +fn click(h: &mut Harness<'static, Box>, at: egui::Pos2) { + h.event(egui::Event::PointerMoved(at)); + for pressed in [true, false] { + h.event(egui::Event::PointerButton { pos: at, button: PointerButton::Primary, pressed, modifiers: Modifiers::NONE }); + h.run_steps(1); + } +} + +#[test] +fn double_click_on_the_rotate_view_slot_resets_only_the_active_angle() { + let mut h = harness(2); + h.state_mut().ui.views[0].rotation = -23.0; + let active = &mut h.state_mut().ui.views[1]; + active.rotation = 37.0; + active.zoom = 0.75; + active.center = [1400.0, 900.0]; + h.run_steps(4); + let before = h.state().ui.views[1].clone(); + let other = h.state().ui.views[0].clone(); + let doc = h.state().session.active().expect("active document").doc.clone(); + let history = h.state().session.active().expect("active document").history.past_len(); + let at = slot(&h, "Rotate View Tool"); + click(&mut h, at); + assert_eq!(h.state().ui.views[1].rotation, 37.0, "one click only selects Rotate View"); + click(&mut h, at); + h.run_steps(4); + let after = &h.state().ui.views[1]; + assert_eq!(after.rotation, 0.0, "the second click runs Reset View"); + assert_eq!((after.zoom, after.center), (before.zoom, before.center)); + assert_eq!(h.state().ui.views[0], other, "the other document keeps its view"); + assert_eq!(h.state().ui.tool, Tool::RotateView); + let session = h.state().session.active().expect("active document"); + assert!(std::sync::Arc::ptr_eq(&session.doc, &doc)); + assert_eq!(session.history.past_len(), history); +} + +#[test] +fn double_click_on_rotate_view_without_a_document_keeps_the_tool_selected() { + let mut h = harness(0); + let at = slot(&h, "Rotate View Tool"); + click(&mut h, at); + click(&mut h, at); + h.run_steps(4); + assert_eq!(h.state().ui.tool, Tool::RotateView); + assert!(h.state().ui.views.is_empty()); + assert!(h.state().session.active().is_none()); +} + +#[test] +fn hand_and_zoom_keep_their_double_click_actions() { + for (tool, label) in [(Tool::Hand, "Hand Tool"), (Tool::Zoom, "Zoom Tool")] { + let mut h = harness(1); + h.state_mut().ui.tool = tool; + h.state_mut().ui.remember_group_tool(tool); + let view = &mut h.state_mut().ui.views[0]; + view.zoom = 0.75; + view.center = [1400.0, 900.0]; + h.run_steps(4); + let at = slot(&h, label); + click(&mut h, at); + click(&mut h, at); + h.run_steps(4); + let view = &h.state().ui.views[0]; + if tool == Tool::Hand { + assert!(view.zoom > 0.0 && view.zoom < 0.75, "Hand fits the large document on screen"); + assert_eq!(view.center, [1500.0, 1000.0]); + } else { + assert_eq!(view.zoom, 1.0, "Zoom shows actual pixels"); + } + } +} From 93a9ffa3c9735a4cd4999dbbc58757617dd03ebc Mon Sep 17 00:00:00 2001 From: dholzric Date: Tue, 1 Dec 2026 14:06:26 -0600 Subject: [PATCH 44/61] Define Brush Preset and Define Pattern: greyed while a layer mask is the target (#18232) With a pixel layer's or a group's layer mask targeted, or an adjustment layer with its mask active, both items stayed enabled and made a brush or pattern from the composite. The reference greys them there. A shared check, pattern_cmds::layer_mask_targeted, now gates edit.definePattern and brush.defineFromSelection; Define Brush Preset passes on the brush command's reason. Co-Authored-By: Claude Opus 5.5 --- crates/engine-core/src/cmd/edit_menu_cmds.rs | 2 +- crates/engine-core/src/cmd/pattern_cmds.rs | 19 ++- crates/engine-paint/src/cmd/brush_cmds.rs | 6 + .../define_brush_mask_target_tests.rs | 126 ++++++++++++++++++ 4 files changed, 151 insertions(+), 2 deletions(-) create mode 100644 crates/engine-paint/src/cmd/brush_cmds/define_brush_mask_target_tests.rs diff --git a/crates/engine-core/src/cmd/edit_menu_cmds.rs b/crates/engine-core/src/cmd/edit_menu_cmds.rs index 3633d630a10..f8ffa52811a 100644 --- a/crates/engine-core/src/cmd/edit_menu_cmds.rs +++ b/crates/engine-core/src/cmd/edit_menu_cmds.rs @@ -370,7 +370,7 @@ pub fn specs() -> Vec { ["Edit"], None, r##"{"name":text}"##, - |s| if s.is_enabled("brush.defineFromSelection") { Ok(()) } else { Err("select pixels to define a brush from".into()) }, + |s| s.disabled_reason("brush.defineFromSelection").map_or(Ok(()), Err), define_brush_preset ), spec!( diff --git a/crates/engine-core/src/cmd/pattern_cmds.rs b/crates/engine-core/src/cmd/pattern_cmds.rs index 8a6e108e7e0..9f2246fbc23 100644 --- a/crates/engine-core/src/cmd/pattern_cmds.rs +++ b/crates/engine-core/src/cmd/pattern_cmds.rs @@ -456,6 +456,23 @@ fn for_each_band(p: &Pattern, w: u32, h: u32, mut f: impl FnMut(&[[f32; 4]])) { } } +/// A layer mask is the edit target: the active pixel layer's or group's mask is targeted, or the active layer is an +/// adjustment layer with a mask, which is what it edits. Define Pattern and Define Brush Preset are greyed then (#18232). +pub fn layer_mask_targeted(s: &Session) -> bool { + let Some(st) = s.active() else { return false }; + let Some(layer) = st.active_layer.and_then(|id| st.doc.layer(id)).filter(|l| l.mask.is_some()) else { return false }; + match st.channel_view.target { + crate::channel_cmds::ChannelTarget::LayerMask => true, + crate::channel_cmds::ChannelTarget::Composite => st.doc.quick_mask.is_none() && matches!(layer.content, LayerContent::Adjustment(_)), + _ => false, + } +} + +fn can_define(s: &Session) -> std::result::Result<(), String> { + has_doc(s)?; + if layer_mask_targeted(s) { Err("a layer mask is the target".into()) } else { Ok(()) } +} + pub fn specs() -> Vec { vec![ CommandSpec { @@ -464,7 +481,7 @@ pub fn specs() -> Vec { menu: &["Edit"], shortcut: None, params: r##"{"name":text,"rect":[x0,y0,x1,y1]?} → {"pattern":id} (name: default the document's name numbered past the library's names; rect: default the selection bounds or else the canvas; added to the library from the visible composite)"##, - enabled: has_doc, + enabled: can_define, journal: true, run: define, }, diff --git a/crates/engine-paint/src/cmd/brush_cmds.rs b/crates/engine-paint/src/cmd/brush_cmds.rs index e07b0102ede..6cc12942b3b 100644 --- a/crates/engine-paint/src/cmd/brush_cmds.rs +++ b/crates/engine-paint/src/cmd/brush_cmds.rs @@ -1166,6 +1166,9 @@ fn presets_set_current(s: &mut Session, p: &Value) -> Result { fn has_selection_and_pixels(s: &Session) -> std::result::Result<(), String> { let d = s.active().ok_or("no document")?; + if crate::pattern_cmds::layer_mask_targeted(s) { + return Err("a layer mask is the target".into()); + } // The area the command reads (selection, else canvas) is limited, not just the painted // extent, like Photoshop (#14275). let area = d.doc.selection.as_ref().map_or_else(|| d.doc.bounds(), |sel| sel.content_bounds().intersect(&d.doc.bounds())); @@ -1706,3 +1709,6 @@ mod filter_mask_stroke_tests; #[cfg(test)] mod define_brush_size_limit_tests; + +#[cfg(test)] +mod define_brush_mask_target_tests; diff --git a/crates/engine-paint/src/cmd/brush_cmds/define_brush_mask_target_tests.rs b/crates/engine-paint/src/cmd/brush_cmds/define_brush_mask_target_tests.rs new file mode 100644 index 00000000000..17c64ac9a27 --- /dev/null +++ b/crates/engine-paint/src/cmd/brush_cmds/define_brush_mask_target_tests.rs @@ -0,0 +1,126 @@ +//! #18232: Define Brush Preset (and the brush command it runs) and Define Pattern are greyed and refused while a layer +//! mask is the edit target: a pixel layer's or a group's mask targeted, or an adjustment layer with its mask. Targeting +//! the composite again, or deleting the adjustment layer's mask, makes them available. Other targets and layer kinds +//! keep today's gates. + +use super::*; + +const COMMANDS: [&str; 3] = ["edit.defineBrushPreset", "brush.defineFromSelection", "edit.definePattern"]; + +/// A white 60 x 40 document with a new layer holding a black rectangle, the layer active. +fn document() -> Session { + let mut s = crate::session(); + s.execute("file.new", json!({"width": 60, "height": 40, "background": "#ffffff"})).unwrap(); + s.execute("layer.new.layer", json!({"name": "Tip"})).unwrap(); + s.edit("BrushSrc", |doc, active| { + doc.layer_mut(active.unwrap()).unwrap().surface_mut().unwrap().fill_rect(Rect::new(10, 10, 30, 25), &[0.0, 0.0, 0.0, 1.0]); + Ok(()) + }) + .unwrap(); + s +} + +fn target(s: &mut Session, channel: Value) { + s.execute("channel.target", json!({"channel": channel})).unwrap(); +} + +/// The brush, the brush presets, the pattern library and the document, to show that a refusal changes none of them. +fn snapshot(s: &Session) -> (BrushSettings, Vec, usize, usize) { + let patterns = s.patterns.items.len(); + ((*s.tools.brush).clone(), s.tools.presets.to_vec(), patterns, s.active().unwrap().history.past_len()) +} + +fn assert_refused(s: &mut Session, case: &str) { + for command in COMMANDS { + assert!(s.disabled_reason(command).is_some(), "{case}: {command} stays enabled"); + let before = snapshot(s); + assert!(s.execute(command, json!({"name": "Refused"})).is_err(), "{case}: {command} ran"); + assert!(snapshot(s) == before, "{case}: {command} changed the brush, the presets, the patterns or the History"); + } +} + +fn assert_enabled(s: &mut Session, case: &str) { + for command in COMMANDS { + assert_eq!(s.disabled_reason(command), None, "{case}: {command}"); + } +} + +#[test] +fn a_pixel_layers_targeted_mask_greys_them() { + for enabled in [true, false] { + let mut s = document(); + s.execute("layer.layerMask.revealAll", json!({})).unwrap(); + if !enabled { + s.execute("layer.layerMask.enabled", json!({"enabled": false})).unwrap(); + } + target(&mut s, json!("mask")); + assert_refused(&mut s, if enabled { "a pixel layer's mask" } else { "a pixel layer's disabled mask" }); + } +} + +#[test] +fn a_groups_targeted_mask_greys_them() { + let mut s = document(); + s.execute("layer.groupLayers", json!({})).unwrap(); + s.execute("layer.layerMask.revealAll", json!({})).unwrap(); + target(&mut s, json!("mask")); + assert_refused(&mut s, "a group's mask"); +} + +#[test] +fn a_new_adjustment_layer_greys_them_until_its_mask_is_deleted() { + let mut s = document(); + s.execute("layer.newAdjustmentLayer.invert", json!({})).unwrap(); + assert_refused(&mut s, "a new adjustment layer"); + s.execute("layer.layerMask.delete", json!({})).unwrap(); + assert_enabled(&mut s, "the adjustment layer without its mask"); +} + +/// Back on the composite, the items work as before and make the same tip as a document that never targeted a mask. +#[test] +fn targeting_the_composite_again_enables_them_with_the_same_tip() { + let mut plain = document(); + plain.execute("layer.layerMask.revealAll", json!({})).unwrap(); + target(&mut plain, json!("composite")); + plain.execute("brush.defineFromSelection", json!({"name": "Tip"})).unwrap(); + + let mut s = document(); + s.execute("layer.layerMask.revealAll", json!({})).unwrap(); + target(&mut s, json!("mask")); + assert_refused(&mut s, "the mask"); + target(&mut s, json!("composite")); + assert_enabled(&mut s, "the composite again"); + s.execute("brush.defineFromSelection", json!({"name": "Tip"})).unwrap(); + assert!(s.tools.brush.tip == plain.tools.brush.tip, "the tip is the one made without a mask target"); + s.execute("edit.definePattern", json!({"name": "Pattern"})).unwrap(); +} + +/// Not a layer mask target: these keep today's gates. +#[test] +fn other_targets_and_layer_kinds_stay_enabled() { + // A pixel layer with a mask, the composite targeted. + let mut s = document(); + s.execute("layer.layerMask.revealAll", json!({})).unwrap(); + assert_enabled(&mut s, "a masked pixel layer, composite targeted"); + + // An alpha channel, and Quick Mask. + s.execute("channel.new", json!({})).unwrap(); + target(&mut s, json!({"alpha": 0})); + assert_enabled(&mut s, "an alpha channel"); + target(&mut s, json!("composite")); + s.execute("select.editInQuickMaskMode", json!({})).unwrap(); + assert_enabled(&mut s, "Quick Mask"); + + // A locked layer, a group, the Background and a Solid Color fill layer with its mask. + let mut s = document(); + s.execute("layer.setProps", json!({"locks": {"all": true}})).unwrap(); + assert_enabled(&mut s, "a locked layer"); + let mut s = document(); + s.execute("layer.groupLayers", json!({})).unwrap(); + assert_enabled(&mut s, "a group"); + let background = s.active().unwrap().doc.layers[0].id; + s.execute("layer.select", json!({"layer": background.0})).unwrap(); + assert_enabled(&mut s, "the Background"); + s.execute("layer.newFillLayer.solidColor", json!({"color": "#336699"})).unwrap(); + assert_enabled(&mut s, "a Solid Color fill layer"); +} From 254e334dd0b093e96e070f4022750b422d7ccf6e Mon Sep 17 00:00:00 2001 From: dholzric Date: Tue, 1 Dec 2026 14:40:47 -0600 Subject: [PATCH 45/61] Define Brush Preset: number "Sampled Brush N" from a session counter (#18228) The default name was numbered from the presets whose name starts with "Sampled Brush", so deleting the defaults restarted the count and a typed or imported "Sampled Brush" name raised it. ToolState now counts the defaults stored this session; the counter rises only after the preset is stored and is not saved to settings. Co-Authored-By: Claude Opus 5.5 --- .../src/cmd/edit_menu_cmds/presets.rs | 16 ++-- crates/engine-core/src/doc_state.rs | 4 + .../tests/it/define_brush_sampled_number.rs | 76 +++++++++++++++++++ crates/engine/tests/it/main.rs | 1 + 4 files changed, 89 insertions(+), 8 deletions(-) create mode 100644 crates/engine/tests/it/define_brush_sampled_number.rs diff --git a/crates/engine-core/src/cmd/edit_menu_cmds/presets.rs b/crates/engine-core/src/cmd/edit_menu_cmds/presets.rs index a40737910f5..5310f4f7f39 100644 --- a/crates/engine-core/src/cmd/edit_menu_cmds/presets.rs +++ b/crates/engine-core/src/cmd/edit_menu_cmds/presets.rs @@ -5,14 +5,14 @@ use photocraft_doc::vector::PathOp; // ------------------------------------------------------------------ Define Brush / Custom Shape pub(super) fn define_brush_preset(s: &mut Session, p: &Value) -> Result { - let name = match p.get("name").and_then(Value::as_str).map(str::trim).filter(|n| !n.is_empty()) { - Some(n) => n.to_string(), - None => { - let n = s.tools.presets.iter().filter(|b| b.name.starts_with("Sampled Brush")).count() + 1; - format!("Sampled Brush {n}") - } - }; - s.execute("brush.defineFromSelection", json!({"name": name})) + let typed = p.get("name").and_then(Value::as_str).map(str::trim).filter(|n| !n.is_empty()); + // The default counts the defaults stored this session; presets that merely share the name don't count (#18228). + let name = typed.map_or_else(|| format!("Sampled Brush {}", s.tools.sampled_brushes.saturating_add(1)), str::to_string); + let defined = s.execute("brush.defineFromSelection", json!({"name": name}))?; + if typed.is_none() { + s.tools.sampled_brushes = s.tools.sampled_brushes.saturating_add(1); + } + Ok(defined) } /// The path Define Custom Shape uses: `"work"`, a saved path name, else the work path, the diff --git a/crates/engine-core/src/doc_state.rs b/crates/engine-core/src/doc_state.rs index 836c5837b6e..8a5f7604c6e 100644 --- a/crates/engine-core/src/doc_state.rs +++ b/crates/engine-core/src/doc_state.rs @@ -412,6 +412,9 @@ pub struct ToolState { /// The pair Quick Mask put aside, with its CMYK roles: the Quick Mask pair outside Quick /// Mask, the pixel (or layer mask) pair inside it (#17490). pub quick_mask_aside: ([[f32; 4]; 2], CmykPair), + /// How many "Sampled Brush N" defaults Define Brush Preset stored in this session, which gives the next N. Deleting + /// or renaming those presets doesn't lower it, and is not saved to settings (#18228). + pub sampled_brushes: u32, } /// Native CMYK inks associated with each color role. @@ -565,6 +568,7 @@ impl Default for ToolState { cmyk_roles: [[None; 2]; 2], quick_mask_on: false, quick_mask_aside: (Self::MASK_COLORS, [None; 2]), + sampled_brushes: 0, } } } diff --git a/crates/engine/tests/it/define_brush_sampled_number.rs b/crates/engine/tests/it/define_brush_sampled_number.rs new file mode 100644 index 00000000000..7eabea6fdef --- /dev/null +++ b/crates/engine/tests/it/define_brush_sampled_number.rs @@ -0,0 +1,76 @@ +//! #18228 (Edit › Define Brush Preset runs the brush command of `photocraft-engine-paint`, so this runs here): Define Brush Preset's "Sampled Brush N" default counts the defaults stored in this session. Deleting or +//! renaming presets does not lower N, and a preset with such a name from elsewhere (a typed name, an imported set) does +//! not raise it. A call that stores nothing leaves N as it is. + +use serde_json::{Value, json}; + +use photocraft_engine::Session; + +const DEFINE: &str = "edit.defineBrushPreset"; + +/// Opens a new white document with a black rectangle on a layer, ready for Define Brush Preset. +fn new_document(s: &mut Session) { + s.execute("file.new", json!({"width": 40, "height": 30, "background": "#ffffff"})).unwrap(); + s.execute("layer.new.layer", json!({})).unwrap(); + s.edit("BrushSrc", |doc, active| { + doc.layer_mut(active.unwrap()).unwrap().surface_mut().unwrap().fill_rect(photocraft_geom::Rect::new(5, 5, 20, 15), &[0.0, 0.0, 0.0, 1.0]); + Ok(()) + }) + .unwrap(); +} + +/// Defines a brush with `params` and returns the name it was stored under. +fn define(s: &mut Session, params: Value) -> String { + s.execute(DEFINE, params).unwrap(); + s.tools.current_preset.clone().expect("the new preset is the current brush") +} + +fn session() -> Session { + let mut s = Session::new(); + new_document(&mut s); + s +} + +#[test] +fn each_stored_default_raises_the_number() { + let mut s = session(); + let mut names = vec![define(&mut s, json!({}))]; + for _ in 0..2 { + new_document(&mut s); + names.push(define(&mut s, json!({}))); + } + assert_eq!(names, ["Sampled Brush 1", "Sampled Brush 2", "Sampled Brush 3"]); +} + +#[test] +fn deleting_or_renaming_the_presets_does_not_lower_it() { + let mut s = session(); + let names: Vec = (0..3).map(|_| define(&mut s, json!({}))).collect(); + for name in &names { + s.execute("brush.presets.delete", json!({"name": name})).unwrap(); + } + assert_eq!(define(&mut s, json!({})), "Sampled Brush 4", "after deleting presets 1-3"); + + let mut s = session(); + let first = define(&mut s, json!({})); + s.execute("brush.presets.rename", json!({"name": first, "newName": "Renamed"})).unwrap(); + assert_eq!(define(&mut s, json!({})), "Sampled Brush 2", "after renaming preset 1"); +} + +/// A preset named "Sampled Brush …" that the default did not make, such as a typed name, does not count. +#[test] +fn a_typed_sampled_brush_name_does_not_move_it() { + let mut s = session(); + assert_eq!(define(&mut s, json!({"name": "Sampled Brush 7"})), "Sampled Brush 7"); + assert_eq!(define(&mut s, json!({"name": "Sampled Brush 1"})), "Sampled Brush 1"); + assert_eq!(define(&mut s, json!({})), "Sampled Brush 1", "the first default"); +} + +/// A call that stores no preset leaves the number as it is. +#[test] +fn a_refused_call_does_not_raise_it() { + let mut s = Session::new(); + assert!(s.execute(DEFINE, json!({})).is_err(), "no document"); + new_document(&mut s); + assert_eq!(define(&mut s, json!({})), "Sampled Brush 1"); +} diff --git a/crates/engine/tests/it/main.rs b/crates/engine/tests/it/main.rs index 74e8fba6dd7..4bc6b06e838 100644 --- a/crates/engine/tests/it/main.rs +++ b/crates/engine/tests/it/main.rs @@ -66,6 +66,7 @@ mod crop_content_aware_layers; mod crop_delete_off_background; mod csh_import; mod current_affinity_artboards; +mod define_brush_sampled_number; mod duplicate_layer_comps; mod duplicate_slices; mod duplicate_variables; From d7234fdb142acd1c324846934712572ee525cdaf Mon Sep 17 00:00:00 2001 From: Codex Date: Tue, 1 Dec 2026 22:43:28 +0200 Subject: [PATCH 46/61] fix(ui): make the Gradient tool icon show a visible ramp --- ATTRIBUTION.md | 1 + assets/icons/gradient-tool.svg | 9 +++++++++ crates/ui-egui/src/icon_data.rs | 1 + crates/ui-egui/src/panels/tool_commands.rs | 2 +- 4 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 assets/icons/gradient-tool.svg diff --git a/ATTRIBUTION.md b/ATTRIBUTION.md index 6b028524c1f..e519e6d4fb9 100644 --- a/ATTRIBUTION.md +++ b/ATTRIBUTION.md @@ -17,6 +17,7 @@ next to them. | `assets/icons/{arrow-left-right,circle-dashed,ellipsis,file-plus,folder-plus,grid-2x2,house,link-2,message-square,panel-left,pipette,rectangle-horizontal,rectangle-vertical,redo-2,square-dashed,square-dashed-mouse-pointer,triangle-alert,type,x}.svg` | Lucide icons | Lucide Icons and Contributors | (`icons/.svg`) | ISC, [`assets/icons/LICENSE-lucide.txt`](assets/icons/LICENSE-lucide.txt) | | `assets/icons/{link-2,type,x}.svg` | Lucide icons derived from Feather (subset of the row above) | Cole Bemis (Feather), Lucide Contributors | via Lucide | MIT (Feather) and ISC (Lucide), [`assets/icons/LICENSE-lucide.txt`](assets/icons/LICENSE-lucide.txt) | | `assets/icons/vector-shape.svg` | Vector path shape-layer glyph with four anchor points | @superplay2021 | Original work for PhotoCraft | MIT OR Apache-2.0 | +| `assets/icons/gradient-tool.svg` | Gradient tool glyph with a horizontal opacity ramp | PhotoCraft contributors | Original work | MIT OR Apache-2.0 | | `assets/icons/spirit-level.svg` | Straighten tool glyph: a spirit level with its vial and bubble under a dotted arc | PhotoCraft contributors | Original work | MIT OR Apache-2.0 | | `assets/icons/type-vertical.svg` | Vertical Type tool glyph: Lucide `type`'s T, drawn narrower to make room for a downward arrow of our own at its left | Lucide Icons and Contributors; arrow by PhotoCraft contributors | Derived from `icons/type.svg` | ISC, [`assets/icons/LICENSE-lucide.txt`](assets/icons/LICENSE-lucide.txt) | | `assets/icons/path-op-{new-layer,combine,subtract,intersect,exclude,merge}.svg` | Path Operations glyphs (Pen options bar): a single square for New Layer, and two overlapping squares showing the area each operation keeps (union, back minus front, overlap, everything but the overlap, the merged outline), drawn on Lucide's 24 px grid and stroke | PhotoCraft contributors | Original work | MIT OR Apache-2.0 | diff --git a/assets/icons/gradient-tool.svg b/assets/icons/gradient-tool.svg new file mode 100644 index 00000000000..fb0a2d0a43b --- /dev/null +++ b/assets/icons/gradient-tool.svg @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/crates/ui-egui/src/icon_data.rs b/crates/ui-egui/src/icon_data.rs index f630565fb1e..d1c4a07fb1f 100644 --- a/crates/ui-egui/src/icon_data.rs +++ b/crates/ui-egui/src/icon_data.rs @@ -23,6 +23,7 @@ pub static ICONS: &[(&str, &[u8])] = &[ ("ellipsis", include_bytes!("../../../assets/icons/ellipsis.svg")), ("file-plus", include_bytes!("../../../assets/icons/file-plus.svg")), ("folder-plus", include_bytes!("../../../assets/icons/folder-plus.svg")), + ("gradient-tool", include_bytes!("../../../assets/icons/gradient-tool.svg")), ("grid-2x2", include_bytes!("../../../assets/icons/grid-2x2.svg")), ("history-brush", include_bytes!("../../../assets/icons/history-brush.svg")), ("house", include_bytes!("../../../assets/icons/house.svg")), diff --git a/crates/ui-egui/src/panels/tool_commands.rs b/crates/ui-egui/src/panels/tool_commands.rs index d70707bee80..429c0a6842d 100644 --- a/crates/ui-egui/src/panels/tool_commands.rs +++ b/crates/ui-egui/src/panels/tool_commands.rs @@ -63,7 +63,7 @@ pub(crate) enum ToolCommand { BackgroundEraser, #[command(label = "Magic Eraser Tool", icon = "eraser_magic", kind = "tool", group = "E", default = "E", alias = "tools.select.magicEraser")] MagicEraser, - #[command(label = "Gradient Tool", icon = "gradient", kind = "tool", group = "G", default = "G", alias = "tools.select.gradient")] + #[command(label = "Gradient Tool", icon = "gradient-tool", kind = "tool", group = "G", default = "G", alias = "tools.select.gradient")] Gradient, #[command(label = "Paint Bucket Tool", icon = "paint_bucket", kind = "tool", group = "G", default = "G", alias = "tools.select.paintBucket")] PaintBucket, From 7a022d34bd7d67196478be7699e317a7bc865366 Mon Sep 17 00:00:00 2001 From: Terra854 Date: Wed, 2 Dec 2026 04:48:47 +0800 Subject: [PATCH 47/61] Read Actual Size display dimensions from validated monitor EDID --- Cargo.lock | 2 + crates/ui-egui/Cargo.toml | 2 +- crates/ui-egui/src/menus/view_cmds.rs | 2 +- .../src/menus/view_cmds/actual_size.rs | 97 +++++++++++++++++-- .../src/menus/view_cmds/actual_size_tests.rs | 60 +++++++++++- 5 files changed, 152 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 980c2438d55..3f47ef1ed5a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -7103,6 +7103,7 @@ version = "0.23.1" dependencies = [ "base64 0.23.1", "chrono", + "core-graphics", "craft", "craft-file-formats", "craft-i18n", @@ -7141,6 +7142,7 @@ dependencies = [ "toml", "web-time", "winsafe", + "x11rb", ] [[package]] diff --git a/crates/ui-egui/Cargo.toml b/crates/ui-egui/Cargo.toml index ea1b797f301..68e4fb0815b 100644 --- a/crates/ui-egui/Cargo.toml +++ b/crates/ui-egui/Cargo.toml @@ -69,7 +69,7 @@ sys-locale = "=0.3.2" # symbol (`i18n::decimal_separator`, a registry read): the safe binding the desktop app already # uses, pinned to the same version. [target.'cfg(target_os = "windows")'.dependencies] -winsafe = { version = "=0.0.29", default-features = false, features = ["kernel", "dxgi", "advapi", "gdi", "user"] } +winsafe = { version = "=0.0.29", default-features = false, features = ["kernel", "dxgi", "advapi", "user"] } # Safe physical display dimensions for View > Actual Size. Both are already in the lockfile. [target.'cfg(target_os = "macos")'.dependencies] diff --git a/crates/ui-egui/src/menus/view_cmds.rs b/crates/ui-egui/src/menus/view_cmds.rs index 053535a089c..c1660827636 100644 --- a/crates/ui-egui/src/menus/view_cmds.rs +++ b/crates/ui-egui/src/menus/view_cmds.rs @@ -13,8 +13,8 @@ use serde_json::{Map, Value, json}; use crate::PhotocraftApp; -mod arrange; mod actual_size; +mod arrange; pub(crate) mod dialogs; mod dispatch; mod options; diff --git a/crates/ui-egui/src/menus/view_cmds/actual_size.rs b/crates/ui-egui/src/menus/view_cmds/actual_size.rs index 6da565197d8..976202e48c4 100644 --- a/crates/ui-egui/src/menus/view_cmds/actual_size.rs +++ b/crates/ui-egui/src/menus/view_cmds/actual_size.rs @@ -59,7 +59,7 @@ pub(super) fn physical_ppi(pixels: f64, millimeters: f64) -> Option { #[cfg(target_os = "windows")] fn display_ppi(ctx: &egui::Context) -> Option { - use winsafe::{HWND, prelude::*}; + use winsafe::{HDC, prelude::*}; let rect = ctx.input(|input| input.viewport().outer_rect)?; let scale = f64::from(ctx.pixels_per_point()); @@ -67,18 +67,19 @@ fn display_ppi(ctx: &egui::Context) -> Option { if !window.iter().all(|value| value.is_finite()) { return None; } - let desktop = HWND::NULL.GetDC().ok()?; let mut best = (0.0, None); - desktop - .EnumDisplayMonitors(None, |_, device, rect| { + HDC::NULL + .EnumDisplayMonitors(None, |monitor, _, rect| { let width = (window[2].min(f64::from(rect.right)) - window[0].max(f64::from(rect.left))).max(0.0); let height = (window[3].min(f64::from(rect.bottom)) - window[1].max(f64::from(rect.top))).max(0.0); let area = width * height; if area > best.0 { - best = ( - area, - physical_ppi(f64::from(device.GetDeviceCaps(winsafe::co::GDC::HORZRES)), f64::from(device.GetDeviceCaps(winsafe::co::GDC::HORZSIZE))), - ); + let ppi = monitor + .GetMonitorInfo() + .ok() + .and_then(|info| windows_monitor_width(&info.szDevice())) + .and_then(|millimeters| physical_ppi(f64::from(rect.right) - f64::from(rect.left), millimeters)); + best = (area, ppi); } true }) @@ -86,6 +87,86 @@ fn display_ppi(ctx: &egui::Context) -> Option { best.1 } +/// GDI's HORZSIZE can be synthesized from 96 DPI on WDDM. Read the monitor's EDID instead. +#[cfg(target_os = "windows")] +fn windows_monitor_width(device: &str) -> Option { + use winsafe::{HKEY, RegistryValue, co}; + + let mut result = None; + for monitor in winsafe::EnumDisplayDevices(Some(device), Some(co::EDD::GET_DEVICE_INTERFACE_NAME)).take(64) { + let monitor = monitor.ok()?; + let path = monitor_registry_path(&monitor.DeviceID())?; + let key = HKEY::LOCAL_MACHINE.RegOpenKeyEx(Some(&path), co::REG_OPTION::default(), co::KEY::READ).ok()?; + let override_key = key.RegOpenKeyEx(Some("EDID_OVERRIDE"), co::REG_OPTION::default(), co::KEY::READ).ok(); + let value = match override_key.as_ref().map(|override_key| windows_edid_value(override_key, "0")) { + Some(Ok(value)) => value, + Some(Err(error)) if error != co::ERROR::FILE_NOT_FOUND => return None, + _ => windows_edid_value(&key, "EDID").ok()?, + }; + let RegistryValue::Binary(edid) = value else { return None }; + let width = edid_width(&edid)?; + // Mirrored outputs must agree on physical size before one scale can describe both. + if result.is_some_and(|previous: f64| (previous - width).abs() > 0.5) { + return None; + } + result = Some(width); + } + result +} + +#[cfg(target_os = "windows")] +fn windows_edid_value(key: &winsafe::HKEY, value: &str) -> Result { + // Registry EDIDs are small. Bound the safe binding's allocation before asking for the value. + let mut maximum = 0; + key.RegQueryInfoKey(None, None, None, None, None, None, Some(&mut maximum), None, None)?; + if maximum > 32768 { + return Err(winsafe::co::ERROR::INVALID_DATA); + } + key.RegQueryValueEx(Some(value)) +} + +#[cfg(any(test, target_os = "windows"))] +pub(super) fn monitor_registry_path(interface: &str) -> Option { + let mut parts = interface.strip_prefix(r"\\?\")?.split('#'); + if !parts.next()?.eq_ignore_ascii_case("DISPLAY") { + return None; + } + let model = parts.next()?; + let instance = parts.next()?; + let class = parts.next()?; + if parts.next().is_some() || !class.eq_ignore_ascii_case("{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}") { + return None; + } + let safe_component = + |value: &str| !value.is_empty() && value.len() <= 256 && value.bytes().all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b'&' | b'_' | b'-')); + if !safe_component(model) || !safe_component(instance) { + return None; + } + Some(format!(r"SYSTEM\CurrentControlSet\Enum\DISPLAY\{model}\{instance}\Device Parameters")) +} + +#[cfg(any(test, target_os = "windows"))] +pub(super) fn edid_width(edid: &[u8]) -> Option { + let base = edid.get(..128)?; + if base.get(..8)? != [0, 255, 255, 255, 255, 255, 255, 0] || base.iter().fold(0u8, |sum, value| sum.wrapping_add(*value)) != 0 { + return None; + } + // EDID detailed timing descriptors carry millimetres, with the high bits shared at byte 14. + for timing in base.get(54..126)?.chunks_exact(18) { + if timing.get(..2)? == [0, 0] { + continue; + } + let width = u16::from(*timing.get(12)?) | (u16::from(*timing.get(14)? & 0xf0) << 4); + let height = u16::from(*timing.get(13)?) | (u16::from(*timing.get(14)? & 0x0f) << 8); + if width > 0 && height > 0 { + return Some(f64::from(width)); + } + } + let width = *base.get(21)?; + let height = *base.get(22)?; + (width > 0 && height > 0).then_some(f64::from(width) * 10.0) +} + #[cfg(target_os = "macos")] fn display_ppi(ctx: &egui::Context) -> Option { use core_graphics::display::CGDisplay; diff --git a/crates/ui-egui/src/menus/view_cmds/actual_size_tests.rs b/crates/ui-egui/src/menus/view_cmds/actual_size_tests.rs index 3c68653acff..e874c7bcac0 100644 --- a/crates/ui-egui/src/menus/view_cmds/actual_size_tests.rs +++ b/crates/ui-egui/src/menus/view_cmds/actual_size_tests.rs @@ -1,4 +1,4 @@ -use super::actual_size::{apply, physical_ppi}; +use super::actual_size::{apply, edid_width, monitor_registry_path, physical_ppi}; use crate::{PhotocraftApp, Services}; use photocraft_engine::Session; use serde_json::json; @@ -75,3 +75,61 @@ fn actual_size_rejects_bad_parameters_and_unusable_metrics() { assert_eq!(apply(&mut app, ppi, &json!({})).unwrap()["fallback"], true); } } + +#[test] +fn actual_size_remains_unsnapped_on_the_canvas_then_uses_the_next_zoom_rung() { + let mut app = PhotocraftApp::new(Session::new(), Services::default()); + app.run("file.new", json!({"width": 3000, "height": 2000})).unwrap(); + crate::canvas::testing::frame(&mut app); + app.ui.views[0].center = [1500.0, 1000.0]; + apply(&mut app, Some(95.8), &json!({})).unwrap(); + crate::canvas::testing::frame(&mut app); + assert!((app.ui.views[0].zoom - 95.0 / 72.0).abs() < 1e-6); + assert_eq!(app.ui.views[0].center, [1500.0, 1000.0]); + let ctx = app.ctx().clone(); + crate::menus::invoke(&mut app, &ctx, "view.zoomIn", json!({})).unwrap(); + crate::canvas::testing::frame(&mut app); + assert_eq!(app.ui.views[0].zoom, 2.0); +} + +#[test] +fn actual_size_reads_validated_edid_physical_dimensions() { + let mut edid = [0u8; 128]; + edid[..8].copy_from_slice(&[0, 255, 255, 255, 255, 255, 255, 0]); + edid[21] = 51; + edid[22] = 29; + edid[54] = 1; + edid[66] = 253; + edid[67] = 30; + edid[68] = 0x11; + edid[127] = 0u8.wrapping_sub(edid.iter().copied().fold(0u8, u8::wrapping_add)); + assert_eq!(edid_width(&edid), Some(509.0)); + assert_eq!(physical_ppi(1920.0, edid_width(&edid).unwrap()), Some(95.0)); + for length in 0..128 { + assert_eq!(edid_width(&edid[..length]), None); + } + edid[54] = 0; + edid[127] = edid[127].wrapping_add(1); + assert_eq!(edid_width(&edid), Some(510.0), "centimetres when detailed dimensions are absent"); + edid[21] = 0; + edid[127] = edid[127].wrapping_add(51); + assert_eq!(edid_width(&edid), None, "an aspect ratio has no physical width"); + edid[1] = 0; + assert_eq!(edid_width(&edid), None, "corrupt headers are unavailable"); +} + +#[test] +fn actual_size_maps_only_recognized_monitor_interfaces_to_edid_keys() { + assert_eq!( + monitor_registry_path(r"\\?\DISPLAY#MODEL01#5&0000&0&UID1#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}"), + Some(r"SYSTEM\CurrentControlSet\Enum\DISPLAY\MODEL01\5&0000&0&UID1\Device Parameters".into()) + ); + for interface in [ + "", + r"\\?\DISPLAY#MODEL01", + r"\\?\OTHER#MODEL01#INSTANCE#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}", + r"\\?\DISPLAY#..\MODEL01#INSTANCE#{e6f07b5f-ee97-4a90-b076-33f57bf4eaa7}", + ] { + assert_eq!(monitor_registry_path(interface), None); + } +} From 26946de006a0c46031f4de59633497c27cb49efb Mon Sep 17 00:00:00 2001 From: Codex Date: Tue, 1 Dec 2026 23:24:46 +0200 Subject: [PATCH 48/61] fix(ui): clarify the dark-to-light Gradient icon ramp --- assets/icons/gradient-tool.svg | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/icons/gradient-tool.svg b/assets/icons/gradient-tool.svg index fb0a2d0a43b..94516fd712c 100644 --- a/assets/icons/gradient-tool.svg +++ b/assets/icons/gradient-tool.svg @@ -1,8 +1,9 @@ + - + From 2ad7b18c45499da0b1235f881605c38192d29d7a Mon Sep 17 00:00:00 2001 From: Terra854 Date: Wed, 2 Dec 2026 05:26:11 +0800 Subject: [PATCH 49/61] fix(hand): honor scroll all windows checkbox --- crates/ui-egui/src/canvas/document_display.rs | 7 +- .../canvas/hand_scroll_all_windows_tests.rs | 145 ++++++++++++++++++ 2 files changed, 151 insertions(+), 1 deletion(-) create mode 100644 crates/ui-egui/src/canvas/hand_scroll_all_windows_tests.rs diff --git a/crates/ui-egui/src/canvas/document_display.rs b/crates/ui-egui/src/canvas/document_display.rs index e0c6df2c2ec..08e063d974f 100644 --- a/crates/ui-egui/src/canvas/document_display.rs +++ b/crates/ui-egui/src/canvas/document_display.rs @@ -28,6 +28,10 @@ use photocraft_geom::Rect as DRect; #[path = "layer_edges_drawing_tests.rs"] mod layer_edges_drawing_tests; +#[cfg(test)] +#[path = "hand_scroll_all_windows_tests.rs"] +mod hand_scroll_all_windows_tests; + impl View { /// This view as the framework's canvas view of `rect` at `ppp` device pixels per point, mirrored by View › Flip /// Horizontal and stretched by View › Pixel Aspect Ratio Correction. @@ -146,7 +150,7 @@ pub(crate) fn view_follows_pointer(app: &PhotocraftApp, idx: usize) -> bool { crate::crop_ui::moves_view(app) && app.session.active_index() == Some(idx) } -/// The user's navigation choices from Preferences (General, Tools, Enhanced Controls). +/// The user's navigation preferences and Hand tool option. pub(crate) fn navigation(app: &PhotocraftApp) -> NavigationOptions { let p = app.session.prefs(); let mut options = NavigationOptions::default(); @@ -154,6 +158,7 @@ pub(crate) fn navigation(app: &PhotocraftApp) -> NavigationOptions { options.animated_zoom = p.general.animated_zoom; options.zoom_clicked_point_to_center = p.tools.zoom_clicked_point_to_center; options.flick_panning = p.tools.enable_flick_panning; + options.scroll_all_windows = app.ui.tool_options.hand_scroll_all; options.overscroll = p.tools.overscroll; options.pinch_zooms = p.enhanced_controls.zoom_with_trackpad_pinch; options.trackpad_rotate = p.enhanced_controls.rotate_view_with_trackpad; diff --git a/crates/ui-egui/src/canvas/hand_scroll_all_windows_tests.rs b/crates/ui-egui/src/canvas/hand_scroll_all_windows_tests.rs new file mode 100644 index 00000000000..15888b21ccf --- /dev/null +++ b/crates/ui-egui/src/canvas/hand_scroll_all_windows_tests.rs @@ -0,0 +1,145 @@ +//! #12023 exercises the Hand options and gestures through the application window. + +use craft::ui::canvas::ToolHost; +use egui::accesskit::{Role, Toggled}; +use egui::{Event, Modifiers, PointerButton, Vec2, vec2}; +use egui_kittest::Harness; +use egui_kittest::kittest::{NodeT, Queryable}; +use serde_json::json; + +use super::CanvasHost; +use crate::state::{Tool, ToolOptions}; +use crate::{PhotocraftApp, Services}; + +type Window = Harness<'static, Box>; + +/// Two shown 3000 × 2000 documents, at 100% and 50%, with the second one active. +fn window() -> Window { + let mut window = Harness::builder().with_size(vec2(1400.0, 900.0)).with_pixels_per_point(1.0).build_eframe(|cc| { + PhotocraftApp::setup_context(&cc.egui_ctx, Default::default()); + let mut app = PhotocraftApp::with_context(cc.egui_ctx.clone(), photocraft_engine::Session::new(), Services::default()); + app.background_jobs = false; + for name in ["oracle", "second"] { + app.run("file.new", json!({"width": 3000, "height": 2000, "name": name})).unwrap(); + } + app.ui.tool = Tool::Hand; + app.session.prefs.edit(|prefs| { + prefs.tools.enable_flick_panning = false; + prefs.general.animated_zoom = false; + }); + app + }); + window.run_steps(6); + let ctx = window.ctx.clone(); + crate::menus::invoke(window.state_mut(), &ctx, "window.arrange.twoUpVertical", json!({})).unwrap(); + window.run_steps(6); + for (view, zoom) in window.state_mut().ui.views.iter_mut().zip([1.0, 0.5]) { + view.zoom = zoom; + view.center = [1500.0, 1000.0]; + view.clear_pending(); + } + window.run_steps(4); + assert_eq!(window.state().session.active_index(), Some(1)); + assert_eq!(window.ctx.pixels_per_point(), 1.0); + window +} + +fn cameras(window: &Window) -> Vec<(f32, [f32; 2])> { + window.state().ui.views.iter().map(|view| (view.zoom, view.center)).collect() +} + +fn history_lengths(window: &Window) -> Vec { + window.state().session.documents().iter().map(|state| state.history.entries().len()).collect() +} + +fn enable_scroll_all(window: &mut Window) { + let checkbox = window.get_by_role_and_label(Role::CheckBox, "Scroll All Windows"); + assert_eq!(checkbox.accesskit_node().toggled(), Some(Toggled::False)); + checkbox.click(); + window.run_steps(3); + assert!(window.state().ui.tool_options.hand_scroll_all); + assert_eq!(window.get_by_role_and_label(Role::CheckBox, "Scroll All Windows").accesskit_node().toggled(), Some(Toggled::True)); +} + +/// A fixed screen-space gesture, so following a changing camera cannot add a second movement. +fn drag_second(window: &mut Window, modifiers: Modifiers) { + let source = ToolHost::shown_space(&window.ctx, CanvasHost::main(1).canvas_id()).expect("the active tile is shown").view; + let start = source.rect.center(); + let delta = vec2(-100.0, -50.0); + window.event(Event::ModifiersChanged(modifiers)); + window.hover_at(start); + window.run_steps(2); + window.event(Event::PointerButton { pos: start, button: PointerButton::Primary, pressed: true, modifiers }); + window.run_steps(2); + for fraction in [0.25, 0.5, 0.75, 1.0] { + window.event(Event::ModifiersChanged(modifiers)); + window.hover_at(start + delta * fraction); + window.run_steps(1); + } + window.event(Event::PointerButton { pos: start + delta, button: PointerButton::Primary, pressed: false, modifiers }); + window.run_steps(3); + window.event(Event::ModifiersChanged(Modifiers::NONE)); + window.run_steps(1); +} + +fn assert_moved(before: (f32, [f32; 2]), after: (f32, [f32; 2]), expected: Vec2) { + assert_eq!(after.0, before.0, "a Hand drag keeps each view's zoom"); + let delta = vec2(after.1[0] - before.1[0], after.1[1] - before.1[1]); + assert!((delta - expected).length() < 1e-3, "expected {expected:?} document pixels, got {delta:?}"); +} + +#[test] +fn checkbox_is_saved_without_history_and_pans_both_views_in_image_pixels() { + let mut window = window(); + assert!(!window.state().ui.tool_options.hand_scroll_all); + let history = history_lengths(&window); + enable_scroll_all(&mut window); + let saved = serde_json::to_value(&*window.state().ui.tool_options).unwrap(); + let restored: ToolOptions = serde_json::from_value(saved).unwrap(); + assert!(restored.hand_scroll_all, "the option persists with the other tool options"); + assert_eq!(history_lengths(&window), history, "ticking the checkbox adds no history state"); + let before = cameras(&window); + drag_second(&mut window, Modifiers::NONE); + let after = cameras(&window); + assert_moved(before[1], after[1], vec2(200.0, 100.0)); + assert_moved(before[0], after[0], vec2(200.0, 100.0)); + assert_eq!(history_lengths(&window), history, "panning adds no history state"); +} + +#[test] +fn shift_drag_pans_both_views_by_the_same_image_distance() { + let mut window = window(); + let before = cameras(&window); + drag_second(&mut window, Modifiers::SHIFT); + let after = cameras(&window); + assert_moved(before[1], after[1], vec2(200.0, 100.0)); + assert_moved(before[0], after[0], vec2(200.0, 100.0)); + assert!(!window.state().ui.tool_options.hand_scroll_all); +} + +#[test] +fn checkbox_off_without_shift_pans_only_the_dragged_view() { + let mut window = window(); + let before = cameras(&window); + drag_second(&mut window, Modifiers::NONE); + let after = cameras(&window); + assert_moved(before[1], after[1], vec2(200.0, 100.0)); + assert_eq!(after[0], before[0]); +} + +#[test] +fn hand_zoom_buttons_change_only_the_active_view_with_scroll_all_on() { + for label in ["100%", "Fit Screen", "Fill Screen"] { + let mut window = window(); + enable_scroll_all(&mut window); + let before = cameras(&window); + let history = history_lengths(&window); + window.get_by_role_and_label(Role::Button, label).click(); + window.run_steps(5); + let after = cameras(&window); + assert_eq!(after[0], before[0], "{label} leaves the other view unchanged"); + assert_ne!(after[1].0, before[1].0, "{label} changes the active view's zoom"); + assert_eq!(history_lengths(&window), history, "{label} adds no history state"); + assert!(window.state().ui.tool_options.hand_scroll_all); + } +} From 91855750a9bc12d2aed518cfad636ae731f918da Mon Sep 17 00:00:00 2001 From: Terra854 Date: Wed, 2 Dec 2026 05:32:01 +0800 Subject: [PATCH 50/61] fix(view): use array chunks for EDID timing descriptors --- crates/ui-egui/src/menus/view_cmds/actual_size.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/ui-egui/src/menus/view_cmds/actual_size.rs b/crates/ui-egui/src/menus/view_cmds/actual_size.rs index 976202e48c4..1e863fb60d5 100644 --- a/crates/ui-egui/src/menus/view_cmds/actual_size.rs +++ b/crates/ui-egui/src/menus/view_cmds/actual_size.rs @@ -152,7 +152,7 @@ pub(super) fn edid_width(edid: &[u8]) -> Option { return None; } // EDID detailed timing descriptors carry millimetres, with the high bits shared at byte 14. - for timing in base.get(54..126)?.chunks_exact(18) { + for timing in base.get(54..126)?.as_chunks::<18>().0.iter() { if timing.get(..2)? == [0, 0] { continue; } From 1ba9c55f8e4b563e78f65760d5bf048b41aed3f2 Mon Sep 17 00:00:00 2001 From: Terra854 Date: Wed, 2 Dec 2026 05:38:43 +0800 Subject: [PATCH 51/61] Test: drive toolbar double-clicks within the click interval (#18744) --- .../ui-egui/src/panels/toolbar_rotate_view_reset_tests.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/panels/toolbar_rotate_view_reset_tests.rs b/crates/ui-egui/src/panels/toolbar_rotate_view_reset_tests.rs index 64a9e28e8e6..2cc3991808a 100644 --- a/crates/ui-egui/src/panels/toolbar_rotate_view_reset_tests.rs +++ b/crates/ui-egui/src/panels/toolbar_rotate_view_reset_tests.rs @@ -3,12 +3,16 @@ use super::*; use egui::{Modifiers, PointerButton}; use egui_kittest::Harness; -use egui_kittest::kittest::{NodeT, Queryable}; +use egui_kittest::kittest::Queryable; +/// Use 60 Hz frames so two clicks fall inside the double-click interval. fn harness(documents: usize) -> Harness<'static, Box> { - let mut h = Harness::builder().with_size(egui::vec2(1200.0, 1100.0)).with_max_steps(64).build_eframe(move |cc| { + let mut h = Harness::builder().with_step_dt(1.0 / 60.0).with_size(egui::vec2(1200.0, 1100.0)).with_max_steps(64).build_eframe(move |cc| { PhotocraftApp::setup_context(&cc.egui_ctx, crate::theme::AppTheme::pro()); let mut app = PhotocraftApp::with_context(cc.egui_ctx.clone(), photocraft_engine::Session::new(), crate::Services::default()); + app.run("prefs.set", json!({"values": {"general.animatedZoom": false}})).expect("disable zoom animation"); + // Home hides the toolbar, so the empty-document case uses the workspace. + app.session.edit_prefs(|prefs| prefs.general.auto_show_home_screen = false); for _ in 0..documents { app.run("file.new", json!({"width": 3000, "height": 2000})).expect("new document"); } From 519247ccec8b2bd48289018d2a2729a235757753 Mon Sep 17 00:00:00 2001 From: Bobderto <230258561+Bobderto@users.noreply.github.com> Date: Tue, 1 Dec 2026 22:06:19 +0000 Subject: [PATCH 52/61] Match half opacity when drawing a gradient on a layer mask --- crates/engine-paint/src/cmd.rs | 2 + .../cmd/gradient_mask_opacity_half_tests.rs | 85 +++++++++++++++++++ .../src/cmd/gradient_opacity_step_tests.rs | 6 +- crates/engine-paint/src/cmd/paint_cmds.rs | 18 ++-- 4 files changed, 102 insertions(+), 9 deletions(-) create mode 100644 crates/engine-paint/src/cmd/gradient_mask_opacity_half_tests.rs diff --git a/crates/engine-paint/src/cmd.rs b/crates/engine-paint/src/cmd.rs index 757472f0ae0..6d653b80628 100644 --- a/crates/engine-paint/src/cmd.rs +++ b/crates/engine-paint/src/cmd.rs @@ -19,6 +19,8 @@ mod gradient_alpha_method_tests; mod gradient_behind_mode_tests; #[cfg(test)] mod gradient_mask_history_name_tests; +#[cfg(test)] +mod gradient_mask_opacity_half_tests; pub mod paint_cmds; pub mod pick_cmds; pub mod redeye_cmds; diff --git a/crates/engine-paint/src/cmd/gradient_mask_opacity_half_tests.rs b/crates/engine-paint/src/cmd/gradient_mask_opacity_half_tests.rs new file mode 100644 index 00000000000..fce981d0ef3 --- /dev/null +++ b/crates/engine-paint/src/cmd/gradient_mask_opacity_half_tests.rs @@ -0,0 +1,85 @@ +//! #18669: at 50% opacity a gradient covers 128/255 of a layer mask. + +use photocraft_raster::Surface; +use serde_json::{Value, json}; + +use crate::Session; + +fn document(mode: &str, depth: u32) -> Session { + let mut s = crate::session(); + s.execute("file.new", json!({"width": 64, "height": 8, "mode": mode, "depth": depth, "background": "transparent"})).unwrap(); + s +} + +fn gradient(opacity: f64, target: Value, method: Option<&str>) -> Value { + let mut p = json!({"from": [8, 4], "to": [56, 4], "colors": ["#000000", "#ffffff"], "opacity": opacity, "target": target, "dither": false}); + if let Some(method) = method { + p["method"] = json!(method); + } + p +} + +fn target<'a>(s: &'a Session, p: &Value) -> &'a Surface { + let state = s.active().unwrap(); + crate::channel_cmds::read_target_surface(&state.doc, state.active_layer, p).unwrap() +} + +fn layer_mask_row(mode: &str, depth: u32, opacity: f64, method: Option<&str>) -> [f32; 3] { + let mut s = document(mode, depth); + s.execute("layer.layerMask.revealAll", json!({})).unwrap(); + let p = gradient(opacity, json!("mask"), method); + s.execute("paint.gradient", p.clone()).unwrap(); + [4, 32, 60].map(|x| target(&s, &p).pixel(x, 4)[0]) +} + +#[test] +fn half_opacity_leaves_127_levels_of_white_on_the_layer_mask() { + for (mode, depth, step) in [ + ("rgb", 8, 1.0 / 255.0), + ("rgb", 16, 1.0 / 65535.0), + ("rgb", 32, 0.0), + ("gray", 8, 1.0 / 255.0), + ("gray", 16, 1.0 / 65535.0), + ("gray", 32, 0.0), + ("cmyk", 8, 1.0 / 255.0), + ("lab", 8, 1.0 / 255.0), + ] { + // The desktop dispatches the Classic gradient without a method. The report used Smooth. + for method in [None, Some("smooth")] { + let case = format!("{mode}/{depth} {method:?}"); + let [black, middle, white] = layer_mask_row(mode, depth, 50.0, method); + let [full_black, full_middle, full_white] = layer_mask_row(mode, depth, 100.0, method); + assert_eq!(full_black, 0.0, "{case} at full opacity"); + assert!((full_white - 1.0).abs() <= 0.00001, "{case}: white end at full opacity {full_white}"); + assert!((black - 127.0 / 255.0).abs() <= 0.5 * step + 0.00001, "{case}: black end left {black} white"); + let expected_middle = 1.0 - (1.0 - full_middle) * (128.0 / 255.0); + assert!((middle - expected_middle).abs() <= step + 0.00001, "{case}: ramp midpoint {middle}, expected {expected_middle}"); + assert!((white - 1.0).abs() <= 0.00001, "{case}: white end left {white} white"); + } + } +} + +#[test] +fn other_opacity_and_non_layer_mask_targets_keep_the_requested_coverage() { + // Include a value that rounds to 50% after the command converts to f32. + for opacity in [49.9, 50.000_000_1] { + let [black, _, _] = layer_mask_row("rgb", 32, opacity, Some("smooth")); + assert!((f64::from(black) - (1.0 - opacity / 100.0)).abs() < 0.00001, "{opacity}% opacity left {black} white"); + } + + let mut s = document("rgb", 32); + let pixels = gradient(50.0, json!("pixels"), Some("smooth")); + s.execute("paint.gradient", pixels.clone()).unwrap(); + assert!((target(&s, &pixels).pixel(4, 4)[3] - 0.5).abs() < 0.00001, "pixel coverage"); + + s.execute("channel.new", json!({"fill": "white"})).unwrap(); + let alpha = gradient(50.0, json!({"channel": 0}), Some("smooth")); + s.execute("paint.gradient", alpha.clone()).unwrap(); + assert!((target(&s, &alpha).pixel(4, 4)[0] - 0.5).abs() < 0.00001, "saved alpha channel"); + + s.execute("select.all", json!({})).unwrap(); + s.execute("select.editInQuickMaskMode", json!({"on": true})).unwrap(); + let quick_mask = gradient(50.0, json!("quickMask"), Some("smooth")); + s.execute("paint.gradient", quick_mask.clone()).unwrap(); + assert!((target(&s, &quick_mask).pixel(4, 4)[0] - 0.5).abs() < 0.00001, "Quick Mask"); +} diff --git a/crates/engine-paint/src/cmd/gradient_opacity_step_tests.rs b/crates/engine-paint/src/cmd/gradient_opacity_step_tests.rs index 25c7f82dab0..2f4e353fef8 100644 --- a/crates/engine-paint/src/cmd/gradient_opacity_step_tests.rs +++ b/crates/engine-paint/src/cmd/gradient_opacity_step_tests.rs @@ -80,12 +80,12 @@ fn only_explicit_classic_uses_the_half_opacity_step() { } #[test] -fn the_half_opacity_pixel_step_does_not_change_layer_masks() { - let mut s = document("rgb", 32); +fn the_half_opacity_pixel_step_does_not_change_deep_cmyk_layer_masks() { + let mut s = document("cmyk", 16); s.execute("layer.layerMask.revealAll", json!({})).unwrap(); s.execute("paint.gradient", json!({"from": [2, 3], "to": [9, 3], "colors": ["#000000", "#ffffff"], "opacity": 50, "target": "mask", "dither": false})) .unwrap(); let state = s.active().unwrap(); let mask = &state.doc.layer(state.active_layer.unwrap()).unwrap().mask.as_ref().unwrap().surface; - assert_eq!((mask.pixel(2, 3)[0] * 255.0).round(), 128.0); + assert_eq!((mask.pixel(2, 3)[0] * 65535.0).round(), 32768.0); } diff --git a/crates/engine-paint/src/cmd/paint_cmds.rs b/crates/engine-paint/src/cmd/paint_cmds.rs index 73a42f4eeb9..53a8ca04183 100644 --- a/crates/engine-paint/src/cmd/paint_cmds.rs +++ b/crates/engine-paint/src/cmd/paint_cmds.rs @@ -221,12 +221,18 @@ fn gradient(s: &mut Session, p: &Value) -> Result { let dither = b(p, "dither", true); // Photoshop dithers gradients by default (reduces banding). let layer = if p.get("layer").is_some() { Some(crate::commands::layer_param(s, p)?) } else { s.active().and_then(|st| st.active_layer) }; s.edit(step_name(p), |doc, _| { - // At the measured Classic 50% setting, deep RGB and 16-bit CMYK pixels use 8-bit source coverage. - let opacity = if target == crate::channel_cmds::Target::Pixels - && (method_param.is_none() || method == Some(photocraft_io::GradientMethod::Classic)) - && p.get("opacity").and_then(Value::as_f64) == Some(50.0) - && matches!((doc.mode, doc.depth), (ColorMode::Rgb, SampleType::U16 | SampleType::F32) | (ColorMode::Cmyk, SampleType::U16)) - { + // The measured 50% setting uses 8-bit source coverage for these layer masks and Classic pixel gradients. + let opacity = if p.get("opacity").and_then(Value::as_f64) == Some(50.0) + && match target { + crate::channel_cmds::Target::Mask => { + matches!((doc.mode, doc.depth), (ColorMode::Rgb | ColorMode::Grayscale, _) | (ColorMode::Cmyk | ColorMode::Lab, SampleType::U8)) + } + crate::channel_cmds::Target::Pixels => { + (method_param.is_none() || method == Some(photocraft_io::GradientMethod::Classic)) + && matches!((doc.mode, doc.depth), (ColorMode::Rgb, SampleType::U16 | SampleType::F32) | (ColorMode::Cmyk, SampleType::U16)) + } + _ => false, + } { 128.0 / 255.0 } else { opacity From f525f280807c164f578716ed1a5bb37adc2e679b Mon Sep 17 00:00:00 2001 From: dholzric Date: Tue, 1 Dec 2026 16:57:20 -0600 Subject: [PATCH 53/61] Define Brush Preset: skip a "Sampled Brush N" a preset already uses (#18228) Storing under a taken name replaced that preset's tip. The default now skips used numbers and the counter moves to the number it stored. Co-Authored-By: Claude Opus 5.5 --- .../src/cmd/edit_menu_cmds/presets.rs | 11 +++++++--- .../tests/it/define_brush_sampled_number.rs | 22 +++++++++++++++---- 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/crates/engine-core/src/cmd/edit_menu_cmds/presets.rs b/crates/engine-core/src/cmd/edit_menu_cmds/presets.rs index 5310f4f7f39..c8fa58be906 100644 --- a/crates/engine-core/src/cmd/edit_menu_cmds/presets.rs +++ b/crates/engine-core/src/cmd/edit_menu_cmds/presets.rs @@ -6,11 +6,16 @@ use photocraft_doc::vector::PathOp; pub(super) fn define_brush_preset(s: &mut Session, p: &Value) -> Result { let typed = p.get("name").and_then(Value::as_str).map(str::trim).filter(|n| !n.is_empty()); - // The default counts the defaults stored this session; presets that merely share the name don't count (#18228). - let name = typed.map_or_else(|| format!("Sampled Brush {}", s.tools.sampled_brushes.saturating_add(1)), str::to_string); + // The default counts the defaults stored this session; presets that merely share the name don't raise it (#18228). A + // number a preset already uses is skipped, since storing under that name would replace that preset. + let mut number = s.tools.sampled_brushes.saturating_add(1); + while typed.is_none() && s.tools.presets.iter().any(|b| b.name == format!("Sampled Brush {number}")) { + number = number.saturating_add(1); + } + let name = typed.map_or_else(|| format!("Sampled Brush {number}"), str::to_string); let defined = s.execute("brush.defineFromSelection", json!({"name": name}))?; if typed.is_none() { - s.tools.sampled_brushes = s.tools.sampled_brushes.saturating_add(1); + s.tools.sampled_brushes = number; } Ok(defined) } diff --git a/crates/engine/tests/it/define_brush_sampled_number.rs b/crates/engine/tests/it/define_brush_sampled_number.rs index 7eabea6fdef..508a0408efb 100644 --- a/crates/engine/tests/it/define_brush_sampled_number.rs +++ b/crates/engine/tests/it/define_brush_sampled_number.rs @@ -1,6 +1,7 @@ //! #18228 (Edit › Define Brush Preset runs the brush command of `photocraft-engine-paint`, so this runs here): Define Brush Preset's "Sampled Brush N" default counts the defaults stored in this session. Deleting or //! renaming presets does not lower N, and a preset with such a name from elsewhere (a typed name, an imported set) does -//! not raise it. A call that stores nothing leaves N as it is. +//! not raise it, but N skips a number such a preset already uses instead of replacing that preset. A call that stores +//! nothing leaves N as it is. use serde_json::{Value, json}; @@ -57,15 +58,28 @@ fn deleting_or_renaming_the_presets_does_not_lower_it() { assert_eq!(define(&mut s, json!({})), "Sampled Brush 2", "after renaming preset 1"); } -/// A preset named "Sampled Brush …" that the default did not make, such as a typed name, does not count. +/// A preset named "Sampled Brush …" that the default did not make, such as a typed name, does not raise the number. #[test] -fn a_typed_sampled_brush_name_does_not_move_it() { +fn a_typed_sampled_brush_name_does_not_raise_it() { let mut s = session(); assert_eq!(define(&mut s, json!({"name": "Sampled Brush 7"})), "Sampled Brush 7"); - assert_eq!(define(&mut s, json!({"name": "Sampled Brush 1"})), "Sampled Brush 1"); assert_eq!(define(&mut s, json!({})), "Sampled Brush 1", "the first default"); } +/// The default never takes a name a preset already has: storing under it would replace that preset's tip. +#[test] +fn a_taken_number_is_skipped_and_the_preset_is_kept() { + let mut s = session(); + let user_presets = |s: &Session| s.tools.presets.iter().filter(|b| !b.builtin).map(|b| b.name.clone()).collect::>(); + define(&mut s, json!({"name": "Sampled Brush 1"})); + let first = define(&mut s, json!({})); + assert_ne!(first, "Sampled Brush 1", "the typed preset's name"); + assert_eq!(user_presets(&s).len(), 2, "both presets are kept: {:?}", user_presets(&s)); + let second = define(&mut s, json!({})); + assert!(![first.as_str(), "Sampled Brush 1"].contains(&second.as_str()), "{second}"); + assert_eq!(user_presets(&s).len(), 3, "{:?}", user_presets(&s)); +} + /// A call that stores no preset leaves the number as it is. #[test] fn a_refused_call_does_not_raise_it() { From 2d338e8b047a3c4d1bde19603043f089e6565a23 Mon Sep 17 00:00:00 2001 From: dholzric Date: Tue, 1 Dec 2026 17:06:14 -0600 Subject: [PATCH 54/61] Define Brush/Pattern: grey them while hidden colour channels leave the mask as the picture (#18232) The desktop treats a masked layer's mask as the target in Composite when every colour channel is hidden and no alpha channel is shown; the engine helper now does too, and ignores a shown filter mask as the desktop does. Co-Authored-By: Claude Opus 5.5 --- crates/engine-core/src/cmd/pattern_cmds.rs | 16 ++++++++++--- .../define_brush_mask_target_tests.rs | 24 +++++++++++++++++++ 2 files changed, 37 insertions(+), 3 deletions(-) diff --git a/crates/engine-core/src/cmd/pattern_cmds.rs b/crates/engine-core/src/cmd/pattern_cmds.rs index 9f2246fbc23..4ba1488a978 100644 --- a/crates/engine-core/src/cmd/pattern_cmds.rs +++ b/crates/engine-core/src/cmd/pattern_cmds.rs @@ -456,14 +456,24 @@ fn for_each_band(p: &Pattern, w: u32, h: u32, mut f: impl FnMut(&[[f32; 4]])) { } } -/// A layer mask is the edit target: the active pixel layer's or group's mask is targeted, or the active layer is an -/// adjustment layer with a mask, which is what it edits. Define Pattern and Define Brush Preset are greyed then (#18232). +/// A layer mask is the edit target: the active pixel layer's or group's mask is targeted, the active layer is an +/// adjustment layer with a mask, which is what it edits, or every colour channel is hidden with no alpha channel shown, so +/// the mask is the picture (as the desktop's target rule reads it). A shown filter mask is not the layer mask. Define +/// Pattern and Define Brush Preset are greyed then (#18232). pub fn layer_mask_targeted(s: &Session) -> bool { let Some(st) = s.active() else { return false }; let Some(layer) = st.active_layer.and_then(|id| st.doc.layer(id)).filter(|l| l.mask.is_some()) else { return false }; + if crate::mask_view_cmds::current(st).is_some_and(|v| v.filter) { + return false; + } match st.channel_view.target { crate::channel_cmds::ChannelTarget::LayerMask => true, - crate::channel_cmds::ChannelTarget::Composite => st.doc.quick_mask.is_none() && matches!(layer.content, LayerContent::Adjustment(_)), + crate::channel_cmds::ChannelTarget::Composite if st.doc.quick_mask.is_none() => { + let view = &st.channel_view; + let colors_off = view.visible_colors(crate::channel_cmds::color_count(&st.doc)) == 0; + let alpha_on = (0..st.doc.channels.len()).any(|i| view.alpha_shown(i)); + matches!(layer.content, LayerContent::Adjustment(_)) || (colors_off && !alpha_on) + } _ => false, } } diff --git a/crates/engine-paint/src/cmd/brush_cmds/define_brush_mask_target_tests.rs b/crates/engine-paint/src/cmd/brush_cmds/define_brush_mask_target_tests.rs index 17c64ac9a27..76a76fdecab 100644 --- a/crates/engine-paint/src/cmd/brush_cmds/define_brush_mask_target_tests.rs +++ b/crates/engine-paint/src/cmd/brush_cmds/define_brush_mask_target_tests.rs @@ -95,6 +95,30 @@ fn targeting_the_composite_again_enables_them_with_the_same_tip() { s.execute("edit.definePattern", json!({"name": "Pattern"})).unwrap(); } +/// With every colour channel hidden and no alpha channel shown, the mask is the picture and the target; showing a colour +/// channel or an alpha channel again makes the items available. +#[test] +fn hiding_every_colour_channel_greys_them_on_a_masked_layer() { + let mut s = document(); + s.execute("layer.layerMask.revealAll", json!({})).unwrap(); + target(&mut s, json!("composite")); + s.execute("channel.setVisible", json!({"channel": "composite", "visible": false})).unwrap(); + assert_refused(&mut s, "every colour channel hidden"); + s.execute("channel.setVisible", json!({"channel": {"color": 0}, "visible": true})).unwrap(); + assert_enabled(&mut s, "one colour channel shown again"); + + s.execute("channel.new", json!({})).unwrap(); + target(&mut s, json!("composite")); + s.execute("channel.setVisible", json!({"channel": "composite", "visible": false})).unwrap(); + s.execute("channel.setVisible", json!({"channel": {"alpha": 0}, "visible": true})).unwrap(); + assert_enabled(&mut s, "an alpha channel shown"); + + // Without a mask there is nothing else to target. + let mut s = document(); + s.execute("channel.setVisible", json!({"channel": "composite", "visible": false})).unwrap(); + assert_enabled(&mut s, "no mask, every colour channel hidden"); +} + /// Not a layer mask target: these keep today's gates. #[test] fn other_targets_and_layer_kinds_stay_enabled() { From 40ea294a22ca0b1faf56962c1c74beab0c4442e4 Mon Sep 17 00:00:00 2001 From: Terra854 Date: Wed, 2 Dec 2026 07:11:51 +0800 Subject: [PATCH 55/61] fix(view): match actual size metrics to display axes and backing pixels --- .../src/menus/view_cmds/actual_size.rs | 36 ++++++++++++--- .../src/menus/view_cmds/actual_size_tests.rs | 45 ++++++++++++++++--- 2 files changed, 69 insertions(+), 12 deletions(-) diff --git a/crates/ui-egui/src/menus/view_cmds/actual_size.rs b/crates/ui-egui/src/menus/view_cmds/actual_size.rs index 1e863fb60d5..191c16a0038 100644 --- a/crates/ui-egui/src/menus/view_cmds/actual_size.rs +++ b/crates/ui-egui/src/menus/view_cmds/actual_size.rs @@ -92,6 +92,13 @@ fn display_ppi(ctx: &egui::Context) -> Option { fn windows_monitor_width(device: &str) -> Option { use winsafe::{HKEY, RegistryValue, co}; + // Without a current orientation, a rotated desktop width cannot be paired with an EDID axis safely. + let mut mode = winsafe::DEVMODE::default(); + if !winsafe::EnumDisplaySettingsEx(Some(device), winsafe::GmidxEnum::Enum(co::ENUM_SETTINGS::CURRENT), &mut mode, co::EDS::default()).ok()? + || !mode.dmFields.has(co::DM::DISPLAYORIENTATION) + { + return None; + } let mut result = None; for monitor in winsafe::EnumDisplayDevices(Some(device), Some(co::EDD::GET_DEVICE_INTERFACE_NAME)).take(64) { let monitor = monitor.ok()?; @@ -104,7 +111,7 @@ fn windows_monitor_width(device: &str) -> Option { _ => windows_edid_value(&key, "EDID").ok()?, }; let RegistryValue::Binary(edid) = value else { return None }; - let width = edid_width(&edid)?; + let width = oriented_width(edid_size(&edid)?, mode.dmDisplayOrientation().raw())?; // Mirrored outputs must agree on physical size before one scale can describe both. if result.is_some_and(|previous: f64| (previous - width).abs() > 0.5) { return None; @@ -146,7 +153,7 @@ pub(super) fn monitor_registry_path(interface: &str) -> Option { } #[cfg(any(test, target_os = "windows"))] -pub(super) fn edid_width(edid: &[u8]) -> Option { +pub(super) fn edid_size(edid: &[u8]) -> Option<[f64; 2]> { let base = edid.get(..128)?; if base.get(..8)? != [0, 255, 255, 255, 255, 255, 255, 0] || base.iter().fold(0u8, |sum, value| sum.wrapping_add(*value)) != 0 { return None; @@ -159,12 +166,31 @@ pub(super) fn edid_width(edid: &[u8]) -> Option { let width = u16::from(*timing.get(12)?) | (u16::from(*timing.get(14)? & 0xf0) << 4); let height = u16::from(*timing.get(13)?) | (u16::from(*timing.get(14)? & 0x0f) << 8); if width > 0 && height > 0 { - return Some(f64::from(width)); + return Some([f64::from(width), f64::from(height)]); } } let width = *base.get(21)?; let height = *base.get(22)?; - (width > 0 && height > 0).then_some(f64::from(width) * 10.0) + (width > 0 && height > 0).then_some([f64::from(width) * 10.0, f64::from(height) * 10.0]) +} + +/// EDID describes the unrotated panel; desktop horizontal pixels follow the current display orientation. +#[cfg(any(test, target_os = "windows"))] +pub(super) fn oriented_width(size: [f64; 2], quarter_turns: u32) -> Option { + if !size.iter().all(|value| value.is_finite() && *value > 0.0) { + return None; + } + match quarter_turns { + 0 | 2 => Some(size[0]), + 1 | 3 => Some(size[1]), + _ => None, + } +} + +/// Missing backing-mode metrics must fall back, rather than substitute a logical display width. +#[cfg(any(test, target_os = "macos"))] +pub(super) fn backing_mode_ppi(width: Option, millimeters: f64) -> Option { + physical_ppi(width? as f64, millimeters) } #[cfg(target_os = "macos")] @@ -182,7 +208,7 @@ fn display_ppi(ctx: &egui::Context) -> Option { let height = (f64::from(window.bottom()) * factor).min(bounds.origin.y + bounds.size.height) - (f64::from(window.top()) * factor).max(bounds.origin.y); let area = width.max(0.0) * height.max(0.0); if area > best.0 { - best = (area, physical_ppi(display.pixels_wide() as f64, display.screen_size().width)); + best = (area, backing_mode_ppi(display.display_mode().map(|mode| mode.pixel_width()), display.screen_size().width)); } } best.1 diff --git a/crates/ui-egui/src/menus/view_cmds/actual_size_tests.rs b/crates/ui-egui/src/menus/view_cmds/actual_size_tests.rs index e874c7bcac0..eff9979c72e 100644 --- a/crates/ui-egui/src/menus/view_cmds/actual_size_tests.rs +++ b/crates/ui-egui/src/menus/view_cmds/actual_size_tests.rs @@ -1,4 +1,4 @@ -use super::actual_size::{apply, edid_width, monitor_registry_path, physical_ppi}; +use super::actual_size::{apply, backing_mode_ppi, edid_size, monitor_registry_path, oriented_width, physical_ppi}; use crate::{PhotocraftApp, Services}; use photocraft_engine::Session; use serde_json::json; @@ -103,19 +103,50 @@ fn actual_size_reads_validated_edid_physical_dimensions() { edid[67] = 30; edid[68] = 0x11; edid[127] = 0u8.wrapping_sub(edid.iter().copied().fold(0u8, u8::wrapping_add)); - assert_eq!(edid_width(&edid), Some(509.0)); - assert_eq!(physical_ppi(1920.0, edid_width(&edid).unwrap()), Some(95.0)); + assert_eq!(edid_size(&edid), Some([509.0, 286.0])); + assert_eq!(physical_ppi(1920.0, oriented_width(edid_size(&edid).unwrap(), 0).unwrap()), Some(95.0)); for length in 0..128 { - assert_eq!(edid_width(&edid[..length]), None); + assert_eq!(edid_size(&edid[..length]), None); } edid[54] = 0; edid[127] = edid[127].wrapping_add(1); - assert_eq!(edid_width(&edid), Some(510.0), "centimetres when detailed dimensions are absent"); + assert_eq!(edid_size(&edid), Some([510.0, 290.0]), "centimetres when detailed dimensions are absent"); edid[21] = 0; edid[127] = edid[127].wrapping_add(51); - assert_eq!(edid_width(&edid), None, "an aspect ratio has no physical width"); + assert_eq!(edid_size(&edid), None, "an aspect ratio has no physical width"); edid[1] = 0; - assert_eq!(edid_width(&edid), None, "corrupt headers are unavailable"); + assert_eq!(edid_size(&edid), None, "corrupt headers are unavailable"); +} + +#[test] +fn actual_size_matches_the_edid_axis_to_all_four_windows_orientations() { + let size = [600.0, 337.0]; + for (orientation, pixels, millimeters) in [(0, 1920.0, 600.0), (1, 1080.0, 337.0), (2, 1920.0, 600.0), (3, 1080.0, 337.0)] { + let width = oriented_width(size, orientation).unwrap(); + assert_eq!(width, millimeters); + assert_eq!(physical_ppi(pixels, width), Some(81.0)); + } + assert_eq!(oriented_width(size, 4), None); + for invalid in [[0.0, 337.0], [600.0, f64::NAN], [f64::INFINITY, 337.0]] { + assert_eq!(oriented_width(invalid, 1), None); + } +} + +#[test] +fn actual_size_uses_backing_mode_pixels_and_falls_back_without_a_usable_mode() { + let mut app = PhotocraftApp::new(Session::new(), Services::default()); + app.run("file.new", json!({"width": 640, "height": 480})).unwrap(); + let physical = backing_mode_ppi(Some(3024), 344.0); + assert_eq!(physical, Some(223.0), "backing width rather than a 1512-point logical mode"); + assert_eq!(physical_ppi(1512.0, 344.0), Some(111.0)); + assert_eq!(apply(&mut app, physical, &json!({})).unwrap()["fallback"], false); + for mode in [None, Some(0)] { + let missing = backing_mode_ppi(mode, 344.0); + assert_eq!(missing, None); + let fallback = apply(&mut app, missing, &json!({})).unwrap(); + assert_eq!(fallback["fallback"], true); + assert!(fallback["status"].as_str().unwrap().contains("Screen Resolution")); + } } #[test] From df1f21b7eec325b895718323ca1c1860d632f819 Mon Sep 17 00:00:00 2001 From: dholzric Date: Tue, 1 Dec 2026 17:29:08 -0600 Subject: [PATCH 56/61] Ctrl+E on a clip base: Merge Clipping Mask (#18481) With the base of a clipping group alone selected, layer.mergeLayers merges the base and the layers clipped to it into one layer that keeps the base's identity, name, blend mode and opacity; the composite does not change. The Layer menu and the Layers panel row menu read Merge Clipping Mask. Unmeasured cases keep Merge Down. Co-Authored-By: Claude Opus 5.5 --- crates/engine-core/src/cmd.rs | 2 + .../cmd/layer_merge_clipping_mask_tests.rs | 122 ++++++++++++++++++ .../engine-core/src/cmd/layer_multi_cmds.rs | 2 +- .../src/cmd/layer_multi_cmds/structure.rs | 63 ++++++++- crates/ui-egui/src/menus/items.rs | 8 ++ crates/ui-egui/src/panels/layer_menu_ui.rs | 12 +- crates/ui-egui/src/panels/layers_tree.rs | 3 +- 7 files changed, 207 insertions(+), 5 deletions(-) create mode 100644 crates/engine-core/src/cmd/layer_merge_clipping_mask_tests.rs diff --git a/crates/engine-core/src/cmd.rs b/crates/engine-core/src/cmd.rs index fa15aaeb673..e931a08f0cb 100644 --- a/crates/engine-core/src/cmd.rs +++ b/crates/engine-core/src/cmd.rs @@ -87,6 +87,8 @@ pub mod layer_label_cmds; pub mod layer_list_cmds; pub mod layer_mask_props_cmds; pub mod layer_menu_cmds; +#[cfg(test)] +mod layer_merge_clipping_mask_tests; pub mod layer_multi_cmds; pub mod layer_nav_cmds; mod layer_params; diff --git a/crates/engine-core/src/cmd/layer_merge_clipping_mask_tests.rs b/crates/engine-core/src/cmd/layer_merge_clipping_mask_tests.rs new file mode 100644 index 00000000000..3222369deb3 --- /dev/null +++ b/crates/engine-core/src/cmd/layer_merge_clipping_mask_tests.rs @@ -0,0 +1,122 @@ +//! #18481: `Ctrl+E` (`layer.mergeLayers`) with the base of a clip group alone selected is Merge Clipping Mask: the base +//! and the layers clipped to it become one layer with the base's identity, name, place, blend mode and opacity; the +//! composite does not change, and clipped pixels outside the base are gone. Other layers, and the cases the issue did +//! not measure, keep Merge Down. + +use photocraft_doc::{BlendMode, LayerId}; +use photocraft_geom::Rect; +use serde_json::json; + +use crate::Session; + +/// `Top` (blue, wider than `Red`) clipped onto `Red`, `Masked` below, on a white Background; `Red` active. +fn clip_group() -> (Session, LayerId) { + let mut s = crate::session(); + s.execute("file.new", json!({"width": 60, "height": 40, "background": "#ffffff"})).unwrap(); + let fill = |s: &mut Session, name: &str, rect: Rect, color: [f32; 4]| { + s.execute("layer.new.layer", json!({"name": name})).unwrap(); + s.edit("Paint", |doc, active| { + doc.layer_mut(active.unwrap()).unwrap().surface_mut().unwrap().fill_rect(rect, &color); + Ok(()) + }) + .unwrap(); + s.active().unwrap().active_layer.unwrap() + }; + fill(&mut s, "Masked", Rect::new(0, 20, 60, 40), [0.0, 0.6, 0.0, 1.0]); + let red = fill(&mut s, "Red", Rect::new(10, 10, 30, 30), [1.0, 0.0, 0.0, 1.0]); + fill(&mut s, "Top", Rect::new(20, 0, 50, 25), [0.0, 0.0, 1.0, 0.7]); + s.execute("layer.createClippingMask", json!({})).unwrap(); + s.execute("layer.select", json!({"layer": red.0})).unwrap(); + (s, red) +} + +fn names(s: &Session) -> Vec { + s.active().unwrap().doc.walk().into_iter().map(|(_, _, l)| l.name.clone()).collect() +} + +fn flat(s: &Session) -> Vec<[f32; 4]> { + photocraft_compose::flatten(&s.active().unwrap().doc).into_px() +} + +fn max_diff(a: &[[f32; 4]], b: &[[f32; 4]]) -> f32 { + a.iter().zip(b).flat_map(|(p, q)| (0..4).map(move |c| (p[c] - q[c]).abs())).fold(0.0, f32::max) +} + +fn undo_label(s: &Session) -> String { + s.active().unwrap().history.undo_label().unwrap_or_default().to_string() +} + +/// The merged layer's pixel at canvas `(x, y)`. +fn pixel(s: &Session, id: LayerId, x: i32, y: i32) -> Vec { + s.active().unwrap().doc.layer(id).unwrap().surface().unwrap().pixel(x, y) +} + +#[test] +fn ctrl_e_on_a_clip_base_merges_the_clipped_layers_into_it() { + let (mut s, red) = clip_group(); + let before = flat(&s); + let steps = s.active().unwrap().history.past_len(); + + s.execute("layer.mergeLayers", json!({})).unwrap(); + + assert!(!names(&s).contains(&"Top".to_string()), "Top is merged: {:?}", names(&s)); + assert!(names(&s).contains(&"Masked".to_string()), "Masked is untouched: {:?}", names(&s)); + let d = s.active().unwrap(); + let merged = d.doc.layer(red).expect("the result keeps the base's id"); + assert_eq!(merged.name, "Red"); + assert!(!merged.clipped); + assert_eq!(d.active_layer, Some(red)); + assert_eq!(d.history.past_len(), steps + 1, "one History state"); + assert_eq!(undo_label(&s), "Merge Clipping Mask"); + assert!(max_diff(&before, &flat(&s)) < 1e-3, "the composite does not change"); + + // Inside the base the blue is blended over the red; outside the base the clipped blue is gone. + let inside = pixel(&s, red, 25, 15); + assert!(inside[2] > inside[0] && inside[3] > 0.99, "{inside:?}"); + assert!(pixel(&s, red, 40, 5)[3] < 1e-3, "clipped pixels outside the base are dropped"); +} + +#[test] +fn the_result_keeps_the_bases_blend_mode_and_opacity() { + let (mut s, red) = clip_group(); + s.execute("layer.setProps", json!({"blend": "Multiply", "opacity": 0.6})).unwrap(); + let before = flat(&s); + + s.execute("layer.mergeLayers", json!({})).unwrap(); + + let merged = s.active().unwrap().doc.layer(red).unwrap().clone(); + assert_eq!(merged.blend, BlendMode::Multiply); + assert!((merged.opacity - 0.6).abs() < 1e-3, "{}", merged.opacity); + assert!(max_diff(&before, &flat(&s)) < 1e-3, "the composite does not change"); +} + +#[test] +fn a_layer_that_is_not_a_clip_base_still_merges_down() { + // The clipped layer itself, and a layer with nothing clipped to it. + for name in ["Top", "Masked"] { + let (mut s, _) = clip_group(); + let id = s.active().unwrap().doc.walk().into_iter().find(|(_, _, l)| l.name == name).unwrap().2.id; + s.execute("layer.select", json!({"layer": id.0})).unwrap(); + s.execute("layer.mergeLayers", json!({})).unwrap(); + assert_eq!(undo_label(&s), "Merge Down", "{name}"); + } +} + +/// Not measured in the issue: these keep today's Merge Down. +#[test] +fn a_base_with_a_layer_mask_or_inside_a_group_keeps_merge_down() { + let (mut s, _) = clip_group(); + s.execute("layer.layerMask.revealAll", json!({})).unwrap(); + s.execute("layer.mergeLayers", json!({})).unwrap(); + assert_eq!(undo_label(&s), "Merge Down", "a base with a layer mask"); + + let (mut s, red) = clip_group(); + let masked = s.active().unwrap().doc.walk().into_iter().find(|(_, _, l)| l.name == "Masked").unwrap().2.id; + let top = s.active().unwrap().doc.walk().into_iter().find(|(_, _, l)| l.name == "Top").unwrap().2.id; + s.execute("layer.select", json!({"layers": [masked.0, red.0, top.0]})).unwrap(); + s.execute("layer.groupLayers", json!({})).unwrap(); + assert!(s.active().unwrap().doc.layer(top).unwrap().clipped, "Top is still clipped inside the group"); + s.execute("layer.select", json!({"layer": red.0})).unwrap(); + s.execute("layer.mergeLayers", json!({})).unwrap(); + assert_eq!(undo_label(&s), "Merge Down", "a base inside a group"); +} diff --git a/crates/engine-core/src/cmd/layer_multi_cmds.rs b/crates/engine-core/src/cmd/layer_multi_cmds.rs index 4ce80a67f4f..bdc21ec4665 100644 --- a/crates/engine-core/src/cmd/layer_multi_cmds.rs +++ b/crates/engine-core/src/cmd/layer_multi_cmds.rs @@ -31,9 +31,9 @@ pub use selection::top_level; use selection::{doc_state, find_layers, select_all_layers, select_linked}; pub(crate) use selection::{mask_targets, recorded_step, reselect}; pub use selection::{select, selected, set_selection}; -pub use structure::deletion_neighbours; pub(crate) use structure::{check_group_depth, relink_copies}; pub use structure::{delete_selected, duplicate_selected, group_layers, set_visible_selected}; +pub use structure::{deletion_neighbours, merges_clipping_mask}; use structure::{link_layers, lock_layers, merge_layers, rename_layer, reverse}; // ---------- enabled predicates ---------- diff --git a/crates/engine-core/src/cmd/layer_multi_cmds/structure.rs b/crates/engine-core/src/cmd/layer_multi_cmds/structure.rs index 60ee42e5dbc..5f9a4b366f0 100644 --- a/crates/engine-core/src/cmd/layer_multi_cmds/structure.rs +++ b/crates/engine-core/src/cmd/layer_multi_cmds/structure.rs @@ -228,7 +228,13 @@ fn group_layers_with(s: &mut Session, p: &Value, ids: &[LayerId], from_layers: b pub(super) fn merge_layers(s: &mut Session) -> Result { let sel = selected(s); if sel.len() < 2 { - // ⌘E on a lone group is Photoshop's Merge Group (#3832); on a layer, Merge Down. + // ⌘E on a lone clip base is Merge Clipping Mask (#18481); on a lone group, Photoshop's Merge Group (#3832); on a + // layer, Merge Down. + if let Some(&id) = sel.first() + && s.active().is_some_and(|d| merges_clipping_mask(&d.doc, id)) + { + return merge_clipping_mask(s, id); + } if let Some(&id) = sel.first() && s.active().and_then(|d| d.doc.layer(id)).is_some_and(|l| matches!(l.content, LayerContent::Group(_))) { @@ -298,6 +304,61 @@ pub(super) fn merge_layers(s: &mut Session) -> Result { Ok(json!({ "layer": mid.0 })) } +/// `⌘E` on `id` alone is Merge Clipping Mask: a visible pixel-bearing top-level layer with layers clipped to it. A base +/// inside a group, with a layer or vector mask or effects, a group or an adjustment layer as the base, and a hidden base +/// were not measured (#18481) and keep Merge Down or Merge Group. +pub fn merges_clipping_mask(doc: &Document, id: LayerId) -> bool { + let Some(l) = doc.layer(id) else { return false }; + doc.path_of(id).is_some_and(|p| p.len() == 1) + && l.visible + && l.mask.is_none() + && l.vector_mask.is_none() + && l.effects.items.is_empty() + && !matches!(l.content, LayerContent::Group(_) | LayerContent::Adjustment(_)) + && !crate::clip_group::clipped_to(doc, id).is_empty() +} + +/// Merge Clipping Mask: the base and the layers clipped to it become one layer with the base's id, name, place, blend mode, +/// opacity, locks, colour label and link. Clipped pixels are blended inside the base's pixels and dropped outside it, so +/// the composite does not change; hidden clipped layers are discarded, as Merge Layers does. +fn merge_clipping_mask(s: &mut Session, base_id: LayerId) -> Result { + s.edit("Merge Clipping Mask", |doc, active| { + let clipped = crate::clip_group::clipped_to(doc, base_id); + let base = doc.layer(base_id).ok_or(EngineError::NoLayer(base_id))?.clone(); + let format = doc.pixel_format(); + // The group alone, the base drawn plainly: its blend mode and opacity stay on the result. + let mut plain = base.clone(); + plain.blend = photocraft_doc::BlendMode::Normal; + plain.opacity = 1.0; + let mut solo = Document::new("merge", doc.size, format.mode, format.sample); + solo.icc_profile = doc.icc_profile.clone(); + let mut stack = vec![plain]; + stack.extend(clipped.iter().filter_map(|id| doc.layer(*id)).filter(|l| l.visible).cloned()); + solo.layers = stack.into(); + // A Background stays canvas-sized and opaque; any other layer keeps its pixels outside the canvas. + let pixels = if doc.is_background(base_id) { + crate::pixels::composite_layers(&solo, format, None) + } else { + crate::pixels::composite_layers_uncropped(&solo, PixelFormat::new(format.mode, format.sample, true)) + }; + let mut merged = Layer::new(base.name.clone(), LayerContent::Raster(pixels)); + merged.id = base_id; + merged.blend = base.blend; + merged.opacity = base.opacity; + merged.locks = base.locks; + merged.label = base.label; + merged.link_group = base.link_group; + for id in &clipped { + doc.remove(*id); + } + *doc.layer_mut(base_id).ok_or(EngineError::NoLayer(base_id))? = merged; + *active = Some(base_id); + Ok(()) + })?; + reselect(s, vec![base_id], Some(base_id)); + Ok(json!({ "layer": base_id.0 })) +} + /// Next visible layer row below the deleted target, then rows above in reverse order. /// Group headers precede their children in the UI, unlike Document::walk's storage order. pub fn deletion_neighbours(doc: &Document, target: LayerId) -> Vec { diff --git a/crates/ui-egui/src/menus/items.rs b/crates/ui-egui/src/menus/items.rs index 83357c6dc95..117cf2ab86f 100644 --- a/crates/ui-egui/src/menus/items.rs +++ b/crates/ui-egui/src/menus/items.rs @@ -240,6 +240,14 @@ pub fn base_rows(app: &PhotocraftApp) -> Vec { { item.label = "Merge Group".into(); } + // And Merge Clipping Mask with just the base of a clip group selected (#18481). + if let Some(st) = app.session.active() + && st.selected_layers().len() <= 1 + && st.active_layer.is_some_and(|id| photocraft_engine::layer_multi_cmds::merges_clipping_mask(&st.doc, id)) + && let Some(item) = find(&mut rows, "layer.mergeLayers") + { + item.label = "Merge Clipping Mask".into(); + } // Edit › Fade names the step it fades (#13803). if let Some(item) = find(&mut rows, "edit.fade") { item.label = photocraft_engine::edit_menu_cmds::fade_menu_label(&app.session); diff --git a/crates/ui-egui/src/panels/layer_menu_ui.rs b/crates/ui-egui/src/panels/layer_menu_ui.rs index 5aa0be8933a..fed63c8cf18 100644 --- a/crates/ui-egui/src/panels/layer_menu_ui.rs +++ b/crates/ui-egui/src/panels/layer_menu_ui.rs @@ -64,14 +64,22 @@ pub(crate) fn layer_count_label(command: &str, multi: bool) -> Option<&'static s /// The context menu entries for a layer's row: [`entries`], led on the Background's row /// (`background`, [`photocraft_doc::Document::is_background`]) by Layer from Background… and a -/// separator, the Layer › New entry (#16764). A multi-selection keeps the plain entries. -pub fn row_entries(l: &Layer, multi: bool, has_selection: bool, background: bool) -> Vec { +/// separator, the Layer › New entry (#16764). A multi-selection keeps the plain entries. The base of a clip group +/// (`clip_base`, [`photocraft_engine::layer_multi_cmds::merges_clipping_mask`]) reads Merge Clipping Mask in place of +/// Merge Down (#18481). +pub fn row_entries(l: &Layer, multi: bool, has_selection: bool, background: bool, clip_base: bool) -> Vec { let mut v: Vec = Vec::new(); if background && !multi { v.push(Some((tl!("Layer from Background…"), "layer.new.layerFromBackground"))); v.push(None); } v.extend(entries(l, multi, has_selection)); + if clip_base + && !multi + && let Some(merge) = v.iter_mut().flatten().find(|e| e.1 == "layer.mergeDown") + { + *merge = (tl!("Merge Clipping Mask"), "layer.mergeLayers"); + } v } diff --git a/crates/ui-egui/src/panels/layers_tree.rs b/crates/ui-egui/src/panels/layers_tree.rs index 904c5ff127d..756b3ffa836 100644 --- a/crates/ui-egui/src/panels/layers_tree.rs +++ b/crates/ui-egui/src/panels/layers_tree.rs @@ -774,7 +774,8 @@ pub(crate) fn row_menu(app: &PhotocraftApp, tree: &PhotoLayers, target: &MenuTar MenuKind::Layer(id) => { let Some(l) = tree.layer(&id) else { return Vec::new() }; let background = tree.doc().is_background(id); - let mut out = commands(crate::layer_menu_ui::row_entries(l, target.on_selection, has_selection, background), target.on_selection); + let clip_base = photocraft_engine::layer_multi_cmds::merges_clipping_mask(tree.doc(), id); + let mut out = commands(crate::layer_menu_ui::row_entries(l, target.on_selection, has_selection, background, clip_base), target.on_selection); out.push(Entry::separator()); out.push(Entry::new(RENAME.to_string(), tl!("Rename Layer…").to_string())); out From 4f35542320ca57b11360ceb394093b5c93abad51 Mon Sep 17 00:00:00 2001 From: dholzric Date: Tue, 1 Dec 2026 18:01:42 -0600 Subject: [PATCH 57/61] Merge Clipping Mask: keep Merge Down for a base the result cannot carry (#18481) A base with Fill below 100 %, Blend If, non-default Advanced Blending or an excluded channel would lose that setting in the merged layer and the composite would change; those bases keep Merge Down. Co-Authored-By: Claude Opus 5.5 --- .../cmd/layer_merge_clipping_mask_tests.rs | 23 +++++++++++++++++++ .../src/cmd/layer_multi_cmds/structure.rs | 7 +++++- 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/crates/engine-core/src/cmd/layer_merge_clipping_mask_tests.rs b/crates/engine-core/src/cmd/layer_merge_clipping_mask_tests.rs index 3222369deb3..4455a9811dc 100644 --- a/crates/engine-core/src/cmd/layer_merge_clipping_mask_tests.rs +++ b/crates/engine-core/src/cmd/layer_merge_clipping_mask_tests.rs @@ -120,3 +120,26 @@ fn a_base_with_a_layer_mask_or_inside_a_group_keeps_merge_down() { s.execute("layer.mergeLayers", json!({})).unwrap(); assert_eq!(undo_label(&s), "Merge Down", "a base inside a group"); } + +/// A base whose Fill, Blend If, Advanced Blending or excluded channels the merged layer could not carry keeps Merge +/// Down, so the composite is never changed by Merge Clipping Mask. +#[test] +fn a_base_with_settings_the_result_cannot_carry_keeps_merge_down() { + type Set = fn(&mut photocraft_doc::Layer); + let cases: [(&str, Set); 4] = [ + ("Fill 50 %", |l| l.fill_opacity = 0.5), + ("Blend If", |l| l.blend_if.ranges = vec![[photocraft_doc::BlendRange { black: [0, 0], white: [128, 128] }, photocraft_doc::BlendRange::FULL]]), + ("Blend Clipped Layers as Group off", |l| l.advanced.blend_clipped = false), + ("an excluded channel", |l| l.excluded_channels = 1), + ]; + for (case, set) in cases { + let (mut s, red) = clip_group(); + s.edit("Set", |doc, _| { + set(doc.layer_mut(red).unwrap()); + Ok(()) + }) + .unwrap(); + s.execute("layer.mergeLayers", json!({})).unwrap(); + assert_eq!(undo_label(&s), "Merge Down", "{case}"); + } +} diff --git a/crates/engine-core/src/cmd/layer_multi_cmds/structure.rs b/crates/engine-core/src/cmd/layer_multi_cmds/structure.rs index 5f9a4b366f0..0adca724513 100644 --- a/crates/engine-core/src/cmd/layer_multi_cmds/structure.rs +++ b/crates/engine-core/src/cmd/layer_multi_cmds/structure.rs @@ -306,7 +306,8 @@ pub(super) fn merge_layers(s: &mut Session) -> Result { /// `⌘E` on `id` alone is Merge Clipping Mask: a visible pixel-bearing top-level layer with layers clipped to it. A base /// inside a group, with a layer or vector mask or effects, a group or an adjustment layer as the base, and a hidden base -/// were not measured (#18481) and keep Merge Down or Merge Group. +/// were not measured (#18481) and keep Merge Down or Merge Group. So does a base whose Fill, Blend If, Advanced Blending +/// or excluded channels the merged layer could not carry without changing the composite (review of #18858). pub fn merges_clipping_mask(doc: &Document, id: LayerId) -> bool { let Some(l) = doc.layer(id) else { return false }; doc.path_of(id).is_some_and(|p| p.len() == 1) @@ -314,6 +315,10 @@ pub fn merges_clipping_mask(doc: &Document, id: LayerId) -> bool { && l.mask.is_none() && l.vector_mask.is_none() && l.effects.items.is_empty() + && l.fill_opacity >= 1.0 + && l.blend_if.is_default() + && l.advanced.is_default() + && l.excluded_channels == 0 && !matches!(l.content, LayerContent::Group(_) | LayerContent::Adjustment(_)) && !crate::clip_group::clipped_to(doc, id).is_empty() } From 71e3c51be4219d82ecf0352e3a0649fb8d52cfd7 Mon Sep 17 00:00:00 2001 From: dholzric Date: Tue, 1 Dec 2026 18:43:23 -0600 Subject: [PATCH 58/61] Define Brush Preset: skip a taken "Sampled Brush N" ignoring case (#18228) The preset store matches names ignoring ASCII case, so a typed "sampled brush 1" was still replaced by the default "Sampled Brush 1". Co-Authored-By: Claude Opus 5.5 --- crates/engine-core/src/cmd/edit_menu_cmds/presets.rs | 5 +++-- crates/engine/tests/it/define_brush_sampled_number.rs | 7 +++++++ 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/crates/engine-core/src/cmd/edit_menu_cmds/presets.rs b/crates/engine-core/src/cmd/edit_menu_cmds/presets.rs index c8fa58be906..8a2e9fe9719 100644 --- a/crates/engine-core/src/cmd/edit_menu_cmds/presets.rs +++ b/crates/engine-core/src/cmd/edit_menu_cmds/presets.rs @@ -7,9 +7,10 @@ use photocraft_doc::vector::PathOp; pub(super) fn define_brush_preset(s: &mut Session, p: &Value) -> Result { let typed = p.get("name").and_then(Value::as_str).map(str::trim).filter(|n| !n.is_empty()); // The default counts the defaults stored this session; presets that merely share the name don't raise it (#18228). A - // number a preset already uses is skipped, since storing under that name would replace that preset. + // number a preset already uses is skipped, since storing under that name would replace that preset; the store matches + // names ignoring ASCII case, so this does too. let mut number = s.tools.sampled_brushes.saturating_add(1); - while typed.is_none() && s.tools.presets.iter().any(|b| b.name == format!("Sampled Brush {number}")) { + while typed.is_none() && s.tools.presets.iter().any(|b| b.name.eq_ignore_ascii_case(&format!("Sampled Brush {number}"))) { number = number.saturating_add(1); } let name = typed.map_or_else(|| format!("Sampled Brush {number}"), str::to_string); diff --git a/crates/engine/tests/it/define_brush_sampled_number.rs b/crates/engine/tests/it/define_brush_sampled_number.rs index 508a0408efb..d082a662820 100644 --- a/crates/engine/tests/it/define_brush_sampled_number.rs +++ b/crates/engine/tests/it/define_brush_sampled_number.rs @@ -78,6 +78,13 @@ fn a_taken_number_is_skipped_and_the_preset_is_kept() { let second = define(&mut s, json!({})); assert!(![first.as_str(), "Sampled Brush 1"].contains(&second.as_str()), "{second}"); assert_eq!(user_presets(&s).len(), 3, "{:?}", user_presets(&s)); + + // The store matches names ignoring case, so a typed "sampled brush 1" is taken too. + let mut s = session(); + define(&mut s, json!({"name": "sampled brush 1"})); + let first = define(&mut s, json!({})); + assert!(!first.eq_ignore_ascii_case("sampled brush 1"), "{first}"); + assert_eq!(user_presets(&s).len(), 2, "{:?}", user_presets(&s)); } /// A call that stores no preset leaves the number as it is. From 36180076e89e4998e2201557ff231434eade0aa1 Mon Sep 17 00:00:00 2001 From: yoriswind Date: Tue, 1 Dec 2026 16:48:06 -0800 Subject: [PATCH 59/61] Keep the clipped layer with its converted Background --- crates/engine-core/src/cmd/background_cmds.rs | 11 +++ .../it/background_from_layer_clip_base.rs | 80 +++++++++++++++++++ crates/engine/tests/it/main.rs | 1 + 3 files changed, 92 insertions(+) create mode 100644 crates/engine/tests/it/background_from_layer_clip_base.rs diff --git a/crates/engine-core/src/cmd/background_cmds.rs b/crates/engine-core/src/cmd/background_cmds.rs index 90ed98c578d..4976894bc87 100644 --- a/crates/engine-core/src/cmd/background_cmds.rs +++ b/crates/engine-core/src/cmd/background_cmds.rs @@ -86,6 +86,13 @@ fn background_from_layer(s: &mut Session, p: &Value) -> Result { } let l = doc.layer(id).ok_or(EngineError::NoLayer(id))?; convertible(l).map_err(EngineError::Other)?; + // Keep the one measured clipped sibling with its top-level base. Leave nested + // targets and stacks with several clipped layers on the existing path. + let mut above = doc.layers.iter().skip_while(|layer| layer.id != id).skip(1); + let clipped = match (above.next(), above.next()) { + (Some(layer), next) if !l.clipped && layer.clipped && !next.is_some_and(|layer| layer.clipped) => Some(layer.id), + _ => None, + }; // Render the layer alone, as it looks (mask, opacity and effects applied), over the // background colour: the Background is opaque and plain. let mut only = l.clone(); @@ -104,6 +111,10 @@ fn background_from_layer(s: &mut Session, p: &Value) -> Result { *crate::pixels_mut(&mut out)? = pixels; doc.remove(id).ok_or(EngineError::NoLayer(id))?; doc.layers.insert(0, out); + if let Some(clipped) = clipped { + let layer = doc.remove(clipped).ok_or(EngineError::NoLayer(clipped))?; + doc.layers.insert(1, layer); + } *active = Some(id); Ok(()) })?; diff --git a/crates/engine/tests/it/background_from_layer_clip_base.rs b/crates/engine/tests/it/background_from_layer_clip_base.rs new file mode 100644 index 00000000000..151eacc7160 --- /dev/null +++ b/crates/engine/tests/it/background_from_layer_clip_base.rs @@ -0,0 +1,80 @@ +//! Background from Layer keeps a single clipped layer on its original base (#17307). + +use photocraft_doc::LayerId; +use photocraft_engine::Session; +use serde_json::json; + +const CONVERT: &str = "layer.new.backgroundFromLayer"; + +fn active(session: &Session) -> LayerId { + session.active().unwrap().active_layer.unwrap() +} + +fn order(session: &Session) -> Vec { + session.active().unwrap().doc.layers.iter().map(|layer| layer.id).collect() +} + +fn stack() -> (Session, [LayerId; 7]) { + let mut session = Session::new(); + session.execute("file.new", json!({"width": 200, "height": 150, "background": "transparent"})).unwrap(); + let base = active(&session); + session.execute("select.rect", json!({"x": 0, "y": 0, "width": 16, "height": 150})).unwrap(); + session.execute("edit.fill", json!({"color": "#808080"})).unwrap(); + session.execute("select.deselect", json!({})).unwrap(); + session.execute("layer.new.layer", json!({"name": "SO"})).unwrap(); + session.execute("select.rect", json!({"x": 20, "y": 20, "width": 40, "height": 40})).unwrap(); + session.execute("edit.fill", json!({"color": "#c81e1e"})).unwrap(); + session.execute("select.deselect", json!({})).unwrap(); + session.execute("layer.smartObjects.convertToSmartObject", json!({})).unwrap(); + let smart = active(&session); + session.execute("layer.new.layer", json!({"name": "Clipped"})).unwrap(); + let clipped = active(&session); + session.execute("edit.fill", json!({"color": "#1e1ec8"})).unwrap(); + session.execute("layer.setProps", json!({"layer": clipped.0, "clipped": true})).unwrap(); + session.execute("layer.newAdjustmentLayer.levels", json!({})).unwrap(); + let adjustment = active(&session); + session.execute("layer.newFillLayer.solidColor", json!({"color": "#4080c0"})).unwrap(); + let fill = active(&session); + session.execute("layer.setProps", json!({"layer": fill.0, "opacity": 0.5})).unwrap(); + let shape = session.execute("shape.create", json!({"kind": "rect", "rect": [80, 60, 100, 80], "fill": "#308020"})).unwrap(); + let shape = LayerId(shape["layer"].as_u64().unwrap()); + session.execute("layer.select", json!({"layer": shape.0})).unwrap(); + session.execute("layer.new.layer", json!({"name": "Off"})).unwrap(); + let off = active(&session); + let ids = [base, smart, clipped, adjustment, fill, shape, off]; + assert_eq!(order(&session), ids); + (session, ids) +} + +#[test] +fn converting_a_clipping_base_moves_its_clip_and_one_undo_restores_the_tree() { + let (mut session, [base, smart, clip, adjustment, fill, shape, off]) = stack(); + session.execute("layer.select", json!({"layer": smart.0})).unwrap(); + let before = session.active().unwrap().history.past_len(); + session.execute(CONVERT, json!({})).unwrap(); + assert_eq!(order(&session), [smart, clip, base, adjustment, fill, shape, off]); + let doc = &session.active().unwrap().doc; + assert!(doc.is_background(smart)); + assert!(doc.layer(clip).unwrap().clipped); + assert_eq!(active(&session), smart); + assert_eq!(session.active().unwrap().history.past_len(), before + 1); + session.execute("history.undo", json!({})).unwrap(); + assert_eq!(order(&session), [base, smart, clip, adjustment, fill, shape, off]); + let doc = &session.active().unwrap().doc; + assert!(doc.background().is_none()); + assert!(doc.layer(clip).unwrap().clipped); +} + +#[test] +fn converting_an_unclipped_layer_or_the_clip_itself_keeps_other_layers_in_order() { + for convert_clip in [false, true] { + let (mut session, [base, smart, clip, adjustment, fill, shape, off]) = stack(); + let target = if convert_clip { clip } else { fill }; + session.execute(CONVERT, json!({"layer": target.0})).unwrap(); + let expected = if convert_clip { [clip, base, smart, adjustment, fill, shape, off] } else { [fill, base, smart, clip, adjustment, shape, off] }; + assert_eq!(order(&session), expected); + let doc = &session.active().unwrap().doc; + assert!(doc.is_background(target)); + assert_eq!(doc.layer(clip).unwrap().clipped, !convert_clip); + } +} diff --git a/crates/engine/tests/it/main.rs b/crates/engine/tests/it/main.rs index 74e8fba6dd7..bef40ac1e6b 100644 --- a/crates/engine/tests/it/main.rs +++ b/crates/engine/tests/it/main.rs @@ -37,6 +37,7 @@ mod atn_video_frames; mod auto_blend_layer_kinds; mod average_smart; mod background_and_mask_depth; +mod background_from_layer_clip_base; mod background_from_layer_grayscale; mod background_from_layer_history_name; mod background_from_layer_multi_select; From ba86552f6e9ed6a3394f66edee4b373aed678d8a Mon Sep 17 00:00:00 2001 From: dholzric Date: Tue, 1 Dec 2026 18:54:33 -0600 Subject: [PATCH 60/61] Gradient: grey the colour modes on a layer mask in the Classic Mode list (#18634) With a layer mask targeted, Darker Color, Lighter Color, Hue, Saturation, Color and Luminosity are greyed besides Behind. Co-Authored-By: Claude Opus 5.5 --- ...gradient_mask_target_greyed_modes_tests.rs | 64 +++++++++++++++++++ crates/ui-egui/src/tools/gradient_ui/bar.rs | 35 ++++++++-- 2 files changed, 92 insertions(+), 7 deletions(-) create mode 100644 crates/ui-egui/src/gradient_mask_target_greyed_modes_tests.rs diff --git a/crates/ui-egui/src/gradient_mask_target_greyed_modes_tests.rs b/crates/ui-egui/src/gradient_mask_target_greyed_modes_tests.rs new file mode 100644 index 00000000000..5e033dc4691 --- /dev/null +++ b/crates/ui-egui/src/gradient_mask_target_greyed_modes_tests.rs @@ -0,0 +1,64 @@ +//! #18634: with a layer mask targeted, the Classic gradient's Mode list greys Behind, Darker Color, Lighter Color, Hue, +//! Saturation, Color and Luminosity, the modes that need colour or transparency; every other entry stays enabled. With +//! the layer's pixels targeted again, this rule greys nothing. + +use photocraft_doc::BlendMode; +use serde_json::json; + +use super::mode_entries; +use crate::PhotocraftApp; +use crate::state::Tool; + +const GREYED_ON_A_MASK: [BlendMode; 6] = + [BlendMode::DarkerColor, BlendMode::LighterColor, BlendMode::Hue, BlendMode::Saturation, BlendMode::Color, BlendMode::Luminosity]; + +fn app() -> Box { + let mut app = PhotocraftApp::new(photocraft_engine::Session::new(), crate::Services::default()); + app.run("file.new", json!({"width": 80, "height": 60, "background": "white"})).unwrap(); + app.ui.tool = Tool::Gradient; + app.ui.tool_options.gradient_classic = true; + app +} + +/// The greyed entries of the Mode list: `None` is Behind. +fn greyed(app: &PhotocraftApp) -> Vec> { + mode_entries(app).iter().filter(|e| !e.is_enabled()).filter_map(|e| e.value().copied()).collect() +} + +fn expected_on_a_mask() -> Vec> { + let mut v: Vec> = vec![None]; + v.extend(GREYED_ON_A_MASK.map(Some)); + v.sort_by_key(|m| format!("{m:?}")); + v +} + +fn sorted(mut v: Vec>) -> Vec> { + v.sort_by_key(|m| format!("{m:?}")); + v +} + +#[test] +fn a_targeted_layer_mask_greys_the_seven_modes() { + let cases: [(&str, &[(&str, serde_json::Value)]); 3] = [ + ("a pixel layer's mask", &[("layer.new.layer", json!({})), ("layer.layerMask.revealAll", json!({})), ("channel.target", json!({"channel": "mask"}))]), + ("a solid colour fill layer's mask", &[("layer.newFillLayer.solidColor", json!({"color": "#336699"})), ("channel.target", json!({"channel": "mask"}))]), + ("a Curves adjustment layer's mask", &[("layer.newAdjustmentLayer.curves", json!({})), ("channel.target", json!({"channel": "mask"}))]), + ]; + for (case, steps) in cases { + let mut app = app(); + for (id, params) in steps { + app.run(id, params.clone()).unwrap_or_else(|e| panic!("{case}: {id}: {e}")); + } + assert_eq!(sorted(greyed(&app)), expected_on_a_mask(), "{case}"); + } +} + +#[test] +fn the_layers_pixels_targeted_again_grey_none_of_them() { + let mut app = app(); + app.run("layer.new.layer", json!({})).unwrap(); + app.run("layer.layerMask.revealAll", json!({})).unwrap(); + app.run("channel.target", json!({"channel": "mask"})).unwrap(); + app.run("channel.target", json!({"channel": "composite"})).unwrap(); + assert!(greyed(&app).is_empty(), "{:?}", greyed(&app)); +} diff --git a/crates/ui-egui/src/tools/gradient_ui/bar.rs b/crates/ui-egui/src/tools/gradient_ui/bar.rs index 71027229739..a971b1de93c 100644 --- a/crates/ui-egui/src/tools/gradient_ui/bar.rs +++ b/crates/ui-egui/src/tools/gradient_ui/bar.rs @@ -22,12 +22,18 @@ use super::{fill_layer_active, options_changed, stops}; use crate::state::Tool; use crate::{PhotocraftApp, panel_docking}; +/// The modes a layer mask has no use for: they need colour (#18634). The reference greys them, with Behind, while a +/// layer mask is the target. +const COLOUR_MODES: [BlendMode; 6] = + [BlendMode::DarkerColor, BlendMode::LighterColor, BlendMode::Hue, BlendMode::Saturation, BlendMode::Color, BlendMode::Luminosity]; + /// The modes the Classic gradient lists, with a rule above each group: `None` is Behind, third /// after Normal and Dissolve, and greyed where `behind_enabled` is false (the Background, as the -/// Paint Bucket's). The list has no Clear (#12011). -fn blend_modes(behind_enabled: bool) -> Vec>> { - static CACHE: crate::i18n::LangCache>>> = crate::i18n::LangCache::new(); - CACHE.get_or_build(behind_enabled, || { +/// Paint Bucket's). The list has no Clear (#12011). With `on_mask` (a layer mask targeted) the +/// [`COLOUR_MODES`] are greyed too. +fn blend_modes(behind_enabled: bool, on_mask: bool) -> Vec>> { + static CACHE: crate::i18n::LangCache<(bool, bool), Vec>>> = crate::i18n::LangCache::new(); + CACHE.get_or_build((behind_enabled, on_mask), || { let mut keys: Vec>> = crate::blend_keys::tool_modes(Tool::Gradient) .unwrap_or_default() .into_iter() @@ -38,11 +44,23 @@ fn blend_modes(behind_enabled: bool) -> Vec>> { keys.insert(at, BlendKeyEntry::behind(None)); blend_entries(&keys, |entry| Label::from(tl!(entry.key.map_or("Behind", BlendMode::label)).to_string())) .into_iter() - .map(|entry| if entry.value() == Some(&None) { entry.enabled(behind_enabled) } else { entry }) + .map(|entry| match entry.value().copied() { + Some(None) => entry.enabled(behind_enabled), + Some(Some(mode)) if on_mask && COLOUR_MODES.contains(&mode) => entry.enabled(false), + _ => entry, + }) .collect() }) } +/// The Classic gradient's Mode list for the current target. +pub(crate) fn mode_entries(app: &PhotocraftApp) -> Vec>> { + // Behind paints under a layer's pixels: greyed on a mask, a channel or Quick Mask, as the engine refuses it there. + let target = crate::canvas::paint_target(app); + let pixels = target == serde_json::json!("pixels"); + blend_modes(pixels && crate::brush_mode_menu::enabled(app, crate::brush_mode_menu::Item::Behind), target == serde_json::json!("mask")) +} + /// `add` captioned `label` as a field of the bar. fn labelled(ui: &mut egui::Ui, label: &str, mut add: impl FnMut(&mut egui::Ui)) { Field::new(label.to_owned()).show(ui, |ui, _| add(ui)); @@ -60,9 +78,8 @@ pub(crate) fn bar(app: &mut PhotocraftApp, ui: &mut egui::Ui) { let words = Env::of(ui).words::(); let styles: Vec> = GradientStyle::ALL.iter().map(|style| Entry::new(*style, style.label(&words)).icon(style.icon())).collect(); let modes = [Entry::new(false, tl!("Gradient").to_owned()), Entry::new(true, tl!("Classic gradient").to_owned())]; - // Behind paints under a layer's pixels: greyed on a mask, a channel or Quick Mask, as the engine refuses it there. let pixels = crate::canvas::paint_target(app) == serde_json::json!("pixels"); - let blends = blend_modes(pixels && crate::brush_mode_menu::enabled(app, crate::brush_mode_menu::Item::Behind)); + let blends = mode_entries(app); let open_editor; let presets; { @@ -185,3 +202,7 @@ fn preset_picker(app: &mut PhotocraftApp, ui: &mut egui::Ui, at: egui::Pos2) { keep_popup(ui, PresetPopup { open: false, ..popup }); } } + +#[cfg(test)] +#[path = "../../gradient_mask_target_greyed_modes_tests.rs"] +mod gradient_mask_target_greyed_modes_tests; From 55be3688f67f9b4e5c931391b63c5372373341bf Mon Sep 17 00:00:00 2001 From: ruchirguitar Date: Wed, 2 Dec 2026 08:28:13 +0530 Subject: [PATCH 61/61] Check that the Devanagari filter drops a known Latin-only family Counting rows also counted layer rows and passed for an empty list. Inter, the layer's font, is listed before the filter and gone after. --- crates/ui-egui/src/tools/type_tool/font_picker_tests.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/tools/type_tool/font_picker_tests.rs b/crates/ui-egui/src/tools/type_tool/font_picker_tests.rs index c9e87099eef..d2b06737823 100644 --- a/crates/ui-egui/src/tools/type_tool/font_picker_tests.rs +++ b/crates/ui-egui/src/tools/type_tool/font_picker_tests.rs @@ -235,7 +235,7 @@ fn hovering_a_font_adds_no_history_step_and_a_pick_adds_one() { } /// The toolbar's Script select offers the Indic scripts (#10996); picking Devanagari narrows the family list and is -/// kept as the pickers' filter. +/// kept as the pickers' filter. Fonts come from the host, so the test checks only the bundled Latin-only Inter. #[test] fn the_family_list_filters_by_an_indic_script() { let mut h = bar_harness(app_with_layer()); @@ -243,12 +243,12 @@ fn the_family_list_filters_by_an_indic_script() { assert_eq!(h.state().ui.font_filters.script, None, "no script filter at first"); field(&h).click(); h.run(); - let families = |h: &Harness<'static, Box>| h.query_all_by_role(Role::TreeItem).count(); - let before = families(&h); + let inter = |h: &Harness<'static, Box>| h.query_by_role_and_label(Role::TreeItem, "Inter").is_some(); + assert!(inter(&h), "the layer's Latin-only family is listed before the filter"); h.get_by_role_and_label(Role::ComboBox, "Script").click(); h.run(); h.get_by_label("Devanagari").click(); h.run(); assert_eq!(h.state().ui.font_filters.script, Some(craft::font_manager::picker::FontScript::Devanagari)); - assert!(families(&h) < before, "the Latin-only families leave the list ({} of {before} left)", families(&h)); + assert!(!inter(&h), "a Latin-only family leaves the Devanagari list"); }