mirror of
https://github.com/storytold/photocraft.git
synced 2026-11-10 18:20:31 -06:00
The live preview only covered selections up to 256x256 px; larger ones (the command takes up to 16 M) errored, the UI remembered the failure and showed nothing until release. Engine: a preview whose selection (or landed area) is over 256x256 is now solved on a scaled-down copy of the area around the selection and where it lands (area-average resize of the target, or of the composite with Sample All Layers, and of the selection), on a one-layer document of its own, then enlarged back (bilinear, float samples, so any depth) over the selection's shape where it lands and, for a move, where it left. The landed content is sampled through the scaled placement, so rounding the scaled offset does not shift it. ContentAwarePreview::refine gives the full-resolution job, with the command's own margin, so the refined preview is the command's result bit for bit. Every step checks the JobCtx; the session is never touched; bad params and selections over the command's limit still error. Selections within 256x256 take the unchanged path (same output as before, checked by hash against main). The bilinear resampler used by Transform On Drop now runs its rows in parallel (same results). Measured (release, 24 MP 8-bit document, Ryzen 9 7950X with other builds running): coarse preview 600x400 0.26 s, 1500x1000 0.38 s, 3000x2000 0.69 s (256x256 full-resolution preview: 0.21 s); the exact refine takes as long as the command (0.8 s, 4.1 s, 9.4 s). UI: cam_preview shows the coarse result, then starts the refine as a second cancellable job and swaps it in; a failed refine leaves the coarse result shown, and a failed first job is still not retried. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>