fix libnsgif restore/record ordering

This commit is contained in:
John Cupitt 2021-03-07 14:37:33 +00:00
parent f74d6c795d
commit bf522eeffc

View File

@ -704,11 +704,6 @@ gif_internal_decode_frame(gif_animation *gif,
return GIF_OK; return GIF_OK;
} }
if (gif->frames[frame].disposal_method == GIF_FRAME_RESTORE) {
/* Store the previous frame for later restoration */
gif__record_previous_frame(gif);
}
/* Get the start of our frame data and the end of the GIF data */ /* Get the start of our frame data and the end of the GIF data */
gif_data = gif->gif_data + gif->frames[frame].frame_pointer; gif_data = gif->gif_data + gif->frames[frame].frame_pointer;
gif_end = gif->gif_data + gif->buffer_size; gif_end = gif->gif_data + gif->buffer_size;
@ -897,6 +892,12 @@ gif_internal_decode_frame(gif_animation *gif,
gif->width * gif->height * sizeof(int)); gif->width * gif->height * sizeof(int));
} }
} }
if (gif->frames[frame].disposal_method == GIF_FRAME_RESTORE) {
/* Store the previous frame for later restoration */
gif__record_previous_frame(gif);
}
gif->decoded_frame = frame; gif->decoded_frame = frame;
gif->buffer_position = (gif_data - gif->gif_data) + 1; gif->buffer_position = (gif_data - gif->gif_data) + 1;