ImageViewer: Improve smoothness of animated gif playback

Don't disable grayscale overlay, don't show "resize" messages
between frames and  and don't clear display unless actually
necessary

Change-Id: I9f501d8280ce0c8f26f4345088d805d1b84cf143
This commit is contained in:
Christian Soffke 2021-12-14 19:36:25 +01:00 committed by Aidan MacDonald
parent 3adeae2026
commit fbdcfca085
2 changed files with 7 additions and 3 deletions

View file

@ -210,7 +210,7 @@ static int get_image(struct image_info *info, int frame, int ds)
/* assign image buffer */
if (ds > 1)
{
if (!iv->running_slideshow)
if (!iv->running_slideshow && (info->frames_count == 1))
{
rb->lcd_putsf(0, 3, "resizing %d*%d", info->width, info->height);
rb->lcd_update();

View file

@ -915,7 +915,8 @@ static int load_and_show(char* filename, struct image_info *info)
rb->lcd_update();
}
mylcd_ub_clear_display();
if (frame == 0)
mylcd_ub_clear_display();
imgdec->draw_image_rect(info, 0, 0,
info->width-info->x, info->height-info->y);
mylcd_ub_update();
@ -956,6 +957,7 @@ static int load_and_show(char* filename, struct image_info *info)
get_view(info, &cx, &cy);
cx /= zoom; /* prepare the position in the new image */
cy /= zoom;
mylcd_ub_clear_display();
}
else
continue;
@ -969,12 +971,14 @@ static int load_and_show(char* filename, struct image_info *info)
}
#ifdef USEGSLIB
grey_show(false); /* switch off overlay */
if (info->frames_count <= 1)
grey_show(false); /* switch off overlay */
#endif
rb->lcd_clear_display();
}
while (status > PLUGIN_OTHER);
#ifdef USEGSLIB
grey_show(false); /* switch off overlay */
rb->lcd_update();
#endif
return status;