From 03b4bbc5d2d51831baf6359c9527a1733de74cdd Mon Sep 17 00:00:00 2001 From: Chris Forseth Date: Mon, 27 Nov 2017 23:32:44 -0600 Subject: [PATCH] Fix a disposal flag mistype. Only clear to background color if index is non-zero. Fixed a the disposal test gif I was using - now renders properly (gif has no transparent set, but all renderers still considered it transparent. Spec says 0 should be ignored if 0, but was confusing by saying it only in the context of the pal not existing.. but seems to be the case always. --- stb_image.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stb_image.h b/stb_image.h index 167904f..4c297cc 100644 --- a/stb_image.h +++ b/stb_image.h @@ -6309,7 +6309,7 @@ static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, i dispose = (g->eflags & 0x1C) >> 2; pcount = g->w * g->h; - if ((dispose == 4) && (two_back == 0)) { + if ((dispose == 3) && (two_back == 0)) { dispose = 2; // if I don't have an image to revert back to, default to the old background } @@ -6386,7 +6386,7 @@ static stbi_uc *stbi__gif_load_next(stbi__context *s, stbi__gif *g, int *comp, i // if this was the first frame, pcount = g->w * g->h; - if (first_frame && (g->bgindex >= 0)) { + if (first_frame && (g->bgindex > 0)) { // if first frame, any pixel not drawn to gets the background color for (pi = 0; pi < pcount; ++pi) { if (g->history[pi] == 0) {