From 9151ec61ef3a4af5f0643b95edce27e85ac1a7ec Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Wed, 2 Mar 2022 12:18:46 +0000 Subject: API: Expose transparency flag in frame info. --- include/nsgif.h | 2 ++ src/gif.c | 8 +++----- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/nsgif.h b/include/nsgif.h index 6029135..fe11d29 100644 --- a/include/nsgif.h +++ b/include/nsgif.h @@ -322,6 +322,8 @@ const char *nsgif_str_disposal(enum nsgif_disposal disposal); typedef struct nsgif_frame_info { /** whether the frame should be displayed/animated */ bool display; + /** whether the frame may have transparency */ + bool transparency; /** Disposal method for previous frame; affects plotting */ uint8_t disposal; diff --git a/src/gif.c b/src/gif.c index 3ae55b9..fe65352 100644 --- a/src/gif.c +++ b/src/gif.c @@ -33,8 +33,6 @@ typedef struct nsgif_frame { /** whether a full image redraw is required */ bool redraw_required; - /** whether we acknowledge transparency */ - bool transparency; /** the index designating a transparent pixel */ uint32_t transparency_index; @@ -634,7 +632,7 @@ static void nsgif__restore_bg( return; } - if (frame->transparency) { + if (frame->info.transparency) { for (uint32_t y = 0; y < height; y++) { uint32_t *scanline = bitmap + offset_x + (offset_y + y) * gif->info.width; @@ -751,7 +749,7 @@ static nsgif_error nsgif__parse_extension_graphic_control( } if (data[2] & GIF_MASK_TRANSPARENCY) { - frame->transparency = true; + frame->info.transparency = true; frame->transparency_index = data[5]; } @@ -1181,9 +1179,9 @@ static struct nsgif_frame *nsgif__get_frame( frame = &gif->frames[frame_idx]; - frame->transparency = false; frame->transparency_index = NSGIF_NO_TRANSPARENCY; frame->frame_pointer = gif->buf_pos; + frame->info.transparency = false; frame->redraw_required = false; frame->info.display = false; frame->info.disposal = 0; -- cgit v1.2.1