feat(lottie): native Lottie decoding via vendored ThorVG#65
Merged
Conversation
The lottie component rendered nothing without pre-rendered frames_dir. Now decodes src/data natively through the thorvg crate (vendored cc-rs build, ~30s, no system deps beyond the C++ compiler skia already requires) behind a default-on lottie-native feature (--no-default-features restores the old behavior and compiles clean). - frame mapping: t*speed against the JSON's fr/ip/op, modulo duration when repeat else clamped; ABGR8888 u32 low-byte-R reinterprets as RGBA bytes (byte order locked by a red-vs-blue pixel test) - thread_local ThorVG engine per rayon worker (!Send), per-call animation+canvas, global frame cache (fnv(source), frame, w, h) with naive clear-at-128 eviction; per-source one-shot warning on invalid JSON, never a panic - frames_dir keeps priority (backward compat); stale 'falls back to static SVG' doc-comment removed (audit finding)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #52 — implementation of the GO decision documented in the issue (evaluation: dotlottie-rs disqualified by its Conan-requiring stale crates.io alpha; velato by its missing CPU renderer and fidelity gaps; thorvg 0.5.0 vendored builds in 30s via cc-rs with zero new system deps).
lottie-nativefeature (components → rustmotion re-export → cli transitively);cargo check --no-default-featurescompiles clean and restores the frames_dir-or-nothing behaviorfr/ip/op(t×speed, modulo duration onrepeat, clamped otherwise); byte order proven by test (ThorVG ABGR8888 low-byte-R ≡ RGBA bytes — red lottie renders red, not blue)thread_local!engine (ThorVG is!Send), per-call animation/canvas, global frame cache keyed(source-hash, frame, w, h)with clear-at-128 eviction (the studio re-requests identical frames in a loop)frames_dirkeeps priority; the audit's lying doc-comment ("falls back to static SVG") is goneTests: 6 new (byte order, repeat wrap, repeat clamp, speed equivalence, invalid-JSON resilience, frames_dir priority). 345 total, all green.
Verify:
cargo test --workspace→ 345 passed ✓ ·--no-default-featurescheck ✓ ·cargo fmt --check✓ · clippy gated ≤1 ✓