summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2022-03-02 12:18:46 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2022-03-02 12:18:46 +0000
commit9151ec61ef3a4af5f0643b95edce27e85ac1a7ec (patch)
treec94458593796c5cd3ea4be8ba93b5f296c46adad
parent79b272cb58ea3b114f6f3cf3594ced2721b9f8dd (diff)
downloadlibnsgif-9151ec61ef3a4af5f0643b95edce27e85ac1a7ec.tar.gz
libnsgif-9151ec61ef3a4af5f0643b95edce27e85ac1a7ec.tar.bz2
API: Expose transparency flag in frame info.
-rw-r--r--include/nsgif.h2
-rw-r--r--src/gif.c8
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;