Open
Description
The current animated WebP loader in SDL_image has incorrect frame composition behavior, leading to visual artifacts in animated WebP files. This is particularly noticeable in WebP animations that use transparency or have overlapping frames with different disposal methods.
Current Behavior
- Frame disposal operations occur at the wrong time in the composition sequence
- Transparency and background color handling does not respect the WebP alpha channel status
- Frames are blended incorrectly, causing remnants of previous frames to persist
- WEBP_MUX_DISPOSE_BACKGROUND is not properly clearing frame regions
Expected Behavior
- Frame disposal should occur before drawing the new frame
- Initial canvas state should:
- Use transparency for WebPs with alpha channel
- Use background color for non-alpha WebPs
- Frame composition should use SDL_BLENDMODE_NONE to ensure accurate pixel replacement
- Frame disposal should only affect the region of the disposed frame
Technical Details
The core issue is in IMG_LoadWEBPAnimation_RW where the frame composition logic doesn't match the WebP specification requirements
Test Case
Any animated WebP with:
-Transparent regions
-Overlapping frames
-Mixed disposal methods (WEBP_MUX_DISPOSE_BACKGROUND and WEBP_MUX_DISPOSE_NONE)
Metadata
Metadata
Assignees
Labels
No labels