On Mon, 5 May 2025 17:07:11 GMT, Jeremy Wood <d...@openjdk.org> wrote:
> This resolves a gif parsing bug where an unwanted opaque rectangle could > appear under these conditions: > > 1. The disposal method for frames is 1 (meaning "do not dispose", aka > "DISPOSAL_SAVE") > 2. The transparent pixel is non-zero > 3. There's more than one such consecutive frame > > Previously: the GifImageDecoder would leave the saved_image pixels as zero > when they were supposed to be transparent. This works great if the > transparent pixel index is zero, but it flood fills the background of your > frame with the zeroeth color otherwise. For reference, the commented out lines here are my first approach at resolving this problem. <img width="687" alt="image" src="https://github.com/user-attachments/assets/8caa3372-ee42-412d-959c-6d55d258e4ba" /> This works, and it may be more readable/intuitive than this current PR. When we initialize saved_image we should flood fill it with transparent pixels. I chose the approach in this PR though because it's lazier. (That is: it should be a little bit less work, CPU-wise.) If anyone wants we can switch to this approach. ------------- PR Comment: https://git.openjdk.org/jdk/pull/25044#issuecomment-2851693643