Skip to content

fix(smart-playlists): replace hand-drawn On Repeat cover with SVG via resvg#155

Merged
InstaZDLL merged 2 commits into
mainfrom
fix/on-repeat-cover-svg-render
May 25, 2026
Merged

fix(smart-playlists): replace hand-drawn On Repeat cover with SVG via resvg#155
InstaZDLL merged 2 commits into
mainfrom
fix/on-repeat-cover-svg-render

Conversation

@InstaZDLL
Copy link
Copy Markdown
Owner

@InstaZDLL InstaZDLL commented May 25, 2026

Summary

The old On Repeat cover was painted pixel-by-pixel without anti-aliasing, leaving visible stair-stepping on the rings — particularly noticeable when scaled down in the Home carousel. User flagged it as «vraiment moche et pixelisé».

Swap the rasteriser for a vector source at src-tauri/src/smart_playlists/on_repeat.svg, rendered through resvg + usvg + tiny-skia (default features disabled — the SVG is pure shape + gradient + filter, no fonts or embedded rasters, ~300 KB compiled).

New design

  • Deep indigo (#240c47) → near-black (#0d041a) diagonal gradient background
  • 9 vertical "equaliser bars" at 4 % white opacity as subtle texture
  • Centred bezier infinity loop, stroked with a rainbow gradient (#ff3377 → #9933ff → #33ccff)
  • Gaussian glow filter on the stroke (stdDeviation=15) + a thin 4-px white inner rim
  • Loop centred at canvas centre (viewBox 250×250)

What stayed the same

  • 640×640 JPEG output, q=85, blake3-keyed in metadata_artwork/<hash>.jpg
  • No <text> in the SVG → locale-agnostic guarantee preserved per CLAUDE.md
  • React keeps overlaying eyebrow + title on the Home tile
  • build_on_repeat_cover dedupes by hash → existing installs pick up the new image on the next "Régénérer"

Test plan

  • cargo test --manifest-path src-tauri/Cargo.toml --lib smart_playlists::cover → 8/8 passed
  • Updated regression test on_repeat_canvas_renders_with_opaque_background covers: indigo gradient at top-left, near-black at bottom-right, at least one strongly pink pixel on the centred ring row.
  • Manual smoke: click "Régénérer" on Home → "For you" carousel → On Repeat cover renders the centred bezier loop with glow instead of the pixelated double-ring.

Summary by CodeRabbit

Notes de version

  • Mises à jour

    • Nouvelle apparence de la couverture de la playlist intelligente On Repeat : palette indigo → quasi‑noir, nouveau motif graphique et détails visuels améliorés (glow/rim) pour un rendu plus immersif.
    • Affichage de la version de la dépendance côté backend mis à jour dans l’écran À propos.
  • Documentation

    • Documentation mise à jour décrivant la génération déterministe et la logique de déduplication des visuels de couverture.

Review Change Stack

… resvg

The old `render_on_repeat_canvas` painted the indigo gradient and the two
overlapping pink rings pixel-by-pixel without anti-aliasing, which left
the cover visibly stair-stepped at the 640-px canvas size and worse when
the Home tile scaled it down.

Swap in a vector source ([on_repeat.svg]) rasterised through resvg +
usvg + tiny-skia (default features disabled — the SVG is pure shape +
gradient + filter, no fonts or embedded rasters, keeps the dep bloat to
~300 KB compiled). New design centres a bezier infinity loop on the
canvas, strokes it with the rainbow gradient `#ff3377 → #9933ff →
#33ccff` under a gaussian glow + a thin white inner rim. No `<text>`
in the SVG so the locale-agnostic guarantee documented in CLAUDE.md
stays intact — React keeps overlaying the eyebrow + title.

`build_on_repeat_cover` already dedupes by blake3 hash, so existing
installs pick up the new image on the next "Régénérer".
@InstaZDLL InstaZDLL added scope: backend Rust/Tauri backend (src-tauri/) scope: deps Dependencies scope: docs Docs, README, assets type: fix Bug fix size: l 200-500 lines labels May 25, 2026
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 25, 2026

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 12258139-4a54-45ac-b693-06527f6f4a1b

📥 Commits

Reviewing files that changed from the base of the PR and between fd2905e and c5cf79d.

📒 Files selected for processing (1)
  • src/components/views/AboutView.tsx

📝 Walkthrough

Walkthrough

Le rendu de la couverture « On Repeat » passe d'une génération procédurale (dégradé + anneaux) à un pipeline SVG rasterisé déterministe. Les dépendances de rasterisation sont ajoutées, l'implémentation remplace l'ancien code, les erreurs sont propagées, les tests sont adaptés et la documentation est mise à jour.

Changes

On Repeat Cover — Passage au rendu SVG

Layer / File(s) Résumé
Dépendances SVG et implémentation de rasterisation
src-tauri/Cargo.toml, src-tauri/src/smart_playlists/cover.rs
Ajout de resvg, usvg et tiny-skia. Nouvelle implémentation de render_on_repeat_canvas : include_str! pour ON_REPEAT_SVG, parsing via usvg, calcul d'échelle pour canvas 640×640, rendu via resvg → pixmap tiny-skia, conversion RGBA→RGB et retour d'un RgbImage/AppResult.
Intégration et propagation d'erreurs
src-tauri/src/smart_playlists/cover.rs
build_on_repeat_cover appelle render_on_repeat_canvas() retournant un AppResult et propage les erreurs (?) avant l'encodage JPEG et le hachage.
Tests et documentation
src-tauri/src/smart_playlists/cover.rs, CLAUDE.md, docs/features/smart-playlists.md
Test remplacé pour valider opacité du fond, gradient et pixels rose de la boucle. Docs mises à jour pour décrire le rendu déterministe SVG→raster sans texte intégré.
Affichage AboutView
src/components/views/AboutView.tsx
Bump de la version affichée de SQLx de 0.8 à 0.9.
sequenceDiagram
  participant Caller as build_on_repeat_cover
  participant Parser as usvg::Tree
  participant Renderer as resvg (renderer)
  participant Pixmap as tiny_skia::Pixmap
  Caller->>Parser: parse(ON_REPEAT_SVG)
  Parser->>Caller: Tree / parse error
  Caller->>Renderer: render(Tree, scale -> 640×640)
  Renderer->>Pixmap: rasterize -> Pixmap (RGBA premult)
  Pixmap->>Caller: raw pixels
  Caller->>Caller: RGBA→RGB conversion -> RgbImage / AppResult
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • InstaZDLL/WaveFlow#148: Introduit des modifications du générateur de jaquette « On Repeat » et pipelines de régénération liés au rendu de couverture.
  • InstaZDLL/WaveFlow#155: Recouvre directement le passage au rendu SVG embarqué via resvg/usvg/tiny-skia pour la même couverture.

Suggested labels

scope: frontend

Poem

🎨 Du pixel au SVG, la boucle reprend son chant,
Indigo sombre, rose vif au levant,
Raster déterministe, sans texte ni hasard,
Un rendu fidèle, inchangé à chaque regard,
La jaquette chante en silence son art.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed Le titre suit la convention Conventional Commits avec scope kebab-case et décrit clairement le changement principal : remplacer le rendu pixel-par-pixel par un rendu SVG via resvg.
Description check ✅ Passed La description couvre tous les éléments critiques : contexte du problème, solution technique, détails de design, test plan avec résultats. Checklist présent mais items incomplets (manque exécution du smoke test manuel).
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/on-repeat-cover-svg-render

Comment @coderabbitai help to get the list of available commands and usage tips.

@InstaZDLL InstaZDLL self-assigned this May 25, 2026
Caught while reviewing the About panel — the SQLx tile still read 0.8
after #153 landed.
@InstaZDLL InstaZDLL added the scope: frontend React/Vite frontend (src/) label May 25, 2026
@InstaZDLL InstaZDLL merged commit e5fc3a0 into main May 25, 2026
12 of 13 checks passed
@InstaZDLL InstaZDLL deleted the fix/on-repeat-cover-svg-render branch May 25, 2026 11:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: backend Rust/Tauri backend (src-tauri/) scope: deps Dependencies scope: docs Docs, README, assets scope: frontend React/Vite frontend (src/) size: l 200-500 lines type: fix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant