diff options
author | Andrew Mahone <andrew.mahone@gmail.com> | 2009-01-24 09:29:22 +0000 |
---|---|---|
committer | Andrew Mahone <andrew.mahone@gmail.com> | 2009-01-24 09:29:22 +0000 |
commit | 6fc558b2dbdfbda7231fb995aa81f7c85930223e (patch) | |
tree | cb2b4728f16f15ae477d9cb67e9a16611ce9544e /apps/plugins/pictureflow.c | |
parent | 3f7d1377256263e366c9ff1d5096da2a078f2c3e (diff) | |
download | rockbox-6fc558b2dbdfbda7231fb995aa81f7c85930223e.tar.gz rockbox-6fc558b2dbdfbda7231fb995aa81f7c85930223e.zip |
plugins/lib/feature_wrappers.h to provide easy access to some feature that may be in either API or pluginlib depending on target
pictureflow modified to use feature wrappers, and built on all targets that have tagcache and are swcodec
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@19837 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/pictureflow.c')
-rw-r--r-- | apps/plugins/pictureflow.c | 30 |
1 files changed, 25 insertions, 5 deletions
diff --git a/apps/plugins/pictureflow.c b/apps/plugins/pictureflow.c index 642afa1feb..ca1f0715b3 100644 --- a/apps/plugins/pictureflow.c +++ b/apps/plugins/pictureflow.c | |||
@@ -24,12 +24,14 @@ | |||
24 | ****************************************************************************/ | 24 | ****************************************************************************/ |
25 | 25 | ||
26 | #include "plugin.h" | 26 | #include "plugin.h" |
27 | #include <albumart.h> | ||
27 | #include "lib/pluginlib_actions.h" | 28 | #include "lib/pluginlib_actions.h" |
28 | #include "lib/helper.h" | 29 | #include "lib/helper.h" |
29 | #include "lib/configfile.h" | 30 | #include "lib/configfile.h" |
30 | #include "lib/picture.h" | 31 | #include "lib/picture.h" |
31 | #include "pluginbitmaps/pictureflow_logo.h" | 32 | #include "pluginbitmaps/pictureflow_logo.h" |
32 | #include "lib/grey.h" | 33 | #include "lib/grey.h" |
34 | #include "lib/feature_wrappers.h" | ||
33 | 35 | ||
34 | PLUGIN_HEADER | 36 | PLUGIN_HEADER |
35 | 37 | ||
@@ -41,15 +43,19 @@ const struct button_mapping *plugin_contexts[] | |||
41 | #define NB_ACTION_CONTEXTS sizeof(plugin_contexts)/sizeof(plugin_contexts[0]) | 43 | #define NB_ACTION_CONTEXTS sizeof(plugin_contexts)/sizeof(plugin_contexts[0]) |
42 | 44 | ||
43 | #if LCD_DEPTH < 8 | 45 | #if LCD_DEPTH < 8 |
46 | #if LCD_DEPTH > 1 | ||
47 | #define N_BRIGHT(y) LCD_BRIGHTNESS(y) | ||
48 | #else | ||
49 | #define N_BRIGHT(y) ((y > 127) ? 0 : 1) | ||
50 | #endif | ||
44 | #define USEGSLIB | 51 | #define USEGSLIB |
45 | GREY_INFO_STRUCT | 52 | GREY_INFO_STRUCT |
46 | #define LCD_BUF _grey_info.buffer | 53 | #define LCD_BUF _grey_info.buffer |
47 | #define MYLCD(fn) grey_ ## fn | 54 | #define MYLCD(fn) grey_ ## fn |
48 | #define G_PIX(r,g,b) \ | 55 | #define G_PIX(r,g,b) \ |
49 | (77 * (unsigned)(r) + 150 * (unsigned)(g) + 29 * (unsigned)(b)) / 256 | 56 | (77 * (unsigned)(r) + 150 * (unsigned)(g) + 29 * (unsigned)(b)) / 256 |
50 | #define N_PIX(r,g,b) LCD_BRIGHTNESS(G_PIX(r,g,b)) | 57 | #define N_PIX(r,g,b) N_BRIGHT(G_PIX(r,g,b)) |
51 | #define G_BRIGHT(y) (y) | 58 | #define G_BRIGHT(y) (y) |
52 | #define N_BRIGHT(y) LCD_BRIGHTNESS(y) | ||
53 | #define BUFFER_WIDTH _grey_info.width | 59 | #define BUFFER_WIDTH _grey_info.width |
54 | #define BUFFER_HEIGHT _grey_info.height | 60 | #define BUFFER_HEIGHT _grey_info.height |
55 | typedef unsigned char pix_t; | 61 | typedef unsigned char pix_t; |
@@ -602,7 +608,7 @@ bool get_albumart_for_index_from_db(const int slide_index, char *buf, | |||
602 | fd = rb->open(tcs.result, O_RDONLY); | 608 | fd = rb->open(tcs.result, O_RDONLY); |
603 | rb->get_metadata(&id3, fd, tcs.result); | 609 | rb->get_metadata(&id3, fd, tcs.result); |
604 | rb->close(fd); | 610 | rb->close(fd); |
605 | if ( rb->search_albumart_files(&id3, "", buf, buflen) ) | 611 | if ( search_albumart_files(&id3, "", buf, buflen) ) |
606 | result = true; | 612 | result = true; |
607 | else | 613 | else |
608 | result = false; | 614 | result = false; |
@@ -622,8 +628,10 @@ void draw_splashscreen(void) | |||
622 | { | 628 | { |
623 | struct screen* display = rb->screens[0]; | 629 | struct screen* display = rb->screens[0]; |
624 | 630 | ||
631 | #if LCD_DEPTH > 1 | ||
625 | rb->lcd_set_background(N_BRIGHT(0)); | 632 | rb->lcd_set_background(N_BRIGHT(0)); |
626 | rb->lcd_set_foreground(N_BRIGHT(255)); | 633 | rb->lcd_set_foreground(N_BRIGHT(255)); |
634 | #endif | ||
627 | rb->lcd_clear_display(); | 635 | rb->lcd_clear_display(); |
628 | 636 | ||
629 | const struct picture* logo = &(logos[display->screen_type]); | 637 | const struct picture* logo = &(logos[display->screen_type]); |
@@ -650,12 +658,18 @@ void draw_progressbar(int step) | |||
650 | rb->lcd_putsxy((LCD_WIDTH - txt_w)/2, y, "Preparing album artwork"); | 658 | rb->lcd_putsxy((LCD_WIDTH - txt_w)/2, y, "Preparing album artwork"); |
651 | y += (txt_h + 5); | 659 | y += (txt_h + 5); |
652 | 660 | ||
661 | #if LCD_DEPTH > 1 | ||
653 | rb->lcd_set_foreground(N_BRIGHT(100)); | 662 | rb->lcd_set_foreground(N_BRIGHT(100)); |
663 | #endif | ||
654 | rb->lcd_drawrect(x, y, w+2, bar_height); | 664 | rb->lcd_drawrect(x, y, w+2, bar_height); |
665 | #if LCD_DEPTH > 1 | ||
655 | rb->lcd_set_foreground(N_PIX(165, 231, 82)); | 666 | rb->lcd_set_foreground(N_PIX(165, 231, 82)); |
667 | #endif | ||
656 | 668 | ||
657 | rb->lcd_fillrect(x+1, y+1, step * w / album_count, bar_height-2); | 669 | rb->lcd_fillrect(x+1, y+1, step * w / album_count, bar_height-2); |
670 | #if LCD_DEPTH > 1 | ||
658 | rb->lcd_set_foreground(N_BRIGHT(255)); | 671 | rb->lcd_set_foreground(N_BRIGHT(255)); |
672 | #endif | ||
659 | rb->lcd_update(); | 673 | rb->lcd_update(); |
660 | rb->yield(); | 674 | rb->yield(); |
661 | } | 675 | } |
@@ -691,7 +705,7 @@ bool create_albumart_cache(void) | |||
691 | input_bmp.data = plugin_buf; | 705 | input_bmp.data = plugin_buf; |
692 | input_bmp.width = DISPLAY_WIDTH; | 706 | input_bmp.width = DISPLAY_WIDTH; |
693 | input_bmp.height = DISPLAY_HEIGHT; | 707 | input_bmp.height = DISPLAY_HEIGHT; |
694 | ret = rb->read_bmp_file(albumart_file, &input_bmp, | 708 | ret = scaled_read_bmp_file(albumart_file, &input_bmp, |
695 | plugin_buf_size, format, &format_transposed); | 709 | plugin_buf_size, format, &format_transposed); |
696 | if (ret <= 0) { | 710 | if (ret <= 0) { |
697 | rb->splash(HZ, "Could not read bmp"); | 711 | rb->splash(HZ, "Could not read bmp"); |
@@ -948,7 +962,9 @@ int read_pfraw(char* filename) | |||
948 | 962 | ||
949 | bm->width = bmph.width; | 963 | bm->width = bmph.width; |
950 | bm->height = bmph.height; | 964 | bm->height = bmph.height; |
965 | #if LCD_DEPTH > 1 | ||
951 | bm->format = FORMAT_NATIVE; | 966 | bm->format = FORMAT_NATIVE; |
967 | #endif | ||
952 | bm->data = ((unsigned char *)bm + sizeof(struct bitmap)); | 968 | bm->data = ((unsigned char *)bm + sizeof(struct bitmap)); |
953 | 969 | ||
954 | int y; | 970 | int y; |
@@ -1527,9 +1543,11 @@ int create_empty_slide(bool force) | |||
1527 | int ret; | 1543 | int ret; |
1528 | input_bmp.width = DISPLAY_WIDTH; | 1544 | input_bmp.width = DISPLAY_WIDTH; |
1529 | input_bmp.height = DISPLAY_HEIGHT; | 1545 | input_bmp.height = DISPLAY_HEIGHT; |
1546 | #if LCD_DEPTH > 1 | ||
1530 | input_bmp.format = FORMAT_NATIVE; | 1547 | input_bmp.format = FORMAT_NATIVE; |
1548 | #endif | ||
1531 | input_bmp.data = (char*)plugin_buf; | 1549 | input_bmp.data = (char*)plugin_buf; |
1532 | ret = rb->read_bmp_file(EMPTY_SLIDE_BMP, &input_bmp, | 1550 | ret = scaled_read_bmp_file(EMPTY_SLIDE_BMP, &input_bmp, |
1533 | plugin_buf_size, | 1551 | plugin_buf_size, |
1534 | FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_KEEP_ASPECT, | 1552 | FORMAT_NATIVE|FORMAT_RESIZE|FORMAT_KEEP_ASPECT, |
1535 | &format_transposed); | 1553 | &format_transposed); |
@@ -1641,7 +1659,9 @@ int main_menu(void) | |||
1641 | int selection = 0; | 1659 | int selection = 0; |
1642 | int result; | 1660 | int result; |
1643 | 1661 | ||
1662 | #if LCD_DEPTH > 1 | ||
1644 | rb->lcd_set_foreground(N_BRIGHT(255)); | 1663 | rb->lcd_set_foreground(N_BRIGHT(255)); |
1664 | #endif | ||
1645 | 1665 | ||
1646 | MENUITEM_STRINGLIST(main_menu,"PictureFlow Main Menu",NULL, | 1666 | MENUITEM_STRINGLIST(main_menu,"PictureFlow Main Menu",NULL, |
1647 | "Settings", "Return", "Quit"); | 1667 | "Settings", "Return", "Quit"); |