From ff74b42a0eb2d6051a1416dad3cdc1072db44f58 Mon Sep 17 00:00:00 2001 From: Cocoa Date: Tue, 8 Oct 2024 13:34:31 +0100 Subject: [PATCH] only restore background when dispose is 3 Signed-off-by: Cocoa --- stb_image.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/stb_image.h b/stb_image.h index a632d5435..6f240b8ef 100644 --- a/stb_image.h +++ b/stb_image.h @@ -6815,6 +6815,9 @@ static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, i memcpy( &g->out[pi * 4], &two_back[pi * 4], 4 ); } } + + // background is what out is after the undoing of the previou frame; + memcpy( g->background, g->out, 4 * g->w * g->h ); } else if (dispose == 2) { // restore what was changed last frame to background before that frame; for (pi = 0; pi < pcount; ++pi) { @@ -6828,9 +6831,6 @@ static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, i // 1: do not dispose // 0: not specified. } - - // background is what out is after the undoing of the previou frame; - memcpy( g->background, g->out, 4 * g->w * g->h ); } // clear my history;