diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/imageviewer/imageviewer.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/apps/plugins/imageviewer/imageviewer.c b/apps/plugins/imageviewer/imageviewer.c index f57dc7e3b3..4dc7b0a07a 100644 --- a/apps/plugins/imageviewer/imageviewer.c +++ b/apps/plugins/imageviewer/imageviewer.c | |||
@@ -127,6 +127,9 @@ static int curfile = -1, direction = DIR_NEXT, entries = 0; | |||
127 | /* list of the supported image files */ | 127 | /* list of the supported image files */ |
128 | static char **file_pt; | 128 | static char **file_pt; |
129 | 129 | ||
130 | /* progress update tick */ | ||
131 | static long next_progress_tick; | ||
132 | |||
130 | static const struct image_decoder *imgdec = NULL; | 133 | static const struct image_decoder *imgdec = NULL; |
131 | static enum image_type image_type = IMAGE_UNKNOWN; | 134 | static enum image_type image_type = IMAGE_UNKNOWN; |
132 | 135 | ||
@@ -428,7 +431,14 @@ static int ask_and_get_audio_buffer(const char *filename) | |||
428 | /* callback updating a progress meter while image decoding */ | 431 | /* callback updating a progress meter while image decoding */ |
429 | static void cb_progress(int current, int total) | 432 | static void cb_progress(int current, int total) |
430 | { | 433 | { |
431 | rb->yield(); /* be nice to the other threads */ | 434 | /* do not yield or update the progress bar if we did so too recently */ |
435 | long now = *rb->current_tick; | ||
436 | if(!TIME_AFTER(now, next_progress_tick)) | ||
437 | return; | ||
438 | |||
439 | /* limit to 20fps */ | ||
440 | next_progress_tick = now + HZ/20; | ||
441 | |||
432 | #ifndef USEGSLIB | 442 | #ifndef USEGSLIB |
433 | /* in slideshow mode, keep gui interference to a minimum */ | 443 | /* in slideshow mode, keep gui interference to a minimum */ |
434 | const int size = (!iv_api.running_slideshow ? 8 : 4); | 444 | const int size = (!iv_api.running_slideshow ? 8 : 4); |
@@ -442,6 +452,8 @@ static void cb_progress(int current, int total) | |||
442 | total, 0, current, HORIZONTAL); | 452 | total, 0, current, HORIZONTAL); |
443 | rb->lcd_update_rect(0, LCD_HEIGHT-size, LCD_WIDTH, size); | 453 | rb->lcd_update_rect(0, LCD_HEIGHT-size, LCD_WIDTH, size); |
444 | } | 454 | } |
455 | |||
456 | rb->yield(); /* be nice to the other threads */ | ||
445 | } | 457 | } |
446 | 458 | ||
447 | #define VSCROLL (LCD_HEIGHT/8) | 459 | #define VSCROLL (LCD_HEIGHT/8) |