A Cmd-click adding the Background to the selection loaded as a plain select that replaced
the selection; a Move to an ordinal of a channel loaded as a layer arrange. Found by
CodeRabbit on #10776.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Brush/Pencil Mode list on main now holds (mode, behind) pairs from brush_mode_menu::choices();
its grouped dropdown tests the pair's mode.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The doc merge left five Actions rows that disagreed (version 12 unsupported vs read; 120 vs
127 events). Found by CodeRabbit on #10776.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
An ordinary paste now remembers the SVG next to the bitmap it took, and a clipboard that no
longer holds the remembered SVG forgets it, so Paste As neither replaces a newer internal copy
with the old SVG nor ignores the same SVG copied again later. Paste As Pixels reads the bitmap
when the SVG read fails. Found by CodeRabbit on #10776.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The remembered name was the Latin-1 reading of the bytes, so a GBK or Shift_JIS name was
written back garbled. Found by CodeRabbit on #10776.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The first value played and saved, the other was dropped. Same rule as the Group I and
Distort mappers' `setting`. Found by CodeRabbit on #10776.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The flag added in the previous commit cannot be shown to do anything: with
it removed, a press on the grip inside the *active* document still drags
the border and still paints nothing. egui gives the press to the grip,
which is laid out after the canvases, so the canvas never sees it — the
reported case does not reproduce. Rather than keep a guard no test can
tell apart, it goes, and the comment says why the order is enough.
What stays is the test it prompted, which is the one the review asked for:
a grab 2 pt inside the active document's edge, with the Brush selected,
drags the border, adds no history entry, and `arranged_cells` reports both
cells meeting at the new position.
Also documents `arranged_cells` and `arrange`, which the docstring check
had nothing to read on.
Main's buffer reuse (#10514) gives Buffer a Drop impl, so moving .px out of it no longer compiles.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A rare windows-1252 capital starting a word counts unless the file's Unicode text writes the Mac Roman letter on that byte and never this one (état, über); Слой1 reads as a Cyrillic word. Tests.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The offset stays within the ±4 the renderer takes; a press that moved nothing (or a drag back to its start with nothing written since) leaves a precise offset untouched; with the Hand tool a drag on a gradient page moves the gradient. Tests.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Supported table read from the batch's events.rs. The PRs' own sections (settings and command
options retained, Render defaults, steps kept disabled) are kept; the known-gaps tables that
#10702 and #10704 close are gone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With our fix-up 8a0f959d29 on top of the author's head 072a87e7b0.
Conflicts with the batch resolved: Image Size keeps #10702's point sizes and
writes `scaleStyles` only when true (no key and false play the same in the
reference application, so recorded steps save back unchanged); Convert to
Profile takes #10704's options; new tests carry #10743's `encoding` field;
#10702's absolute-intent test expects the new Convert to Profile flags.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
#10628 refuses an `_atnEvent` that is not a string; #10632 stores the effect's own event
there as an object, so every gallery step loaded from its own event failed Save Actions.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Distinguish available physical RAM from swap and commit headroom
- Adaptive soft and hard import thresholds with native fallback
- Interactive preflight confirmation modal before pixel decoding
- Headless and command parameters for explicit high-memory approval
- One-shot source-bound validation rejecting altered sources or degraded RAM
- Process-wide serialized decode gate with reentrancy support
- Documentation and synthetic regression test coverage
A Cyrillic step name in a Latin-hinted set (Ёлка in a French set), a Cyrillic word beside a Latin one (Layer Слой) and a windows-1252 name starting with a capital Š or Ž (Škoda) all read as before; the Mac Roman cases of #10774 still read as Mac Roman. Tests for each.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
With the dialog on a Gradient Overlay page, a drag on the image moves the gradient's centre (params.offset, a fraction of the layer's bounds) by the pointer's movement over the layer's size, as a drag moves a shadow. Tests in layer_style and gradient_overlay.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Three review findings:
- A grip overlaps the active document's edge, where the press started a
brush stroke as well as the drag. The frame now records that the press
began on a grip (`arrange_grip_press`) and the canvases ignore it, the
way the inactive-document path already did.
- `drag_border` capped the gap at half the even spacing, so on a 300 pt
axis a 2-up cell stopped at 75 pt although 80 would have fitted. The
cap is gone; the limit is MIN_CELL itself.
- With the neighbours closer together than two minimum cells, the clamp
wrote a value from the wrong side of them and put the list out of
order. That case now leaves the border, and the list, as they were.
The tests cover the short axis and both directions of the no-room case,
and each fails with its own change reverted.
wgpu-hal's D3D12 backend caches each compiled shader and hands every pipeline a clone of the
cached ID3DBlob, calling AddRef under the cache lock and Release outside it
(gfx-rs/wgpu#10547). Compositor::build creates its pipelines in parallel, all from one vertex
entry point and each effect-map kernel twice from one fragment shader, so on D3D12 + FXC the
builds raced on shared blobs and dropping the device could abort (0xc0000409 on CI's WARP runs).
The build stays parallel, but no shader is shared between threads: the vertex stage moves to a
generated module with one entry point per build job; an effect-map kernel builds both formats
in one job; and concurrent Compositor::build calls take turns behind a process-wide lock.
Fixes#9173.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Gradient Editor/Properties strip and Layer Style's Gradient Overlay
ramp ignored the release frame. When the last pointer move came in the
same frame as the release, the stop stayed in the state the previous
frame left it in. A stop flicked off the bar was kept, and one brought
back onto the bar at release was deleted. Both now apply the same
drag-off rule on that frame, as Gradient Map and the shape strip
already did.
The editor strip also counted opacity stops from its preview, which
already leaves a dragged-off stop out. So while an opacity stop was off
the bar, the preview flipped between deleting and moving it every
frame. It now counts the committed stops, like colour stops.
Tests: a quick release off the bar and back onto it (both editors);
colour stops dragged up and opacity stops dragged down are kept; a
cancelled Gradient Map drag adds no history step. The parity row names
Gradient Map's control "Remove stop".
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* perf: reuse large buffers so a pinned glibc trim threshold costs no speed (#10479)
With MALLOC_TRIM_THRESHOLD_ set (#8743), glibc maps every allocation over
128 KiB fresh, so tiles, compositor bands and filter scratch were page-faulted
in on every call: viewport compose 3.6x slower, Gaussian Blur up to 1.8x,
.pcraft save 2.4x.
- photocraft_raster::scratch: a process-wide, capped pool of large Vec
buffers (u8/u16/f32/[f32; 4]). A miss drops the oldest buffers worth its
size down to a 256 MiB floor, so peak memory stays near glibc's defaults.
The engine releases the pool after any command that closes a document,
Headless::close does too, and an idle thread releases it after 2 s unused.
- Tiles, compose Buffer/masks/bands, algo Image and the blur paths, engine
adjustment/filter scratch, GPU tile upload and io import buffers go through
the pool.
- .pcraft save reuses one zstd FrameCompressor per worker (byte-identical).
- interactive_bench reports minor page faults per run.
36 MP, trim threshold set vs glibc defaults: viewport 5.6 vs 6.1 ms (was
22.7), Blur r4 445 vs 437 ms (was 852), Curves CPU proxy 35.0 vs 35.7 ms
(was 50), flatten 146 vs 147 ms (was 237), save .pcraft 251 vs 230 ms (was
545). RSS after closing a 5400x7200 document: 21 MB with trim set.
* fix(linux): restart once with glibc's trim threshold set so closed documents return memory (#8743)
With glibc's default malloc, the memory of a closed document stays with the
process: freeing a large buffer raises glibc's dynamic mmap threshold, so
later tile buffers land in heap pages glibc keeps. A session that opened and
closed a 5400x7200 document held ~450 MiB afterwards.
photocraft_engine::malloc_tuning::apply(), called first in both binaries'
main, re-executes the binary once with MALLOC_TRIM_THRESHOLD_=131072 on Linux
with glibc: same PID, arguments, argv[0] and environment, in safe Rust
(CommandExt::exec). A malloc variable or glibc.malloc.* tunable the user or a
package already set is left alone, so setting MALLOC_TRIM_THRESHOLD_ opts
out. No-op on macOS, Windows, musl and wasm.
Depends on the scratch-buffer pool (#10479), without which the pinned
threshold slows filters, previews, flatten and .pcraft save by 26-209%.
* fix: corpus tests build again; return remaining pooled buffers (#10479 review)
- Corpus-gated io tests and the Photoshop-oracle test moved `.px` out of a
`Buffer`, which now implements `Drop` (E0509 with `--features corpus`):
use `into_px()`.
- io: masks, the merged image, extra channels, smart-filter masks,
smart-object pixels and patterns give their `interleave` buffers back to
the scratch pool after writing them.
- compose: recycle the mask values of a pass-through group, `effect_shape`
and both `split_parts` callers.
- Styled Free Transform preview copies each band out instead of moving it,
so the band returns to the pool.
- interactive_bench: the fault count covers each whole run, untimed setup
included; say so.
* fix: corpus tests build again; return remaining pooled buffers (#10479 review)
- Corpus-gated io tests and the Photoshop-oracle test moved `.px` out of a
`Buffer`, which now implements `Drop` (E0509 with `--features corpus`):
use `into_px()`.
- io: masks, the merged image, extra channels, smart-filter masks,
smart-object pixels and patterns give their `interleave` buffers back to
the scratch pool after writing them.
- compose: recycle the mask values of a pass-through group, `effect_shape`
and both `split_parts` callers.
- Styled Free Transform preview copies each band out instead of moving it,
so the band returns to the pool.
- interactive_bench: the fault count covers each whole run, untimed setup
included; say so.
* fix: recycle the masks of adjustment-atop and shape layers (#10479 review)
* fix: recycle the masks of adjustment-atop and shape layers (#10479 review)
* fix: recycle effect hiding masks (#10479 review)
* fix: recycle effect hiding masks (#10479 review)
* fix: recycle knockout, CMYK and GPU shape masks; release the pool when Split/Merge Channels close a document (#10479 review)
* fix: recycle knockout, CMYK and GPU shape masks; release the pool when Split/Merge Channels close a document (#10479 review)
* fix: release the pool when a closed document's cancelled workers exit; idle-release switch for tests; don't pool PSD planes (#10479 review)
* fix: release the pool when a closed document's cancelled workers exit; idle-release switch for tests; don't pool PSD planes (#10479 review)
* fix: release the pool for workers cancelled before their document closes; take the pool lock for budget and idle-release changes (#10479 review)
* fix: release the pool for workers cancelled before their document closes; take the pool lock for budget and idle-release changes (#10479 review)
* fix: idle release rechecks activity under the lock; try_take_exact releases the pool and retries before failing (#10479 review)
* fix: idle release rechecks activity under the lock; try_take_exact releases the pool and retries before failing (#10479 review)
* test: cover a successful try_take_exact miss; name the failed-reservation test for what it checks (#10479 review)
* test: cover a successful try_take_exact miss; name the failed-reservation test for what it checks (#10479 review)
* fix: pool the final GPU effect shape buffer and return it after use (#10479 review)
* fix: pool the final GPU effect shape buffer and return it after use (#10479 review)
* docs: describe scratch pool lifecycle regression invariants
* test: verify polling releases cancelled document scratch buffers
* perf: recycle remaining transform selection and PSD scratch buffers
* fix: free PSD gather bands before allocating channel planes
* test: assert exact scratch take reuses pooled storage
* perf: reuse large buffers so a pinned glibc trim threshold costs no speed (#10479)
With MALLOC_TRIM_THRESHOLD_ set (#8743), glibc maps every allocation over
128 KiB fresh, so tiles, compositor bands and filter scratch were page-faulted
in on every call: viewport compose 3.6x slower, Gaussian Blur up to 1.8x,
.pcraft save 2.4x.
- photocraft_raster::scratch: a process-wide, capped pool of large Vec
buffers (u8/u16/f32/[f32; 4]). A miss drops the oldest buffers worth its
size down to a 256 MiB floor, so peak memory stays near glibc's defaults.
The engine releases the pool after any command that closes a document,
Headless::close does too, and an idle thread releases it after 2 s unused.
- Tiles, compose Buffer/masks/bands, algo Image and the blur paths, engine
adjustment/filter scratch, GPU tile upload and io import buffers go through
the pool.
- .pcraft save reuses one zstd FrameCompressor per worker (byte-identical).
- interactive_bench reports minor page faults per run.
36 MP, trim threshold set vs glibc defaults: viewport 5.6 vs 6.1 ms (was
22.7), Blur r4 445 vs 437 ms (was 852), Curves CPU proxy 35.0 vs 35.7 ms
(was 50), flatten 146 vs 147 ms (was 237), save .pcraft 251 vs 230 ms (was
545). RSS after closing a 5400x7200 document: 21 MB with trim set.
* fix: corpus tests build again; return remaining pooled buffers (#10479 review)
- Corpus-gated io tests and the Photoshop-oracle test moved `.px` out of a
`Buffer`, which now implements `Drop` (E0509 with `--features corpus`):
use `into_px()`.
- io: masks, the merged image, extra channels, smart-filter masks,
smart-object pixels and patterns give their `interleave` buffers back to
the scratch pool after writing them.
- compose: recycle the mask values of a pass-through group, `effect_shape`
and both `split_parts` callers.
- Styled Free Transform preview copies each band out instead of moving it,
so the band returns to the pool.
- interactive_bench: the fault count covers each whole run, untimed setup
included; say so.
* fix: recycle the masks of adjustment-atop and shape layers (#10479 review)
* fix: recycle effect hiding masks (#10479 review)
* fix: recycle knockout, CMYK and GPU shape masks; release the pool when Split/Merge Channels close a document (#10479 review)
* fix: release the pool when a closed document's cancelled workers exit; idle-release switch for tests; don't pool PSD planes (#10479 review)
* fix: release the pool for workers cancelled before their document closes; take the pool lock for budget and idle-release changes (#10479 review)
* fix: idle release rechecks activity under the lock; try_take_exact releases the pool and retries before failing (#10479 review)
* test: cover a successful try_take_exact miss; name the failed-reservation test for what it checks (#10479 review)
* fix: pool the final GPU effect shape buffer and return it after use (#10479 review)
* docs: describe scratch pool lifecycle regression invariants
* test: verify polling releases cancelled document scratch buffers
* perf: recycle remaining transform selection and PSD scratch buffers
* fix: free PSD gather bands before allocating channel planes
* test: assert exact scratch take reuses pooled storage
- ui.dialog.set refuses `__dialog` and `__field` on an open Color
Picker. Otherwise automation could point the picker's OK at another
dialog than the one its live preview showed the colour in.
- Cancelling a dialog closes only the field pickers the live preview
records for it. A `__dialog` match counts only for a picker without
a live record, so a rewritten `__dialog` can no longer close another
dialog's picker and put that dialog back as it was.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A ui.pointer press while a Brush or Crop gesture begun before the dialog
was still open centred the preview and held a locator press, but the
moves and release that followed went to the earlier gesture, so the
preview stopped following and the stroke or frame changed instead. No
mouse can press twice, so drop that press: it neither centres the preview
nor reaches the tool, and the open gesture still finishes on its own
moves and release. Tested, and the Crop test now checks the frame after
the move as well as after the release.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test only checked that a preview existed, so one keeping every stop
until release would have passed.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dragging a colour stop down, or an opacity stop up, by about a marker's
height off the gradient bar now removes it on release in every stop
editor, as in Photoshop's Gradient Editor. At least two stops of that
kind always stay. While the stop is off the bar the ramp and the
preview show it gone, and dragging it back onto the bar cancels.
The Gradient Editor, Properties and shape gradient strips already did
this. Gradient Map had no drag-off at all, and Layer Style's Gradient
Overlay only deleted after about 44 pt and showed nothing until
release. All four now share stop_dragged_off() in gradient_ui.rs
(26 pt past the bar edge, by kind). Gradient Map and Gradient Overlay
take the stop out live and put it back if it returns.
Adds harness tests for drag-off removal, the two-stop minimum,
opacity stops dragged up and drag-back cancel, and updates
docs/ui-parity.md.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>