提交 c3d05307 编写于 作者: 少年ウィンド 提交者: Sam Judd

clear all pixels when dispose is 3 but previousImage is null (#2521)

* clear all pixels when dispose is 3 but previousImage is null

* Separate conditions and explain why we need to drop the prev image

* release previousImage for re-use
上级 85c21766
...@@ -418,8 +418,20 @@ public class StandardGifDecoder implements GifDecoder { ...@@ -418,8 +418,20 @@ public class StandardGifDecoder implements GifDecoder {
// Final location of blended pixels. // Final location of blended pixels.
final int[] dest = mainScratch; final int[] dest = mainScratch;
// clear all pixels when meet first frame // clear all pixels when meet first frame and drop prev image from last loop
if (previousFrame == null) { if (previousFrame == null) {
if (previousImage != null) {
bitmapProvider.release(previousImage);
}
previousImage = null;
Arrays.fill(dest, COLOR_TRANSPARENT_BLACK);
}
// clear all pixels when dispose is 3 but previousImage is null.
// When DISPOSAL_PREVIOUS and previousImage didn't be set, new frame should draw on
// a empty image
if (previousFrame != null && previousFrame.dispose == DISPOSAL_PREVIOUS
&& previousImage == null) {
Arrays.fill(dest, COLOR_TRANSPARENT_BLACK); Arrays.fill(dest, COLOR_TRANSPARENT_BLACK);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册