From f8f094ab59f9ae71767a2a01c35224da9a04d583 Mon Sep 17 00:00:00 2001 From: Michael Drake Date: Mon, 4 Apr 2022 10:01:57 +0100 Subject: API: Don't expose loop_count. It is internal state for a libnsgif managed animation, not information about the GIF. --- include/nsgif.h | 2 -- src/gif.c | 11 +++++++---- 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; } -- cgit v1.2.1