diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2023-01-22 13:07:15 +0000 |
---|---|---|
committer | Michael Drake <mdrake.unique@gmail.com> | 2023-01-22 13:09:56 +0000 |
commit | 550b6fa74e7f5c6a7800d2f6f4841636a3f93544 (patch) | |
tree | 89f75be579cfc7b461c8e874a23159a7520c553f | |
parent | 0837e397a55e4a6c2993f67276d9921ab9f2974b (diff) | |
download | libnsgif-550b6fa74e7f5c6a7800d2f6f4841636a3f93544.tar.gz |
gif: Set interlaced bool in frame info
-rw-r--r-- | src/gif.c | 12 |
1 files changed, 5 insertions, 7 deletions
@@ -600,20 +600,15 @@ static inline nsgif_error nsgif__decode( const uint8_t *data, uint32_t *restrict frame_data) { - enum { - GIF_MASK_INTERLACE = 0x40, - }; - nsgif_error ret; uint32_t width = frame->info.rect.x1 - frame->info.rect.x0; uint32_t height = frame->info.rect.y1 - frame->info.rect.y0; uint32_t offset_x = frame->info.rect.x0; uint32_t offset_y = frame->info.rect.y0; - uint32_t interlace = frame->flags & GIF_MASK_INTERLACE; uint32_t transparency_index = frame->transparency_index; uint32_t *restrict colour_table = gif->colour_table; - if (interlace == false && offset_x == 0 && + if (frame->info.interlaced == false && offset_x == 0 && width == gif->info.width && width == gif->rowspan) { ret = nsgif__decode_simple(gif, height, offset_y, @@ -621,7 +616,7 @@ static inline nsgif_error nsgif__decode( frame_data, colour_table); } else { ret = nsgif__decode_complex(gif, width, height, - offset_x, offset_y, interlace, + offset_x, offset_y, frame->info.interlaced, data, transparency_index, frame_data, colour_table); } @@ -1020,6 +1015,7 @@ static nsgif_error nsgif__parse_image_descriptor( enum { NSGIF_IMAGE_DESCRIPTOR_LEN = 10u, NSGIF_IMAGE_SEPARATOR = 0x2Cu, + NSGIF_MASK_INTERLACE = 0x40u, }; assert(gif != NULL); @@ -1047,6 +1043,8 @@ static nsgif_error nsgif__parse_image_descriptor( frame->info.rect.x1 = x + w; frame->info.rect.y1 = y + h; + frame->info.interlaced = frame->flags & NSGIF_MASK_INTERLACE; + /* Allow first frame to grow image dimensions. */ if (gif->info.frame_count == 0) { if (x + w > gif->info.width) { |