Commit Graph
41 Commits
Author SHA1 Message Date
vangel76 7bc7a61651 Merge upstream/main into pdf-continuous-raster-2895 2026-11-14 00:11:59 +01:00
FredAppsandFredApps 05fc7f2835 Tests: give the nested knockout draw-budget test two minutes, not twenty seconds, on a loaded runner (#3650)
Co-authored-by: FredApps <FredApps@users.noreply.github.com>
2026-11-13 20:27:01 +01:00
vangel76 1241a00a53 Pattern tiles: analyse the backdrop afresh inside a plain clip group
paint_pattern draws the tile content as a tree of its own on a fresh tile, so the
plain-clip state inherited from an enclosing group must not apply there: an inner
clip that blends against the tile was drawn as a plain clip and lost its backdrop.
Save and clear SurfaceBudget::plain around the tile draw, as apply_soft_mask does.
2026-11-13 20:14:33 +01:00
vangel76 0b312d82ab Merge upstream/main into pdf-continuous-raster-2895
Upstream gained region-limited coverage, clip regions, a group nesting cap
in the PDF builder and a render budget. The clipping fast paths (canvas-covering
clips drawn without a surface, plain clip groups on region-sized surfaces) are
ported onto those; the crop-based shape/image/paint changes and the PDF
builder depth cap are superseded by upstream's.
2026-11-13 19:35:53 +01:00
Dylan M. Taylor 92274ec914 Merge remote-tracking branch 'origin/main' into codex/778-effect-migration
# Conflicts:
#	crates/aep/src/container.rs
#	crates/aep/src/container/footage.rs
#	crates/aep/tests/it/container/robustness.rs
#	crates/model/src/fbx.rs
#	crates/model/src/gltf.rs
#	crates/model/src/obj.rs
2026-11-13 02:26:44 +00:00
Altynzhan KarybaiandClaude Sonnet 5.5 4035d18132 SVG: support static pattern fills and strokes (#2732)
* fix(svg): support static SVG patterns

* fix(svg): cache patterns per viewport

* fix(svg): share cached pattern content

* fix(svg): harden pattern cache keys

* fix(svg): harden pattern inheritance and caching

* Preserve SVG pattern fallback paint

* Format SVG pattern fallback conversion

* Harden SVG pattern resource bounds

* Fix SVG pattern test formatting

* fix(svg): bound hostile path and raster work

* Bound SVG ellipse expansion

* fix(ui-egui): suppress clippy warnings on wasm target

Rename unused `frame` parameter to `_frame` in draw_inner since
pointer_wrap::finish_native is cfg'd out on wasm32. Guard State::disabled
field with #[cfg(any(not(target_arch = "wasm32"), test))] so it only
exists where it's read (finish_frame on native + tests).

* fix: resolve clippy warnings blocking CI

- Rename unused `frame` parameter to `_frame` in draw_inner (wasm target)
- Guard State::disabled field with cfg(native + test) (wasm target)
- Replace chunks_exact(2) with as_chunks::<2>() in SVG polyline/polygon parsing

* fix(svg): budget raster work by affected region and report refusals

Address review on #2732: the finite-work guards charged the whole canvas,
dropping valid sparse art (8x8 image scaled to 1px on 2049x2049, 2x2 rect
under a 1,028-element clip on 512x512, one of six 2x2 rects sharing a 1x1
pattern on 3840x2160).

- Build fill/stroke/image/clip coverage over the device region only and
  charge that region; remaining whole-canvas passes are charged to a
  render-wide pixel budget (caps are not raised).
- Add try_rasterize/try_rasterize_with returning RasterError; rasterize
  keeps its signature. media layered decode now surfaces refusals.
- Pattern content reached through href inherits styles from the owning
  pattern; device_region falls back to the full canvas on non-finite input.
- Document new items and the limits in the svg README; regression tests.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-12 21:12:42 +01:00
Dylan M. Taylor 1ae04027df fix app adapters for shared format readers 2026-11-12 06:23:01 +00:00
Dylan M. Taylor fd1df348c0 Formats: move EffectCraft format codecs to craft-libs 2026-11-12 05:33:48 +00:00
Dylan M. Taylor 6ff564e750 SVG: bound tessellation, kept geometry, attributes, entity expansion and re-rendering (#2986)
* SVG: bound tessellation, kept geometry, attributes, entity expansion and re-rendering

Circles and rounded rects flattened at a fixed 0.01 tolerance, so a huge
radius made unbounded curves; the tolerance now grows with the radius as
arcs already did. Every path a <use> copies and every gradient reference's
stops were parsed and kept without a document-wide limit; both now share a
budget of 8 million items. An element with thousands of attributes made
the XML parser's duplicate check quadratic, and repeated entity references
could expand attribute text to gigabytes below the node limit; a preflight
refuses more than 1,024 attributes per element and entity references that
expand past 64 MiB. Nested knockout and non-isolated groups re-rendered
their children several times per level; node draws are now held to 64 per
node of the tree.

* address review: entity_bytes takes the largest declaration of each name

* address review: drop tessellation-tolerance, attribute-count and entity-size refusals; keep retained and draw budgets, warn when the draw budget is hit
2026-11-11 14:39:06 -05:00
vangel76 e30f4f6435 Vector footage: faster, budget-safe clipping in the SVG/PDF rasteriser
Continuously rasterised vector footage (an A4 PDF scaled 200-400 %) is a page of
millions of pixels, and the rasteriser did page-sized work per element:

- Every path, run of text and image computed and walked a coverage mask the size of
  the whole page. Coverage and paint now run over the pixels the shape (fill, or stroke
  outline) or image can reach. A generated A4 page of 720 text-run paths and 60 strokes
  rasterises at 300 % in 0.18 s instead of 4.97 s (200 %: 0.13 s instead of 2.44 s), with
  the same pixels.
- Every clipping group copied the whole backdrop and drew on a second page-size surface,
  so deeply nested clips ran past the 512 MB surface budget and their artwork was dropped
  (at 200 % from the eighth level, at 400 % from the second). A plain clipping group (no
  soft mask, blend mode, group opacity or knockout, Normal content throughout) is now drawn
  straight onto the page when every clip is an axis-aligned rectangle covering each pixel
  the content can reach, and otherwise on a surface the size of its clip. Both give the
  same pixels; groups with a blend mode or knockout inside keep the backdrop path.

Never crash: drawing stops below 256 levels of groups, and the PDF/EPS builder keeps groups
at most 200 deep (a crafted page nesting `q ... W n` twenty thousand deep overflowed the
stack when the document was drawn or dropped).

The 596 x 842 px import size of an A4 page is unchanged: the page in points at 72 dpi,
rounded up, as After Effects takes a point as a pixel.

Refs #2895
2026-11-07 12:56:59 +01:00
bflatastic 3266a84c8d Merge main into #2181; keep both sides of crates/svg/src/pathdata.rs 2026-10-30 00:15:40 +07:00
BFlat 41ae777480 Merge pull request #2288 from Silvertree2010/fix/2128-audit-f-08-svg-arc-with-a-huge-r
Bound SVG arc segment count for huge radii
2026-10-30 00:06:50 +07:00
bflatasticandClaude Opus 5.5 c70fccff99 SVG, FCP XML: bound XML entity expansion (#2129)
A few kilobytes of internal entities expanded to millions of nodes (each top-level
reference stays under roxmltree's per-reference cap), so a 1 MB file exhausted memory.
SVG keeps DTDs, which Illustrator's exports use for entities, but caps the expanded
document at 4 million nodes. Final Cut Pro XML and FCPXML, which FilmCraft parses
without a node limit, are refused when they declare an entity; real exports never do.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 00:01:33 +07:00
NetterSilverandClaude Haiku 5.5 10e173c0e4 Skip whole CSS at-rule blocks in the SVG parser by brace depth
Found while testing crates/svg/src/lib.rs:510-520 (parse_css)

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-28 09:00:16 +01:00
Dylan M. Taylor 4c87a58c1a Use checked access in the WGSL grammar test scanner
The WGSL grammar test scanner indexed token characters directly, so a malformed shader could panic the test instead of failing it. Checked access turns that into a reported violation.
2026-10-26 13:08:12 -04:00
NetterSilverandClaude Haiku 5.5 dbe92141d2 Bound SVG arc segment count for huge radii
Fixes #2128

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-24 14:43:44 +02:00
aiongg 1ea2c0416f Merge #1881: Reject non-finite numbers in CSS colour parsing (@Silvertree2010) 2026-10-24 02:09:49 +00:00
aiongg 5e0dfcfd41 Batch fix: svg: a selector's class checks count against the CSS matching budget (#2159) 2026-10-24 00:37:13 +00:00
aiongg 2ad9204927 Merge #1901: Resolve SVG font-size percentages against the parent font size (@Silvertree2010)
# Conflicts:
#	crates/svg/src/tests.rs
2026-10-23 23:21:29 +00:00
aiongg 43834a52b3 Merge #2159: svg: share CSS declaration blocks and cap <style> work (#2140) (@Barzabel) 2026-10-23 23:21:15 +00:00
Dylan M. Taylor 2cf90507f3 svg: bound raster surfaces and handle duplicate gradient stops (#2190) 2026-10-23 08:38:10 -04:00
NetterSilverandClaude Haiku 5.5 58fbda40b4 Draw a line to the end point of degenerate SVG arcs
Found while testing crates/svg/src/pathdata.rs:228-233

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-23 00:30:59 +00:00
Barzabel 210af24abf svg: allocate a CSS block only for accepted selectors; charge class tokens (#2140) 2026-10-22 21:24:33 +03:00
Barzabel ee13586814 svg: share CSS declaration blocks and cap <style> work (#2140)
Every selector of a comma list cloned the whole declaration block, and every
element scanned every rule, so a sub-megabyte <style> could demand billions of
string pairs. Selectors now index one shared block, the sheets are capped at
20 000 selectors and 50 000 declarations, rules are bucketed by id/class/type
so an element checks only candidates, and matching work over all elements is
charged against a 50M-step budget that fails the import instead of doing it.
2026-10-22 20:28:49 +03:00
NetterSilverandClaude Haiku 5.5 81548edff9 Resolve SVG font-size percentages against the parent font size
Found while testing crates/svg/src/lib.rs:624

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-19 20:22:36 +02:00
NetterSilverandClaude Haiku 5.5 e244d64235 Reject non-finite numbers in CSS colour parsing
Found while testing crates/svg/src/color.rs:182-185

Co-Authored-By: Claude Haiku 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-19 18:25:20 +02:00
Brandon Thomas a32b65cb28 Merge pull request #1369 2026-10-18 09:35:33 -04:00
arnav-hiwarkarandClaude Opus 5.5 2d216151c6 Import: Composition - Retain Layer Sizes for PDF / Illustrator files (#1536)
The PDF / Illustrator import dialog now offers Composition - Retain Layer
Sizes. Each file layer's footage is cropped to its artwork bounds (fills,
stroke outlines, images, clips) and positioned to keep its place on the
page. Decoding, continuous rasterisation, shape conversion and reload share
one crop (effectcraft_pdf::layer_doc_with_sizes), so they agree.

Also collapses a match guard in the STL reader for current stable clippy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 13:33:50 +05:30
DWAA1660andClaude Opus 5.5 79ebd01935 svg: bound <use> expansion by an element budget and skip reference cycles (#1236)
Depth-limited <use> expansion still let a few kilobytes of branching
references expand to 2^N elements. The parser now counts every element it
converts, <use> copies included, against a budget of max(500 000, twice the
file's own elements) and fails the import with Error::Xml once it is spent.
Targets currently being expanded are tracked, so mutual references stop at
the first repeat instead of nesting to the depth limit.

Fixes #1236

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N9kwMcw2pYQ5fSjKa3ZPnh
2026-10-13 16:59:08 -06:00
Brandon Thomas 3d2c4a67a1 Merge pull request #1082 from webdevtodayjason/fix/root-svg-viewport 2026-10-13 04:29:13 -04:00
webdevtodayjason 85a269b609 SVG: non-finite viewBox and nested sizes no longer panic the importer 2026-10-12 13:12:51 -05:00
webdevtodayjason ecc131fc86 SVG: percentages in the root <svg> resolve against its own width and height 2026-10-12 12:54:17 -05:00
webdevtodayjason d9f80ea76f SVG: percentages inside a nested <svg> resolve against its own viewport 2026-10-11 22:36:43 -05:00
Dexter 39e6907b5f G2: improve editing reliability and Windows rendering fidelity 2026-10-06 00:00:31 -05:00
Brandon ThomasandClaude Opus 5.5 19c1d2ea1d Never crash: reject SVGs nested too deeply
roxmltree recurses per element and overflowed a 2 MiB stack at a few thousand nested
elements (aborting the app). parse() now scans the element depth first and returns
Error::Xml beyond 256 levels.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 14:05:58 -04:00
Brandon ThomasandClaude Opus 5.5 6708ff55b4 Never crash: SVG path data no longer loops forever on a number after Z
Path data like "M0 0 L10 0 Z9" repeated Z implicitly for the stray number; Z consumes no
numbers, so the parser looped forever appending close-paths until memory ran out (a 1-byte
change to a valid SVG used 24 GB and was killed). A number after Z is a syntax error, so
parsing now stops there and keeps what was read, as the spec asks. Also denies the panic lints
in the crate (it had no panic sites).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-04 12:14:58 -04:00
Brandon ThomasandClaude Opus 5.5 d15b69c734 M13.12: pdf knockout/isolated transparency groups, group alpha and masks on group results
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 08:46:41 -04:00
Brandon ThomasandClaude Opus 5.5 7d944ca494 M13.6: PDF/AI text, images, tiling patterns, blend modes, soft masks, pages; clip groups to masks / Merge Paths
Text with embedded TrueType, CFF (Type1C / CIDFontType0C / OpenType), Type 1 and Type 3 fonts,
standard-14 fallback to the bundled OFL fonts; Flate / DCT / inline / stencil images with SMask,
Indexed and ICC alternates; luminosity / alpha soft masks and the 16 blend modes in the SVG
render tree; tiling patterns; calculator functions; file.import page and Footage::page;
Create Shapes from Vector Layer keeps clips (page clips as layer masks, nested clips as Merge
Paths Intersect).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 05:49:36 -04:00
Brandon ThomasandClaude Opus 5.5 da0ec526f3 M13.2: PDF / Illustrator (.ai) / EPS vector footage (effectcraft-pdf): continuous rasterisation, layered composition import, Create Shapes from Vector Layer; SVG render tree clip groups
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 04:12:21 -04:00
Brandon ThomasandClaude Opus 5.5 8fc0e257ff M13.5: new StrokeStyle/ShapePath fields in the merged SVG and PSD importers
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 00:35:39 -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 <noreply@anthropic.com>
2026-10-02 22:10:48 -04:00