With more documents than tiles, the run of shown documents was worked out from the active
index alone, so after activating document 2 in Two-up, a click into the visible document 1
moved the tiles back to [0, 1]. The run is now kept from frame to frame and slides only when
a hidden document becomes active.
The font menu gains Photoshop's local font library and filters (everything but
Adobe Fonts):
- Favourites: a star on every row (never picks the font) and a favourites-only
filter. Kept in the preferences (type.favoriteFonts).
- Recent fonts: up to five, most recent first, above a divider. Wires the dead
Preferences > Type > Recent Fonts (now 0..5, default 5; older saved values
are capped on load).
- Class list: All Classes, Serif, Slab Serif, Sans Serif, Script, Monospace,
Handwritten, Blackletter, Decorative, read from each font's OS/2
sFamilyClass, PANOSE and post tables (photocraft_text::font_class), else its
name. Fonts that state nothing stay unclassified.
- Show Variable Fonts, Show Similar Fonts (PANOSE/class/weight distance to the
current font) and Clear All; the class list collapses with «.
- Each row: style expander (">") that picks a family in a given style, and an
O / TT / VAR format badge.
- A preview at the top sets the type layer's own text (or the selection being
typed) in the font under the pointer.
- The search field and filters stay fixed while only the list scrolls, and the
search field lines up with the font list.
Commands: type.font.favorite, type.font.noteRecent, type.font.clearRecent,
type.font.library. Two original icons (font-similar, font-variable).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
paint::color followed a spot colour's RGB equivalent and base colour with
no depth limit. Colours are shared objects, so a spot colour that links to
itself overflowed the stack and aborted the import, and a chain whose levels
link to the next through both took exponential time. Stop after 4 levels of
spot colours defined through spot colours, with a warning.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Ending an empty Type Mask undoes its session, and undo restores the layer selection from
before it, so selecting another layer (or Deselect Layers) during the session was reversed.
`end_if_left` now restores the selection the user made when the commit moved it, through a new
`Session::restore_layer_selection` (drops gone layers, refuses a gone active layer, keeps a clean
document clean).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Clicking another layer while the caret was in a type layer left the edit open, so single-key
tool shortcuts were typed instead. #5612 covered Layers-panel row clicks; every other route
(layer menus, the canvas layer picker, Deselect Layers, automation, a document tab, New/Open)
still left the session open.
A frame guard (`type_tool::end_if_left`) now commits once the edit's layer isn't the active
layer or its document isn't active. `TextEdit` records its document: layer ids repeat across
documents (one .pcraft opened twice), and typing after a tab switch used to edit the other
document's same-id layer. Commits run in the edit's own document; a closed document's edit
is dropped without running anything.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The dock lists the tabs that lay out their own scrolling list and footer so it
does not wrap them in a scroll area of its own (Layers, History, Navigator).
Channels and Paths do exactly the same, but were left off, so each sat inside
the dock's scroll area as well as its own, and the two nested areas shared the
mouse wheel. At 125 % display scaling, for some window heights, the outer
content overflowed by one physical pixel and scrolled with the list: the footer's
buttons moved about a pixel while scrolling down and back while scrolling up.
Group::scrolls_itself now covers all three tabs of the Layers group.
Measured: with 30 paths, the footer moved at 31 of 723 window-height and scale
combinations (all at 125 %); with the change, none. The reporter's video agrees:
the footer strip shifts 1 px and back repeatedly while the tab strip never moves.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
panel_footer lays its 30 px bar over the body's bottom margin ("the bar runs on
over the margin"), but the bar's Ui inherited the body's clip rect, which ends
where the content does. The bottom of every footer button was clipped: a 26 px
hover highlight was drawn about 21 px tall with a flat bottom edge. This is the
"icon looks cut off when you hover over it" in the Paths panel, and it affects
the Layers, Channels and History footers too, since they share the widget.
The footer bar now extends its own clip to the whole bar.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Preserve main’s contributor entries and Auto scaling documentation while
retaining the intermediate fixed presets and their existing tests.
Add the four labels to the Hungarian, Serbian, Turkish, and Vietnamese
catalogs. Adopt #3396’s UI-217-9 note and UI parity/gap updates, then
regenerate the scorecard.
Co-authored-by: kartik8dwivedi <codewithme.kartik@gmail.com>
The mock made its MessageIterator inside the spawned thread. A zbus stream
only sees messages that arrive after it is created, so on a loaded runner the
client's SaveFile could land first, go unanswered, and hang the test until
nextest's 600 s timeout (a_typed_extension_wins_over_an_untouched_file_type
on ubuntu-latest, PR #6468).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With a shape layer selected, picking a colour in the Color panel, clicking
a swatch or confirming the foreground Color Picker only changed the
foreground colour: the panels recoloured selected type and nothing else,
so the shape kept its fill. A Gradients panel click recoloured a selected
Gradient Fill layer but ignored shapes. As in Photoshop, these now fill
the selected shape layer.
A new foreground fills the shape with a solid colour, keeping the fill's
own opacity; a Color panel drag is one undo step (edits coalesce on the
press time), each click its own. A gradient preset fills the shape with
the gradient, keeping an existing gradient fill's angle, style, scale and
reverse. Locked shapes are left alone: the Color panel only changes the
foreground, and gradient.presets.select refuses before it changes the
Gradient tool's gradient.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes#3708; part of #1540 (Flatpak needs its own follow-up: each sandbox has its own loopback).
A second launch hands its files to the running instance over an authenticated loopback channel (random port, 32-byte token in a private instance.json, constant-time check, bounded clients, requests and paths). Files are acknowledged only once the UI has taken them; the instance shuts the hand-off down before a CPU-compatibility relaunch; it runs only in the per-user settings mode. --new-instance and PHOTOCRAFT_NEW_INSTANCE=1 opt out.
Thanks to @MrCloudy2 (#2358), whose Linux version first handled the relaunch and per-user endpoints, and @Desayuno64 (#5273), whose shutdown flag and read deadline informed the final design.
Both harnesses built their device with egui_kittest's .wgpu() (egui's default limits) instead of
gpu_canvas::wgpu_setup() (the adapter's own limits, what the app requests), as #5954 fixed for the
background_redraw and navigator tests. On that device:
- canvas_16f's sixteen_bit_gradient_on_screen and thirty_two_bit_preview_exposes_values_above_one
panicked in egui-wgpu ("Failed to create staging buffer for index data", renderer.rs:984), every
run, single-threaded too;
- arbitrary_rotation_preview's two tests failed "the fixture must use the GPU canvas".
Both binaries pass on the app's device.
validate_token accepts uppercase hex and server_token keeps the token
lowercased, but authentication_reply passed the client's token to
token_matches unchanged, which compared bytes exactly. A client sending
the token exactly as configured (--control-token or a token file in
uppercase) was refused; only the bundled bridge, which lowercases, got in.
token_matches now folds ASCII letters on both sides, still without an
early exit. Only A-Z fold, so a non-hex byte never matches a hex digit.
Keep the selected shape's stroke when width reaches zero so subsequent
width edits retain its paint and geometry settings in both UI controls.
Preserve explicit No Color removal and gesture-scoped undo behavior.
Add real-widget regressions for style retention, native persistence,
rendering, undo/redo, and deliberate stroke activation.
Fixes#6191.
Save for Web (Legacy) gains a WebP format: lossy through our VP8 encoder at
the dialog's 0-100 Quality, or lossless (new `lossless` param). Translucent
pixels keep their alpha as in PNG-24 (matte when Transparency is off); Embed
Color Profile and the Metadata choice apply as for JPEG. The lossy preview
decodes the file so its artefacts show; 4-Up halves a lossy quality.
AVIF and JPEG XL from #6391 are not included.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
With port 0 the OS picks a free port, but the control server printed the
requested one (`127.0.0.1:0`), so a client had no way to find it. It now
prints `listener.local_addr()`, like `photocraft-cli serve` does, falling
back to the requested port if the OS can't report it.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Save As on Linux: the file type picked sets the extension (#6121, #4328, #4394)
The GTK file chooser behind the desktop portal keeps the typed name when
another file type is picked, and rfd 0.17.2 reads only the file name from
the portal's answer, so Untitled-1.psd with PNG picked was written as a
PSD. On Linux, Save As now asks the portal's FileChooser.SaveFile itself
(over the zbus already used for the portal), reads current_filter, and
gives the name that type's extension: an extension PhotoCraft saves is
replaced, none or another is appended. If that names an existing file, the
dialog opens again under the new name so the portal asks before replacing
it. rfd remains the fallback without a portal, and this can go once an rfd
release reads current_filter (PolyMeilex/rfd#341).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* Save As on Linux: keep typed extensions, open on the stem, follow the request handle
Review follow-ups, checked on real GNOME 46 and KDE Plasma 6.7.5 sessions
(Wayland and X11):
- An extension the user typed is kept, as in PolyMeilex/rfd#341: only a
name with none, or still with the extension the dialog opened with, takes
the picked type's. GTK reports the type even when it is untouched, so
art.png with the PSD type left alone was saved as art.psd.
- The dialog opens on the stem (test), as on Windows (#4407): with
test.psd in the name and PNG picked, GTK asked to replace test.psd,
which the save leaves alone. A name that then exists is asked about
again under that name; the rule compares against the suggested name, so
a test.psd GTK completes back still becomes test.png.
- Response 2 (GNOME's dialog closed with Esc) is a cancel: it fell back to
rfd, which opened a second Save As.
- The answer is awaited on the handle SaveFile returns, which a portal
older than 0.9 picks itself (the Request documentation).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* style(automation): format smart filter refresh closure
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Co-authored-by: skylar taylor-barrick <hi@skylar.cc>
build_palette (Adaptive, Perceptual, Selective; Exact shares the histogram) now
gives exactly the same colours, faster. Release, 24 MP, 256 colours, median of 5:
| case | before ms | after ms | speed-up | 1 thread before | 1 thread after |
|-------------------------|----------:|---------:|---------:|----------------:|---------------:|
| photo-like Perceptual | 5068 | 601 | 8.4x | 4841 | 1651 |
| photo-like Adaptive | 4044 | 608 | 6.7x | 3859 | 1251 |
| photo-like Selective | 4862 | 617 | 7.9x | 4720 | 1716 |
| noisy Perceptual | 14124 | 1643 | 8.6x | 13726 | 4018 |
| noisy Adaptive | 10891 | 1485 | 7.3x | 10600 | 2701 |
Max RSS, photo-like Perceptual (whole probe, 384 MB image included): 802 MB
before, 644 MB after. Noisy: 1667 MB before, 1151 MB after.
What changed:
- median_cut keeps each box's (axis, score) and rescans only the two boxes a
split makes, instead of every box on every split.
- median_cut sorts big boxes with a stable radix sort on the f32 total_cmp
order (same order as sort_by, ties keep their input order).
- histogram packs pixels to u32 and sorts and counts them, instead of a
SipHash HashMap insert per pixel.
- k-means finds the nearest centre for all points in parallel, then adds the
f64 sums serially in the original point order.
- The Lab conversion of the histogram runs in parallel (order kept).
- to8 no longer calls libm roundf per channel; it is checked equal to
f32::round for every one of the 2^32 floats.
Every palette hash matched before and after for Adaptive/Perceptual/Selective/
Exact at 256/64/16 colours with no forced colours and Black and White, on a 24 MP
photo-like image, a 24 MP noisy image, a small image with fewer colours than
requested, a 300-colour image and a semi-transparent image. New tests pin a
recorded palette from the old code and compare median_cut, k-means and the
radix sort with the old code bit for bit.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AfRHB1wHUjrJx6agBYGnVu
* GPU memory: a graphics card's own memory isn't charged for the document; GPU Memory preference; GPU Memory Full in the status bar
Many layers hit a cliff: past what the GPU memory budget leaves for layer pages, every edit
that redraws the whole document (opacity, visibility, a nudge) goes to the CPU compositor.
Measured on 3000x2000 full-canvas layers (RTX 5090, 31 GB RAM, Memory Usage 8 GB): 150
layers took 2.6 s per such edit, 300 layers 6 s. The budget was Memory Usage minus the
document's pixels and History, which is right where the GPU shares system memory, but a
discrete card's memory doesn't hold the document, so 150 layers of 6 MP (3.6 GB) squeezed
the budget below what they needed.
- Automatic budget: discrete adapters are no longer charged for the document's pixels
(integrated and software adapters still are). 150 layers: 2.6 s -> 25 ms.
- Preferences › Performance › GPU Memory (MB, 0 = Automatic; performance.gpuMemoryMb) sets
the budget outright. 300 layers with 12 GB: 6 s -> 45-72 ms.
- The status bar shows "GPU Memory Full" while the active document's layers don't fit
(both status bar styles); hovering gives the numbers, clicking opens Preferences ›
Performance. Its Graphics rows show the budget and what the layers need. The slow CPU
redraw notice gives the numbers and points at GPU Memory.
- Headless: the preference is a normal pref (prefs.set), and ui.state's perf.timings
reports gpuLayerFit {doc, needed, budget} next to gpuBudgetMb.
Next (owner-approved plan): after #5370, read the card's real limit from the driver
(wgpu memory budget thresholds) and shrink on out-of-memory; then redraw the visible
area on the GPU first when layers still don't fit.
* GPU memory: typed discrete check; the status and budget follow a GPU Memory change at once (measure_fit); perf rows P60/P61 for whole-document edits among 150 full-canvas layers under the app's budget
* GPU memory on top of #5234: memory_budget takes the card's memory (vram) and the GPU Memory value; the document's pixels are charged unless the card's own memory is known; a set GPU Memory is capped at the card's share; benches use video_memory
With the Hand tool selected, Cmd (Ctrl off the Mac) held is a temporary
Zoom In and Alt (or Cmd+Alt) a temporary Zoom Out, as in Photoshop: a
click steps the zoom, a drag scrubs (or draws a zoom box with Scrubby
Zoom off), the magnifier cursor shows, and letting go gives the Hand
back. Latched Window > Modifier Keys count too.
Not while Free Transform is open (Cmd is its distort key), and a
modifier pressed during a Hand press, release included, doesn't turn
it into a zoom: only a press made with the modifier held zooms.
docs/ui-parity.md: Navigation row added; Scroll All Windows and Bird's
Eye View recorded as missing.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* perf(gpu): cap the GPU memory budgets by a discrete GPU's own memory
The compositor and canvas budgets came from system RAM only, so a 16 GB card in a 96 GB machine planned for up to 8 GB of compositor pages plus 24 GB of display textures. Detect a discrete adapter's dedicated memory (DXGI on Windows through winsafe, amdgpu sysfs on Linux) and cap each budget at three eighths of it. PHOTOCRAFT_VRAM_MB simulates a smaller card. Fixes#4536.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* perf(gpu): keep a 16-bit canvas on the GPU in 8-bit when floats don't fit
With the canvas budget capped by a small card's memory, a 16-bit document under the float-canvas pixel limit could need more than the budget as Rgba16Float and fall back to the CPU canvas although its Rgba8Unorm set fits. Choose the float canvas only when it fits the budget, which is now shared atomically so format_for can read it while the renderer is locked.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
* perf(gpu): detect a card's memory once per adapter, and test the Linux reader
video_memory built a DXGI factory each time it was asked, three times at
startup; it now remembers the answer per (vendor, device), so a GPU retry
that picks another adapter still gets its own. The amdgpu sysfs reader
takes the drm folder as a parameter and is tested against a temporary
folder: the matching card's VRAM, a card without the file, garbage ids, a
malformed size, no match and no folder.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
- The CPU canvas texture and the crop's beyond-canvas bands were reduced to fit MAX_TEXTURE (4096)
whatever the device allows. On a device with a smaller limit (2048 on some older GPUs and WebGL
contexts) a 2600 px document was uploaded at full size: egui asserts and the backend can't
create it. They now fit the smaller of the two. Test: cpu_canvas_texture_fits_the_device_limit.
- background_redraw and navigator GPU tests built their harness with egui's default wgpu limits
instead of the app's wgpu_setup (the adapter's own limits), and the GPU canvas lost the device
on it ("Device is lost", every run on an RTX 5090). They now use wgpu_setup.
- Eleven tests built a wgpu device without photocraft_testkit::gpu_lock, which testkit requires so
devices aren't created concurrently; they now hold it.