summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2021-11-03 10:56:08 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2021-11-03 10:56:08 +0000
commitea368d768fa12bffd51b0c8f38c374c5d398c859 (patch)
tree742d509579479dc9e8694f55f96b46cab4a3f954
parent999dd692409595601648495543e16e70bc946e45 (diff)
downloadlibnsgif-ea368d768fa12bffd51b0c8f38c374c5d398c859.tar.gz
libnsgif-ea368d768fa12bffd51b0c8f38c374c5d398c859.tar.bz2
GIF: Move frame parameter extraction into decode wrapper.
-rw-r--r--src/libnsgif.c34
1 files changed, 12 insertions, 22 deletions
diff --git a/src/libnsgif.c b/src/libnsgif.c
index d69b8c7..c95753d 100644
--- a/src/libnsgif.c
+++ b/src/libnsgif.c
@@ -801,16 +801,16 @@ gif__decode_simple(
static inline gif_result gif__decode(
struct gif_animation *gif,
struct gif_frame *frame,
- uint32_t width,
- uint32_t height,
- uint32_t offset_x,
- uint32_t offset_y,
- uint32_t interlace,
uint8_t minimum_code_size,
- uint32_t *restrict frame_data,
- uint32_t *restrict colour_table)
+ uint32_t *restrict frame_data)
{
gif_result ret;
+ uint32_t offset_x = frame->redraw_x;
+ uint32_t offset_y = frame->redraw_y;
+ uint32_t width = frame->redraw_width;
+ uint32_t height = frame->redraw_height;
+ uint32_t interlace = frame->flags & GIF_INTERLACE_MASK;
+ uint32_t *restrict colour_table = gif->colour_table;
uint32_t transparency_index;
if (frame->transparency) {
@@ -846,7 +846,10 @@ static gif_result gif_clear_frame(
struct gif_frame *frame,
uint32_t *bitmap)
{
- uint32_t width, height, offset_x, offset_y;
+ uint32_t width;
+ uint32_t height;
+ uint32_t offset_x;
+ uint32_t offset_y;
assert(frame->disposal_method == GIF_FRAME_CLEAR);
@@ -905,9 +908,6 @@ gif_internal_decode_frame(gif_animation *gif,
struct gif_frame *frame;
uint8_t *gif_data, *gif_end;
int gif_bytes;
- uint32_t width, height, offset_x, offset_y;
- uint32_t interlace;
- uint32_t *colour_table;
uint32_t *frame_data = 0; // Set to 0 for no warnings
uint32_t save_buffer_position;
@@ -955,14 +955,6 @@ gif_internal_decode_frame(gif_animation *gif,
gif_data = gif->gif_data + gif->buffer_position;
gif_bytes = (gif_end - gif_data);
- offset_x = frame->redraw_x;
- offset_y = frame->redraw_y;
- width = frame->redraw_width;
- height = frame->redraw_height;
- interlace = frame->flags & GIF_INTERLACE_MASK;
-
- colour_table = gif->colour_table;
-
/* Ensure sufficient data remains */
if (gif_bytes < 1) {
ret = GIF_INSUFFICIENT_FRAME_DATA;
@@ -1038,9 +1030,7 @@ gif_internal_decode_frame(gif_animation *gif,
gif->decoded_frame = frame_idx;
gif->buffer_position = (gif_data - gif->gif_data) + 1;
- ret = gif__decode(gif, frame, width, height,
- offset_x, offset_y, interlace, gif_data[0],
- frame_data, colour_table);
+ ret = gif__decode(gif, frame, gif_data[0], frame_data);
gif_decode_frame_exit: