diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2021-12-01 16:57:16 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2022-02-23 11:32:42 +0000 |
commit | 958ea3a13e8d5ffd23f2540d7a0eb2926667a206 (patch) | |
tree | d576a88fa07e48579095f4cf61bbb0b439309f98 /src | |
parent | 1e3f649e2b78bf936ac3ca83c0992b0cb9add327 (diff) | |
download | libnsgif-958ea3a13e8d5ffd23f2540d7a0eb2926667a206.tar.gz |
GIF: Scope reduce graphic control extension masks.
Diffstat (limited to 'src')
-rw-r--r-- | src/gif.c | 11 |
1 files changed, 7 insertions, 4 deletions
@@ -55,8 +55,6 @@ enum nsgif_disposal { #define NSGIF_INTERLACE_MASK 0x40 #define NSGIF_COLOUR_TABLE_MASK 0x80 #define NSGIF_COLOUR_TABLE_SIZE_MASK 0x07 -#define NSGIF_DISPOSAL_MASK 0x1c -#define NSGIF_TRANSPARENCY_MASK 0x01 #define NSGIF_BLOCK_TERMINATOR 0x00 #define NSGIF_TRAILER 0x3b @@ -636,6 +634,11 @@ static nsgif_result nsgif__parse_extension_graphic_control( const uint8_t *data, size_t len) { + enum { + GIF_MASK_TRANSPARENCY = 0x01, + GIF_MASK_DISPOSAL = 0x1c, + }; + /* 6-byte Graphic Control Extension is: * * +0 CHAR Graphic Control Label @@ -653,12 +656,12 @@ static nsgif_result nsgif__parse_extension_graphic_control( } frame->frame_delay = data[3] | (data[4] << 8); - if (data[2] & NSGIF_TRANSPARENCY_MASK) { + if (data[2] & GIF_MASK_TRANSPARENCY) { frame->transparency = true; frame->transparency_index = data[5]; } - frame->disposal_method = ((data[2] & NSGIF_DISPOSAL_MASK) >> 2); + frame->disposal_method = ((data[2] & GIF_MASK_DISPOSAL) >> 2); /* I have encountered documentation and GIFs in the * wild that use 0x04 to restore the previous frame, * rather than the officially documented 0x03. I |