Browse Source

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.

Chris Forseth 7 years ago
parent
commit
03b4bbc5d2
1 changed files with 2 additions and 2 deletions
  1. 2 2
      stb_image.h

+ 2 - 2
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; 
       dispose = (g->eflags & 0x1C) >> 2; 
       pcount = g->w * g->h; 
       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
          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, 
             // if this was the first frame, 
             pcount = g->w * g->h; 
             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
                // if first frame, any pixel not drawn to gets the background color
                for (pi = 0; pi < pcount; ++pi) {
                for (pi = 0; pi < pcount; ++pi) {
                   if (g->history[pi] == 0) {
                   if (g->history[pi] == 0) {