✨ animate GIFs in image side preview via Skia codec#4410
Merged
Conversation
Coil 3 has no desktop GIF decoder, so the side preview only ever showed the first frame. Add SkiaAnimatedImageView, which decodes frames with org.jetbrains.skia.Codec (already shipped with Skiko, no new dependency) and plays them on a per-frame-duration loop. The loop is gated on UserAttentionService.attentionOn(MAIN_WINDOW, SEARCH_WINDOW) so animation pauses whenever neither host window is visible. Animated extensions live in a single Set in SkiaAnimatedImageView.kt so future formats (animated WebP, APNG, HEIC sequences) can be enabled by appending one entry. Static image rendering is split into StaticImageSidePreview and the animated branch into AnimatedImageSidePreview, leaving ImageSidePreviewView as a thin orchestrator.
The side preview is mounted exclusively inside SideSearchWindowContent, so also watching MAIN_WINDOW kept the frame loop running whenever the main window was visible — even though the GIF was never on screen. Drop the attentionOn(MAIN, SEARCH) combine and read isSearchWindowVisible directly.
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 #4409
Summary
SkiaAnimatedImageView, a Skia-Codec-backed animated image renderer (no new dependency — Skiko already ships it). It decodes frames into a single reusedBitmapand advances on each frame's declared duration;Codec/Bitmapnative handles are released viaawaitDispose/DisposableEffect.UserAttentionService.attentionOn(MAIN_WINDOW, SEARCH_WINDOW)— animation pauses when neither host window is visible, resumes instantly when either becomes visible.animatedImageExtensions: Set<String>inSkiaAnimatedImageView.kt. The renderer auto-degrades to a static frame whenframeCount <= 1, so static decoders for these formats keep working too.ImageSidePreviewViewinto a thin orchestrator +AnimatedImageSidePreview(Skia branch with visibility wiring) +StaticImageSidePreview(Coil branch unchanged). Static image rendering for PNG/JPEG/WebP/HEIC/SVG is untouched.Test plan
.gif(e.g. drag one from a chat client andCmd+C); open the main window; select the entry — side preview should animate continuously..gifentry — animation should play in the search window's side preview as well.