22 Commits
Author SHA1 Message Date
Brandon ThomasandClaude Opus 5.5 900b921dbf PSD: the optimisation tests use the reference decoder once #1137 and #1139 land together
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 04:47:52 -04:00
Brandon ThomasandClaude Opus 5.5 eb2b734059 PSD: take the integration branch's adapted non-finite test and psd_import formatting (#1149)
The six PSD PRs merged one by one leave #1131's test calling samples()/to_rgb(), which #1139
replaced; vangel76's integration draft #1149 has the adapted version.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-13 04:47:27 -04:00
vangel76andClaude Sonnet 5.5 02c412b835 PSD: release_bytes takes the buffer by value (clippy ptr_arg)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-13 04:47:27 -04:00
vangel76andClaude Sonnet 5.5 5f4b3aee86 PSD integration test: deep groups + NaN text, damaged layer section, huge header under a small budget, on a 2 MiB stack
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-13 04:47:27 -04:00
Brandon Thomas fc54b5debc Merge pull request #1139 from vangel76/fix-psd-decode-memory-budget
# Conflicts:
#	crates/psd/src/lib.rs
#	crates/psd/src/placed.rs
2026-10-13 04:28:42 -04:00
Brandon Thomas ac9d4eb72f Merge pull request #1137 from vangel76/psd-optimise
# Conflicts:
#	crates/psd/src/lib.rs
2026-10-13 04:28:40 -04:00
Brandon Thomas b438cdd702 Merge pull request #1135 from vangel76/fix-psd-lenient-layer-section
# Conflicts:
#	crates/engine/src/psd_import.rs
#	crates/engine/src/tests_vector_import.rs
#	crates/psd/src/tests.rs
2026-10-13 04:28:40 -04:00
Brandon Thomas a55af3b235 Merge pull request #1134 from vangel76/psd-simplify-dedupe
# Conflicts:
#	crates/psd/src/tests.rs
2026-10-13 04:28:39 -04:00
Brandon Thomas e02c60c08a Merge pull request #1131 from vangel76/fix-psd-nonfinite-and-panic-paths
# Conflicts:
#	crates/psd/src/tests.rs
2026-10-13 04:28:31 -04:00
vangel76andClaude Sonnet 5.5 4a08f8fdf4 PSD: a memory budget for one decode and a capped smart-object bake (#1138)
The 2^28 pixel limit applied per image; one composite or layer decode kept
the ZIP output, a Vec<f32> per channel and the result alive together, and the
bake size came from the file's quad. A decode now charges every buffer
against a byte budget (4 GiB, 1 GiB on 32-bit), checks its whole expected peak
before allocating, writes channels straight into the result and returns an
error when over budget. Bakes are at most 4x the document across and 2^24
pixels.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-12 23:06:55 +02:00
vangel76andClaude Sonnet 5.5 35c5ff5fa1 PSD: avoid redundant plane copies, per-pixel mask tests and repeated quad solves (#1136)
Raw channels are borrowed, ZIP planes are un-predicted in place in the inflated buffer,
the 32-bit un-predictor uses one scratch row, the layer mask tests the rect per row
instead of per pixel (and skips a constant factor of 1.0), and a placed-layer bake
solves the quad once and hoists per-triangle invariants. Output is bit-identical;
tests compare against the replaced implementations and count the avoided work.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-12 23:03:35 +02:00
vangel76andClaude Sonnet 5.5 6259bf0b57 #1132: a damaged PSD layer section keeps the merged image instead of failing the document
Psd::parse drops the layers, records Psd::warnings and keeps the header and
merged image; the importer then imports the flattened image as one layer and
reports 'Layers could not be read'. Header damage and a missing merged image
stay hard errors.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-12 23:00:40 +02:00
vangel76andClaude Sonnet 5.5 cf22417c1a PSD: share the duplicated decode, placed-transform and writer helpers (#1133)
One decode_plane for raw/RLE/ZIP (decode_channel and composite), placed::eight and
quad_from for the SoLd/PlLd transforms, the writer's big-endian and UTF-16 helpers
from descriptor.rs, one delimiter const in engine_data.rs, and the dead binding in
write.rs. No behaviour change; adds ZIP and RLE composite tests.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-12 22:58:31 +02:00
vangel76andClaude Sonnet 5.5 130bcb2385 PSD: drop non-finite values from descriptors, EngineData and 32-bit samples; no panic in Warp::apply or Rect::new (#1130)
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-12 22:57:27 +02:00
vangel76andClaude Sonnet 5.5 4f9a04fcf5 PSD import: bound group nesting at 64 so thousands of nested groups cannot overflow the stack (#1128)
Psd::tree flattens groups nested deeper than MAX_GROUP_DEPTH into their depth-64 parent, keeping every layer, so the importer recursion and the tree's Drop/Clone/PartialEq are bounded. The import result reports how many groups were flattened.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
2026-10-12 22:56:56 +02:00
tylerjenningsw 75cc264ccf Lint: clippy's collapsible_match passes on Rust 1.95
cargo +1.95 clippy --workspace --all-targets --release -- -D warnings
stopped on seven `if` blocks that clippy wants folded into their match
arm (psd, text, effects x2, pdf x2, render). Each becomes a match guard.
The behaviour is unchanged: when a guard is false the value falls through
to arms that can't match it and then to `_ => {}`. The one exception is
the PDF PostScript calculator, where a `{` past the nesting limit would
fall through to the operator arm; it keeps its own no-op arm, so it is
still skipped rather than pushed as an operator.
2026-10-10 16:54:16 -04:00
Dexter 39e6907b5f G2: improve editing reliability and Windows rendering fidelity 2026-10-06 00:00:31 -05:00
Brandon ThomasandClaude Opus 5.5 d1413d5209 Never crash: bound PSD descriptor nesting
The descriptor depth limit restarted at 0 inside every nested descriptor (Objc / GlbO /
ObAr), so a crafted file of 100 000 nested descriptors (2.4 MB) recursed until the stack
overflowed and aborted the app. The depth now carries through nested descriptors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-04 14:05:55 -04:00
Brandon ThomasandClaude Opus 5.5 dc573f77e6 Never crash: PSD reader bounds overflow and input-sized allocations
Layer bounds come straight from the file as four i32s. Rect::width/height subtracted them in
i32 (overflow: a panic in debug builds, garbage sizes in release), and layer_pixels allocated
width x height pixels before reading any data, so a 100-byte file claiming a 2^31-square layer
hit "capacity overflow" (or an out-of-memory abort). Widths are now computed in i64 and
clamped, every decoded image is capped at 2^28 pixels (Error::Unsupported beyond that), zlib
data is inflated with a limit of the expected size, RLE count tables and UTF-16 strings
reserve no more than the remaining bytes, and the per-pixel copy only visits the part of the
layer that lands in the output. Denies the panic lints in the crate.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-04 12:27:18 -04:00
Brandon ThomasandClaude Opus 5.5 7b0a449c5f M13.6: PSD smart objects apply perspective quads and placed-layer warps
nonAffineTransform and the warp descriptor (named styles with bend / distortion, custom
envelope quilt meshes via ObAr meshPoints) are baked as placed over the placed bounds
(SourceLayer::placed), at up to 4x resolution.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-03 07:21:00 -04:00
Brandon ThomasandClaude Opus 5.5 7352b624d4 M13.2: PSD smart objects (SoLd/PlLd + lnk2 embedded files) import as placed footage of the embedded document or image
Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-03 04:18:05 -04:00
Brandon ThomasandClaude Opus 5.5 94e1c86d89 IO-2/SHP-5/PRV-2: PSD import, SVG import + vector/text conversions, persistent disk cache
- effectcraft-psd (L1): PSD/PSB reader from Adobe's published file format spec (layers, groups,
  masks, blend modes, text engine data, lfx2 effects, fill/adjustment layers, vector masks;
  1/8/16/32-bit, RGB/CMYK/Gray/Lab/Indexed, raw/RLE/ZIP) and a minimal writer for fixtures.
- File > Import: importAs footage|composition|compositionLayerSizes, layer (Choose Layer);
  groups -> precomps (pass-through collapses), text -> editable text, styles -> Layer Styles,
  adjustments -> adjustment layers with effects; UI asks the Import Kind for Photoshop files.
- effectcraft-svg (L2): SVG parser (shapes, paths, transforms, use, CSS, gradients) and
  rasteriser; .svg imports as footage, continuously rasterised when the switch is on.
- layer.create: shapesFromVector, shapesFromText, masksFromText, editableText (stub removed).
- Disk cache (render::disk_cache): LZ4 content-keyed frames and layer buffers, LRU size limit
  from prefs, atomic writes, restart persistence; edit.purge clears it, cache.diskStats query;
  viewer frames read/write it and the timeline shows disk-only frames in blue.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-10-02 22:10:48 -04:00