The trail mask is at most 1024 px on its long side, so on a big document
one mask pixel stands for k x k document pixels, and the Remove trail
sampled only each block's centre. A thin stroke that fell between the
centres (2 px on 6000x4000, k = 6; 4 px on 12000x8000, k = 12) showed no
tint at all, though every pixel it touched is removed. In reach mode a
mask pixel now takes the largest coverage of its whole block, clipped to
the document. Blocks no coverage tile reaches are skipped
(StrokeRenderer::touches), so releasing a whole stroke on a 30000x20000
document restamps in 0.22 s instead of 23 s.
Also pins the waiting strokes' kept tint where a later stroke restamps
its rectangle off its own path (fails with the base max removed).
Co-authored-by: Hartmut Nörenberg <55043719+hnoerenberg@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merged at the fix-up commit before its main merge (362947695d); the
conflicts with the batch are resolved here: psd_import.rs keeps both
sides' tests, tiff_layers.rs takes ImageData::new.
The new plausibility check refused valid files that main opens:
- EXR DWAA/DWAB parts: they go past 2^16:1 (a flat 8192x4320 DWAB frame
with 12 alpha-scheme mattes is 29,948 bytes, 75,629:1; run-length
channels zlib-packed on top reach about 132,000:1). DWA parts now get
2^18:1, so a header of a few hundred bytes can ask for about 100 MB,
not gigabytes.
- BMP RLE8/RLE4: end-of-line, end-of-bitmap and delta escapes leave pixels
unwritten, so no ratio bounds a valid file (an EOB-only 4000x4000 RLE8 is
1,080 bytes). Skipped like HDR.
- GIF: the decoder's size is the logical screen, which needs no data (a
4000x4000 screen with a 1x1 frame is 35 bytes). The first frame must be
backed, and the screen only past 256 MiB, so a 35-byte GIF still can't
declare a 30000x30000 screen.
The declared-size products saturate: a Radiance header of 2^31 x 2^31
read without limits overflowed u64 in debug builds.
Co-authored-by: FinnNk <1424666+FinnNk@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The lazy parse took any error from read_layer_info on a Layr/Lr16/Lr32
global block as a damaged block and dropped the layers. A failed read of
the source (PsdError::Read: a dropped network share, a file rewritten
while it opens) then let a 16/32-bit layered file open silently from its
merged image, with no damage warning, and a save replaced its layers.
A read error now fails the parse, as reading the whole file would.
The new test fails each read of a clean parse once, in turn, and checks
the parse either fails with the read error or matches from_bytes; with
the fix reverted, read 20 of the Lr16 sample drops the layers silently.
Found by CodeRabbit's review of the PR.
Co-authored-by: ptrinh <774083+ptrinh@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Listing every photocraft_raw extension also picked up CR3, ORF, RAF, RW2,
SRF and SR2. The raw decoder can't read CR3, compressed ORF and RAF, or RW2
raw formats other than 3, 4 and 5 yet; import then falls back to the
embedded JPEG preview with only a warning, so a folder batch would process
the thumbnail silently. The folder list now takes the raws whose usual files
decode (DNG, CR2, NEF, NRW, ARW, PEF), and the test pins both sides.
Port of the reviewed fix-up 202ce9c2a (davidmann4/photocraft pr-9097-fixup)
to this batch's file layout: same changed lines, in file_cmds.rs instead of
main's later file_cmds/paths.rs split.
Co-authored-by: .CooCoo <1206598+dotCooCoo@users.noreply.github.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
CI's runners have software adapters, which record SoftwareAdapter for the whole window while the
GPU canvas runs. The flipped-view and over-budget tests now check that state with on_gpu_canvas
instead of expecting no reason at all. Checked locally with the adapter faked as a CPU device.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
When a canvas tool menu (Zoom/Hand view menu, selection menu, etc.) is open
and the user clicks outside it to dismiss it, that click should not also
trigger the underlying tool action (e.g., zoom step). This matches Photoshop
behavior where the dismissal click is consumed.
Fixes#9832
**Changes:**
- Added flag to to track when an outside press dismisses the menu
- Set flag in when returns true
- Added function using actual rendered menu rect from egui's area memory
- In click handler: check dismissed flag first (consume release click), then use accurate menu rect for hit-test
**Testing:**
- All existing tests pass (canvas_tool_menu, zoom_tool, etc.): 60 passed
- clippy passes
- cargo xtask layers passes
- cargo xtask wasm passes
- panic_hunt test passes
Microsoft "Single Package Authoring": Package/Scope="perUserOrMachine"
writes ALLUSERS=2 and MSIINSTALLPERUSER=1, so the package installs
per-user by default (no UAC prompt) into %LOCALAPPDATA%\Programs\ArtCraftPhotoCraft (Windows Installer redirects the ProgramFiles folder in a
per-user install), and per-machine into Program Files\ArtCraft\PhotoCraft
through the setup wizard's "Install for all users" box or msiexec
ALLUSERS=1. Registry follows the context automatically: HKMU writes HKCU
per-user and HKLM per-machine, HKCR classes land in HKCU\Software\Classes
per-user, and components are keyed on registry values (ICE38).
Upgrades update the copy registered in the same context: the remembered
InstallDir is read from HKLM and HKCU separately, and installing in the
other context while a copy already exists is stopped with a message naming
the fix rather than creating a silent duplicate. The existing UpgradeCode,
ProductCode behaviour and per-machine upgrades are unchanged.
The Start Menu shortcut becomes non-advertised in its own component (an
advertised shortcut must target its component keypath, which is now a
registry value), as the ArtCraft Launcher's MSI already does.
Built and checked with WiX 5.0.2: full ICE validation and ICE50 pass, and
the built package's Property table, launch conditions, directory chain and
registry roots were read back from the MSI.
When a canvas tool menu (Zoom/Hand view menu, selection menu, etc.) is open
and the user clicks outside it to dismiss it, that click should not also
trigger the underlying tool action (e.g., zoom step). This matches Photoshop
behavior where the dismissal click is consumed.
Fixes#9832
A software adapter still runs the GPU canvas, so a document that left even that (over the
texture budget, a compositor that failed to build) now names its own reason; the other documents
keep the adapter's. CI's runners have software adapters, where the adapter's reason hid the
document's since 517eb6f2e. Reasons that leave no GPU canvas (CPU mode, a lost device) still come
first.
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Preserve CSH import behavior, inline-data authorization policy, localization and regression tests while retaining upstream module extraction.
Local verification: formatting and independent static review passed. Parser/engine/automation/UI runtime, broader Clippy, WASM and visual gates remain incomplete locally because of resource limits. Hosted CI must establish remaining gates; this commit does not claim the PR is ready to merge.
Preserve the PR's intended behavior and regressions while retaining upstream module extraction and changes. Formatting and independent static review passed.
Local verification: 247 text tests passed (5 ignored), including reordered duplicate-font metadata regressions. Clippy and WASM did not start because the local disk safety threshold was reached.
Local UI verification is incomplete. Hosted CI must establish the remaining gates; this commit does not claim the PR is ready to merge.
Preserve the PR's intended behavior and regressions while retaining upstream module extraction and changes. Formatting and independent static review passed.
Local verification: Runtime tests and broader Clippy/WASM/integration gates remain unverified locally because of resource limits.
Local UI verification is incomplete. Hosted CI must establish the remaining gates; this commit does not claim the PR is ready to merge.
`cargo run --release -p photocraft-io --example bench_export` builds a
36 MP photo document (the opened photo, a painted layer, a soft
half-transparent layer) and times `photocraft_io::export` for .psd,
.pcraft (with and without the per-document export cache the app's Save
uses), TIFF, PNG and JPEG: median and min of --reps runs. --out DIR
writes each format's bytes so two builds' output can be compared.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>