diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2021-11-03 11:06:23 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2021-11-03 11:06:23 +0000 |
commit | d96f028f305b5286618dcfc682e0de2515b3b7bd (patch) | |
tree | e3cb55d9b62513da1c418ddc26c3fc0f5789b720 | |
parent | 2d440af6eed4d0ff82b8ef5143c7d2aee3856cc8 (diff) | |
download | libnsgif-d96f028f305b5286618dcfc682e0de2515b3b7bd.tar.gz |
GIF: Store transparancy index on the frame.
If the frame has no transparency, it is set to an invalid value.
-rw-r--r-- | include/libnsgif.h | 2 | ||||
-rw-r--r-- | src/libnsgif.c | 9 |
2 files changed, 3 insertions, 8 deletions
diff --git a/include/libnsgif.h b/include/libnsgif.h index a11c3a5..ae6691c 100644 --- a/include/libnsgif.h +++ b/include/libnsgif.h @@ -53,7 +53,7 @@ typedef struct gif_frame { /** whether we acknoledge transparency */ bool transparency; /** the index designating a transparent pixel */ - unsigned char transparency_index; + unsigned int transparency_index; /** x co-ordinate of redraw rectangle */ unsigned int redraw_x; /** y co-ordinate of redraw rectangle */ diff --git a/src/libnsgif.c b/src/libnsgif.c index 85a72b7..6ee7ab3 100644 --- a/src/libnsgif.c +++ b/src/libnsgif.c @@ -475,6 +475,7 @@ static gif_result gif_initialise_frame(gif_animation *gif, gif->frames[frame_idx].virgin = true; gif->frames[frame_idx].disposal_method = 0; gif->frames[frame_idx].transparency = false; + gif->frames[frame_idx].transparency_index = GIF_NO_TRANSPARENCY; gif->frames[frame_idx].frame_delay = 100; gif->frames[frame_idx].redraw_required = false; @@ -808,14 +809,8 @@ static inline gif_result gif__decode( uint32_t width = frame->redraw_width; uint32_t height = frame->redraw_height; uint32_t interlace = frame->flags & GIF_INTERLACE_MASK; + uint32_t transparency_index = frame->transparency_index; uint32_t *restrict colour_table = gif->colour_table; - uint32_t transparency_index; - - if (frame->transparency) { - transparency_index = frame->transparency_index; - } else { - transparency_index = GIF_NO_TRANSPARENCY; - } if (interlace == false && width == gif->width && offset_x == 0) { ret = gif__decode_simple(gif, height, offset_y, |