summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2022-04-04 10:01:57 +0100
committerMichael Drake <tlsa@netsurf-browser.org>2022-04-04 10:01:57 +0100
commitf8f094ab59f9ae71767a2a01c35224da9a04d583 (patch)
treee610dc3056f159f174fac2fe2499a2ba3038be0e
parentcc18507ae1ffe1753eb7dc66e26f9d8a9231cba6 (diff)
downloadlibnsgif-f8f094ab59f9ae71767a2a01c35224da9a04d583.tar.gz
libnsgif-f8f094ab59f9ae71767a2a01c35224da9a04d583.tar.bz2
API: Don't expose loop_count.
It is internal state for a libnsgif managed animation, not information about the GIF.
-rw-r--r--include/nsgif.h2
-rw-r--r--src/gif.c11
2 files changed, 7 insertions, 6 deletions
diff --git a/include/nsgif.h b/include/nsgif.h
index 0ee00e8..03f9b16 100644
--- a/include/nsgif.h
+++ b/include/nsgif.h
@@ -343,8 +343,6 @@ typedef struct nsgif_info {
uint32_t frame_count;
/** number of times to play animation (zero means loop forever) */
int loop_max;
- /** number of animation loops so far */
- int loop_count;
/** background colour in same pixel format as \ref nsgif_bitmap_t. */
uint32_t background;
} nsgif_info_t;
diff --git a/src/gif.c b/src/gif.c
index 84df50e..91999d3 100644
--- a/src/gif.c
+++ b/src/gif.c
@@ -68,6 +68,9 @@ struct nsgif {
uint16_t delay_min;
uint16_t delay_default;
+ /** number of animation loops so far */
+ int loop_count;
+
/** number of frames partially decoded */
uint32_t frame_count_partial;
@@ -1737,7 +1740,7 @@ static inline bool nsgif__animation_complete(int count, int max)
nsgif_error nsgif_reset(
nsgif_t *gif)
{
- gif->info.loop_count = 0;
+ gif->loop_count = 0;
gif->frame = NSGIF_FRAME_INVALID;
return NSGIF_OK;
@@ -1765,7 +1768,7 @@ nsgif_error nsgif_frame_prepare(
}
if (nsgif__animation_complete(
- gif->info.loop_count,
+ gif->loop_count,
gif->info.loop_max)) {
return NSGIF_ERR_ANIMATION_END;
}
@@ -1776,7 +1779,7 @@ nsgif_error nsgif_frame_prepare(
}
if (gif->frame != NSGIF_FRAME_INVALID && frame < gif->frame) {
- gif->info.loop_count++;
+ gif->loop_count++;
}
if (gif->info.frame_count == 1) {
@@ -1791,7 +1794,7 @@ nsgif_error nsgif_frame_prepare(
if (frame_next < frame) {
if (nsgif__animation_complete(
- gif->info.loop_count + 1,
+ gif->loop_count + 1,
gif->info.loop_max)) {
delay = NSGIF_INFINITE;
}