diff options
author | Peter D'Hoye <peter.dhoye@gmail.com> | 2006-10-20 16:49:45 +0000 |
---|---|---|
committer | Peter D'Hoye <peter.dhoye@gmail.com> | 2006-10-20 16:49:45 +0000 |
commit | 167a9364a085794764836bd3017ae4e88ddb3500 (patch) | |
tree | b49c2787cd65ee8a00ffa6ba677d0f675ff4702f | |
parent | e994774bdeb5068e572700fed14c4b84bf3b720a (diff) | |
download | rockbox-167a9364a085794764836bd3017ae4e88ddb3500.tar.gz rockbox-167a9364a085794764836bd3017ae4e88ddb3500.zip |
Make slideshow mode more slideshow: keep showing previous picture until next one is ready, just show a small progressbar to indicate loading
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11276 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/plugins/jpeg.c | 92 |
1 files changed, 59 insertions, 33 deletions
diff --git a/apps/plugins/jpeg.c b/apps/plugins/jpeg.c index dfc198605d..35930f78a7 100644 --- a/apps/plugins/jpeg.c +++ b/apps/plugins/jpeg.c | |||
@@ -2340,9 +2340,19 @@ int scroll_bmp(struct t_disp* pdisp) | |||
2340 | void cb_progess(int current, int total) | 2340 | void cb_progess(int current, int total) |
2341 | { | 2341 | { |
2342 | rb->yield(); /* be nice to the other threads */ | 2342 | rb->yield(); /* be nice to the other threads */ |
2343 | rb->scrollbar(0, LCD_HEIGHT-8, LCD_WIDTH, 8, total, 0, | 2343 | if(slideshow_enabled) |
2344 | current, HORIZONTAL); | 2344 | { |
2345 | rb->lcd_update_rect(0, LCD_HEIGHT-8, LCD_WIDTH, 8); | 2345 | /* in slideshow mode, keep gui interference to a minimum */ |
2346 | rb->scrollbar(0, LCD_HEIGHT-4, LCD_WIDTH, 4, total, 0, | ||
2347 | current, HORIZONTAL); | ||
2348 | rb->lcd_update_rect(0, LCD_HEIGHT-4, LCD_WIDTH, 4); | ||
2349 | } | ||
2350 | else | ||
2351 | { | ||
2352 | rb->scrollbar(0, LCD_HEIGHT-8, LCD_WIDTH, 8, total, 0, | ||
2353 | current, HORIZONTAL); | ||
2354 | rb->lcd_update_rect(0, LCD_HEIGHT-8, LCD_WIDTH, 8); | ||
2355 | } | ||
2346 | } | 2356 | } |
2347 | 2357 | ||
2348 | int jpegmem(struct jpeg *p_jpg, int ds) | 2358 | int jpegmem(struct jpeg *p_jpg, int ds) |
@@ -2449,10 +2459,13 @@ struct t_disp* get_image(struct jpeg* p_jpg, int ds) | |||
2449 | buf += size; | 2459 | buf += size; |
2450 | buf_size -= size; | 2460 | buf_size -= size; |
2451 | 2461 | ||
2452 | rb->snprintf(print, sizeof(print), "decoding %d*%d", | 2462 | if(!slideshow_enabled) |
2453 | p_jpg->x_size/ds, p_jpg->y_size/ds); | 2463 | { |
2454 | rb->lcd_puts(0, 3, print); | 2464 | rb->snprintf(print, sizeof(print), "decoding %d*%d", |
2455 | rb->lcd_update(); | 2465 | p_jpg->x_size/ds, p_jpg->y_size/ds); |
2466 | rb->lcd_puts(0, 3, print); | ||
2467 | rb->lcd_update(); | ||
2468 | } | ||
2456 | 2469 | ||
2457 | /* update image properties */ | 2470 | /* update image properties */ |
2458 | p_disp->width = p_jpg->x_size / ds; | 2471 | p_disp->width = p_jpg->x_size / ds; |
@@ -2475,10 +2488,14 @@ struct t_disp* get_image(struct jpeg* p_jpg, int ds) | |||
2475 | return NULL; | 2488 | return NULL; |
2476 | } | 2489 | } |
2477 | time = *rb->current_tick - time; | 2490 | time = *rb->current_tick - time; |
2478 | rb->snprintf(print, sizeof(print), " %d.%02d sec ", time/HZ, time%HZ); | 2491 | |
2479 | rb->lcd_getstringsize(print, &w, &h); /* centered in progress bar */ | 2492 | if(!slideshow_enabled) |
2480 | rb->lcd_putsxy((LCD_WIDTH - w)/2, LCD_HEIGHT - h, print); | 2493 | { |
2481 | rb->lcd_update(); | 2494 | rb->snprintf(print, sizeof(print), " %d.%02d sec ", time/HZ, time%HZ); |
2495 | rb->lcd_getstringsize(print, &w, &h); /* centered in progress bar */ | ||
2496 | rb->lcd_putsxy((LCD_WIDTH - w)/2, LCD_HEIGHT - h, print); | ||
2497 | rb->lcd_update(); | ||
2498 | } | ||
2482 | 2499 | ||
2483 | return p_disp; | 2500 | return p_disp; |
2484 | } | 2501 | } |
@@ -2611,27 +2628,32 @@ int load_and_show(char* filename) | |||
2611 | } | 2628 | } |
2612 | } | 2629 | } |
2613 | 2630 | ||
2631 | if(!slideshow_enabled) | ||
2632 | { | ||
2614 | #ifdef HAVE_LCD_COLOR | 2633 | #ifdef HAVE_LCD_COLOR |
2615 | rb->lcd_set_foreground(LCD_WHITE); | 2634 | rb->lcd_set_foreground(LCD_WHITE); |
2616 | rb->lcd_set_background(LCD_BLACK); | 2635 | rb->lcd_set_background(LCD_BLACK); |
2617 | #endif | 2636 | #endif |
2618 | 2637 | ||
2619 | rb->lcd_clear_display(); | 2638 | rb->lcd_clear_display(); |
2620 | rb->snprintf(print, sizeof(print), "%s:", rb->strrchr(filename,'/')+1); | 2639 | rb->snprintf(print, sizeof(print), "%s:", rb->strrchr(filename,'/')+1); |
2621 | rb->lcd_puts(0, 0, print); | 2640 | rb->lcd_puts(0, 0, print); |
2622 | rb->lcd_update(); | 2641 | rb->lcd_update(); |
2623 | 2642 | ||
2624 | rb->snprintf(print, sizeof(print), "loading %d bytes", filesize); | 2643 | rb->snprintf(print, sizeof(print), "loading %d bytes", filesize); |
2625 | rb->lcd_puts(0, 1, print); | 2644 | rb->lcd_puts(0, 1, print); |
2626 | rb->lcd_update(); | 2645 | rb->lcd_update(); |
2646 | } | ||
2627 | 2647 | ||
2628 | rb->read(fd, buf_jpeg, filesize); | 2648 | rb->read(fd, buf_jpeg, filesize); |
2629 | rb->close(fd); | 2649 | rb->close(fd); |
2630 | 2650 | ||
2631 | rb->snprintf(print, sizeof(print), "decoding markers"); | 2651 | if(!slideshow_enabled) |
2632 | rb->lcd_puts(0, 2, print); | 2652 | { |
2633 | rb->lcd_update(); | 2653 | rb->snprintf(print, sizeof(print), "decoding markers"); |
2634 | 2654 | rb->lcd_puts(0, 2, print); | |
2655 | rb->lcd_update(); | ||
2656 | } | ||
2635 | 2657 | ||
2636 | 2658 | ||
2637 | rb->memset(&jpg, 0, sizeof(jpg)); /* clear info struct */ | 2659 | rb->memset(&jpg, 0, sizeof(jpg)); /* clear info struct */ |
@@ -2649,10 +2671,12 @@ int load_and_show(char* filename) | |||
2649 | default_huff_tbl(&jpg); /* use default */ | 2671 | default_huff_tbl(&jpg); /* use default */ |
2650 | build_lut(&jpg); /* derive Huffman and other lookup-tables */ | 2672 | build_lut(&jpg); /* derive Huffman and other lookup-tables */ |
2651 | 2673 | ||
2652 | rb->snprintf(print, sizeof(print), "image %dx%d", jpg.x_size, jpg.y_size); | 2674 | if(!slideshow_enabled) |
2653 | rb->lcd_puts(0, 2, print); | 2675 | { |
2654 | rb->lcd_update(); | 2676 | rb->snprintf(print, sizeof(print), "image %dx%d", jpg.x_size, jpg.y_size); |
2655 | 2677 | rb->lcd_puts(0, 2, print); | |
2678 | rb->lcd_update(); | ||
2679 | } | ||
2656 | ds_max = max_downscale(&jpg); /* check display constraint */ | 2680 | ds_max = max_downscale(&jpg); /* check display constraint */ |
2657 | ds_min = min_downscale(&jpg, buf_size); /* check memory constraint */ | 2681 | ds_min = min_downscale(&jpg, buf_size); /* check memory constraint */ |
2658 | if (ds_min == 0) | 2682 | if (ds_min == 0) |
@@ -2674,11 +2698,13 @@ int load_and_show(char* filename) | |||
2674 | 2698 | ||
2675 | set_view(p_disp, cx, cy); | 2699 | set_view(p_disp, cx, cy); |
2676 | 2700 | ||
2677 | rb->snprintf(print, sizeof(print), "showing %dx%d", | 2701 | if(!slideshow_enabled) |
2678 | p_disp->width, p_disp->height); | 2702 | { |
2679 | rb->lcd_puts(0, 3, print); | 2703 | rb->snprintf(print, sizeof(print), "showing %dx%d", |
2680 | rb->lcd_update(); | 2704 | p_disp->width, p_disp->height); |
2681 | 2705 | rb->lcd_puts(0, 3, print); | |
2706 | rb->lcd_update(); | ||
2707 | } | ||
2682 | MYLCD(clear_display)(); | 2708 | MYLCD(clear_display)(); |
2683 | #ifdef HAVE_LCD_COLOR | 2709 | #ifdef HAVE_LCD_COLOR |
2684 | yuv_bitmap_part( | 2710 | yuv_bitmap_part( |