Skip to content

Commit

Permalink
only restore background when dispose is 3
Browse files Browse the repository at this point in the history
Signed-off-by: Cocoa <[email protected]>
  • Loading branch information
cocoa-xu committed Oct 9, 2024
1 parent ae721c5 commit ff74b42
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions stb_image.h
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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;
Expand Down

0 comments on commit ff74b42

Please sign in to comment.