Fix gifplayer for still images with 0 loop count

This commit is contained in:
Nigel Tao committed 2022-04-06 17:45:58 +10:00
1 parent 03fd43cfcc
commit 7eaf488bae
1 file changed
+5 -1
+5 -1
View File
@@ -130,6 +130,7 @@ wuffs_base__slice_u8 g_workbuf = {0};
wuffs_base__slice_u8 g_printbuf = {0};
bool g_first_play = true;
bool g_still_image = false;
uint32_t g_num_loops_remaining = 0;
wuffs_base__image_config g_ic = {0};
wuffs_base__pixel_buffer g_pb = {0};
@@ -494,6 +495,7 @@ play() {
if (g_first_play) {
g_first_play = false;
g_still_image = wuffs_gif__decoder__num_decoded_frame_configs(&dec) <= 1;
g_num_loops_remaining = wuffs_gif__decoder__num_animation_loops(&dec);
}
@@ -509,7 +511,9 @@ main1(int argc, char** argv) {
TRY(read_stdin());
while (true) {
TRY(play());
if (g_num_loops_remaining == 0) {
if (g_still_image) {
break;
} else if (g_num_loops_remaining == 0) {
continue;
}
g_num_loops_remaining--;