Test-only oracle from PhotoCraft abb30dff47 crates/io/src/linked.rs. The original parser/writer is by Brandon Thomas (536a7346fb); includes subsequent contributor fixes from source history. This module is compiled only through cfg(test).
* io: assert the embedded-SVG depth boundary is blank
The deepest-chain test treated any Ok raster as an accepted chain. At MAX_EMBEDDED_SVG_DEPTH + 1 the bounded non-strict path intentionally omits the image and returns a transparent canvas, so the test asserted the opposite of the documented behavior. Check that the over-limit image is blank instead.
* automation: pin hardlink write-over behavior
A hardlink inside a granted root shares the inode of its other name, so reads can see that content. Document that a write-over atomically replaces the directory entry inside the root and leaves the other name untouched, with a Unix regression test.
* chore: cut over remaining resvg and roxmltree usages to craft-svg and craft-xml
* Cut over remaining photocraft-io TIFF tests, rawinfo example, and move exr to dev-dependencies
* chore: remove unused zune-jpeg workspace dependency
* style: cargo fmt
Review on #14385: a second unpack refused for size returned without
charging the recheck allowance, so each later oversized SVGZ could repeat
a near-budget inflation.
Every second unpack is now charged at least what it unpacked (its whole
limit when refused for size or damaged), so all of them stay within one
byte budget per drawing, and nothing more is classified once the drawing
is over budget.
Review on #14385: craft-svg limits an embedded SVG's bytes before it
decodes them, so a Latin-1 document fits and is charged its longer UTF-8
text; the wrapper counted that as an unread charge and then let a later
refusal pass. And after an unreadable image, every later refused image
was unpacked again against almost the whole budget.
note_byte_refusal now unpacks within what craft-svg has left, as it does:
accepted is not a refusal, whatever it is charged. Only a size refusal
after unread charges is unpacked again, within the budget less the
drawing's content and within one budget of rechecks per drawing; past
either, the drawing is over budget.
Review on #14385: once an unreadable embedded SVG had been charged the
rest of the byte budget, every later image refused for bytes was left
out, including one too large for the whole budget on its own.
The bounded resolver now counts what craft-svg charged images it could
not unpack (and readable ones those charges starved), and checks each
image against the budget less only the drawing's own content. An image
past that still fails a non-strict parse; one refused only because of
those charges is left out.
Since the craft-svg migration, parse_with failed the whole drawing whenever the
resolver refused an embedded image for the raster-pixel or byte/nesting budget.
The resolver already leaves such an image out of the tree, so the drawing can
still open, as it did before. The bounded smart-object path keeps refusing.
Fixes three tests in photocraft-io --test it: embedded_png_with_a_huge_claimed_size_is_not_decoded,
gzip_compressed_embedded_svg_decompresses_once_with_a_size_cap,
an_embedded_svg_gets_only_the_nesting_depth_the_drawing_left.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Review on #14385: inferring the reason from craft-svg's totals refused a
drawing with a damaged embedded SVGZ (charged the whole byte budget like
a nested gzip), and one with a chain at the cap beside an image only too
deep in XML.
The bounded resolver now repeats craft-svg's first two checks for each
embedded SVG, in its order: the chain depth, then unpacking within what
the byte budget has left. Only a refusal at the chain cap or for bytes
fails a non-strict parse; an image that can't be unpacked is left out,
and so are images refused for bytes after it spent the budget.
craft-svg counts an embedded SVG refused for the byte budget, the chain
depth, the shared XML depth or gzip inside gzip as one svg_limit image,
and charges it whatever the byte budget had left. c2689ba21 let a
non-strict bounded parse leave all of them out, so a chain of embedded
SVG images past the 16 MiB budget rendered with its innermost images
dropped instead of being refused.
The bounded resolver now also notes gzip-in-gzip images, and a non-strict
parse is refused when the byte budget is spent (unless a nested gzip
spent it) or the chain reached MAX_EMBEDDED_SVG_DEPTH. An image only
nested too deeply in XML, or holding gzip inside gzip, is still left out.
Concavity is a whole number from -50 % to 50 % of the head's length, as in
Photoshop. A negative value bends the head's base away from the tip, and the
shaft now ends where the bent base crosses the shaft's edge. Values outside
the range (documents, PSDs and settings saved with the old 0..100 range) are
clamped to the nearest end instead of failing.
- vector: arrow_line bends the base by concavity x length, both directions
- engine: shape.create / shape.edit take arrowConcavity in -50..=50
- io: PSD import keeps negative concavity, clamped to -50..50
- ui: gear and Properties Concavity are whole-number fields with the
"Closest value inserted" alert; the gear menu stays open on clicks inside
so a value can be typed
A new live shape kind, LiveShape::Triangle { rect, corner_radius }, draws an isosceles triangle that fills the dragged box (apex at the top centre, then bottom right, bottom left). The engine no longer turns a triangle into an inscribed 3-sided polygon. Triangles saved before this are 3-sided polygons and keep that geometry.
The .pcraft manifest stores a live triangle in a new optional triangle_live field beside live (as arrow_live does), so older builds open the file and show the saved path. PSD export writes no vogk for a triangle, as for polygons.
Arms the new kind forces: live_kind, the axis-aligned transform, params, the corner radius widgets and the Properties Shape section (Corner radius only). Shift keeps today's equilateral triangle, sent as its tight box.
Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Model-Effort: Opus 5.5 drove; Fable 5.2 briefed; Sonnet 5.5 wrote at medium
* Use craft-psd from craft-libs; remove crates/psd
* Regenerate the scorecard (28 crate roots)
* Take craft-psd at craft-libs 55d120f2
* Regenerate lockfile for current shared format crates
* Pin shared format crates to current craft-libs main
* Match brush import cap to shared decoder budget
* xtask: update layer fixtures after PSD extraction