Skip to content

Render Discord Lottie stickers with tlottie - #21

Merged
itz4blitz merged 1 commit into
itz4blitz:mainfrom
vbmithr:feat/lottie-stickers
Oct 17, 2026
Merged

itz4blitz merged 1 commit into
itz4blitz:mainfrom
vbmithr:feat/lottie-stickers

Conversation

@vbmithr

@vbmithr vbmithr commented Oct 17, 2026

Copy link
Copy Markdown
Contributor

Discord Lottie stickers were downloaded as JSON but displayed a broken-image placeholder, and the sticker picker omitted them. Render them natively using tlottie's Rust CPU backend, pinned at 92df98dc209bc39b1e567ec74a8c86a0af5239de.

Feed decoded frames into the existing image cache and animation playback controls. Keep a first-frame fallback when animation is disabled or cannot fit, preserve transparency, and reuse the frame/byte budgets. Bound input size, canvas dimensions, source frame count, rendering resolution, and decode time. The renderer does not resolve external image/font references. Register Lottie files in the Discord picker using the same media IDs as incoming stickers. The dependency is GUI-only; daemons and non-GUI builds do not link it. Telegram compressed TGS support is unchanged.

Includes an authored JSON fixture, rendering/cache/cropping regressions, the updated Discord picker fixture, and design documentation. Based directly on current upstream main, independently of the companion cached-image/tooltip fix.

Validation:

  • Four Lottie rendering/cache tests pass, covering moving pixels, timing, straight BGRA transparency, still/zero-budget fallback, resource limits, and portrait cropping.
  • Focused Discord picker/send integration test passes against scratch servers; all 12 non-GUI tinyclient tests pass.
  • With the companion image-decoding fix, all 325 GUI-feature tests passed (one ignored) and Arch package revision 19 built successfully.
  • The actual cached sticker from the report rendered 120 frames at 160×160 (12,288,000 decoded bytes) in about 47 ms, with matching first-frame fallback. A rendered frame was visually inspected. Interactive GUI playback was not tested.
  • git diff --check passes.

@vbmithr
vbmithr requested a review from itz4blitz as a code owner October 17, 2026 16:30
itz4blitz
itz4blitz previously approved these changes Oct 17, 2026

@itz4blitz itz4blitz left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lottie JSON is rendered on the CPU into the existing frame cache, GUI-only, with the input, canvas, frame, and two-second budgets the tests cover. A still first frame is kept when animation is off or will not fit, and the picker registers the same sticker id a received message uses. The straight-BGRA conversion matches the fixture. macOS, Linux, and Windows are green on 3c5b347.

This and #22 both insert a paragraph after the same line in docs/design/polish/06-composer.md. I am merging #22 first; if this no longer applies cleanly it needs a rebase that keeps both notes.

@itz4blitz

Copy link
Copy Markdown
Owner

Approved on 3c5b347, and macOS, Linux, and Windows were green. It no longer merges: #22 landed first and both branches edit crates/tinyclient/src/gui/conversation/images.rs and docs/design/polish/06-composer.md.

Please rebase onto current main and keep both. #22 detects still-image formats from the bytes and refuses to enlarge a thumbnail; this branch's Lottie path should stay in front of that decoder. The design note should keep both the still-image paragraph and the Lottie paragraph. I'll merge once that rebase is green.

Render cached Lottie JSON natively into the existing animation cache,
including sticker-picker previews. Keep still-frame fallback, playback
settings, frame budgets, bounded parsing, and transparent BGRA output.
Pin the GUI-only CPU renderer without adding daemon dependencies.

Add synthetic rendering and cache regressions, extend the Discord picker
fixture, and document resource limits. The reported cached sticker
renders correctly, including its first-frame fallback.

Co-Authored-By: GPT-6 <noreply@openai.com>

@itz4blitz itz4blitz left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rebase onto main kept both sides. Lottie still decodes before the still-image path, Linux and Windows still guess the format from the bytes, and a thumbnail still will not enlarge a smaller source. The design note keeps the still-image paragraph, the Lottie paragraph, and the Wikipedia section. I'll merge once macOS, Linux, and Windows are green on fb85278.

@itz4blitz

Copy link
Copy Markdown
Owner

macOS failed in Test (no GUI) on the existing Slack spacing assertion in crates/chatd/tests/slack.rs (connecting_asks_little_spaces_what_it_warms_and_a_reconnect_asks_less, 150ms between calls). This branch does not change that test, and the failure is unrelated to Lottie. Linux and Windows succeeded on fb85278. I reran the failed macOS job.

@itz4blitz
itz4blitz merged commit 1cfd84d into itz4blitz:main Oct 17, 2026
5 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants