diff options
Diffstat (limited to 'apps/plugins/pictureflow')
-rw-r--r-- | apps/plugins/pictureflow/pictureflow.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index 463f86c394..155b495ebf 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c | |||
@@ -30,6 +30,7 @@ | |||
30 | #include "lib/helper.h" | 30 | #include "lib/helper.h" |
31 | #include "lib/configfile.h" | 31 | #include "lib/configfile.h" |
32 | #include "lib/grey.h" | 32 | #include "lib/grey.h" |
33 | #include "lib/mylcd.h" | ||
33 | #include "lib/feature_wrappers.h" | 34 | #include "lib/feature_wrappers.h" |
34 | #include "lib/buflib.h" | 35 | #include "lib/buflib.h" |
35 | 36 | ||
@@ -176,7 +177,6 @@ const struct button_mapping *pf_contexts[] = | |||
176 | #define USEGSLIB | 177 | #define USEGSLIB |
177 | GREY_INFO_STRUCT | 178 | GREY_INFO_STRUCT |
178 | #define LCD_BUF _grey_info.buffer | 179 | #define LCD_BUF _grey_info.buffer |
179 | #define MYLCD(fn) grey_ ## fn | ||
180 | #define G_PIX(r,g,b) \ | 180 | #define G_PIX(r,g,b) \ |
181 | (77 * (unsigned)(r) + 150 * (unsigned)(g) + 29 * (unsigned)(b)) / 256 | 181 | (77 * (unsigned)(r) + 150 * (unsigned)(g) + 29 * (unsigned)(b)) / 256 |
182 | #define N_PIX(r,g,b) N_BRIGHT(G_PIX(r,g,b)) | 182 | #define N_PIX(r,g,b) N_BRIGHT(G_PIX(r,g,b)) |
@@ -186,7 +186,6 @@ GREY_INFO_STRUCT | |||
186 | typedef unsigned char pix_t; | 186 | typedef unsigned char pix_t; |
187 | #else /* LCD_DEPTH >= 8 */ | 187 | #else /* LCD_DEPTH >= 8 */ |
188 | #define LCD_BUF rb->lcd_framebuffer | 188 | #define LCD_BUF rb->lcd_framebuffer |
189 | #define MYLCD(fn) rb->lcd_ ## fn | ||
190 | #define G_PIX LCD_RGBPACK | 189 | #define G_PIX LCD_RGBPACK |
191 | #define N_PIX LCD_RGBPACK | 190 | #define N_PIX LCD_RGBPACK |
192 | #define G_BRIGHT(y) LCD_RGBPACK(y,y,y) | 191 | #define G_BRIGHT(y) LCD_RGBPACK(y,y,y) |
@@ -1865,9 +1864,9 @@ void show_next_slide(void) | |||
1865 | */ | 1864 | */ |
1866 | void render_all_slides(void) | 1865 | void render_all_slides(void) |
1867 | { | 1866 | { |
1868 | MYLCD(set_background)(G_BRIGHT(0)); | 1867 | mylcd_set_background(G_BRIGHT(0)); |
1869 | /* TODO: Optimizes this by e.g. invalidating rects */ | 1868 | /* TODO: Optimizes this by e.g. invalidating rects */ |
1870 | MYLCD(clear_display)(); | 1869 | mylcd_clear_display(); |
1871 | 1870 | ||
1872 | int nleft = num_slides; | 1871 | int nleft = num_slides; |
1873 | int nright = num_slides; | 1872 | int nright = num_slides; |
@@ -2251,12 +2250,12 @@ static inline void draw_gradient(int y, int h) | |||
2251 | int c2 = selected_track_pulse - 5; | 2250 | int c2 = selected_track_pulse - 5; |
2252 | for (r=0; r<h; r++) { | 2251 | for (r=0; r<h; r++) { |
2253 | #ifdef HAVE_LCD_COLOR | 2252 | #ifdef HAVE_LCD_COLOR |
2254 | MYLCD(set_foreground)(G_PIX(c2+80-(c >> 9), c2+100-(c >> 9), | 2253 | mylcd_set_foreground(G_PIX(c2+80-(c >> 9), c2+100-(c >> 9), |
2255 | c2+250-(c >> 8))); | 2254 | c2+250-(c >> 8))); |
2256 | #else | 2255 | #else |
2257 | MYLCD(set_foreground)(G_BRIGHT(c2+160-(c >> 8))); | 2256 | mylcd_set_foreground(G_BRIGHT(c2+160-(c >> 8))); |
2258 | #endif | 2257 | #endif |
2259 | MYLCD(hline)(0, LCD_WIDTH, r+y); | 2258 | mylcd_hline(0, LCD_WIDTH, r+y); |
2260 | if ( r > h/2 ) | 2259 | if ( r > h/2 ) |
2261 | c-=inc; | 2260 | c-=inc; |
2262 | else | 2261 | else |
@@ -2312,7 +2311,7 @@ void reset_track_list(void) | |||
2312 | */ | 2311 | */ |
2313 | void show_track_list(void) | 2312 | void show_track_list(void) |
2314 | { | 2313 | { |
2315 | MYLCD(clear_display)(); | 2314 | mylcd_clear_display(); |
2316 | if ( center_slide.slide_index != track_index ) { | 2315 | if ( center_slide.slide_index != track_index ) { |
2317 | create_track_index(center_slide.slide_index); | 2316 | create_track_index(center_slide.slide_index); |
2318 | reset_track_list(); | 2317 | reset_track_list(); |
@@ -2326,11 +2325,11 @@ void show_track_list(void) | |||
2326 | for (;track_i < track_list_visible_entries+start_index_track_list; | 2325 | for (;track_i < track_list_visible_entries+start_index_track_list; |
2327 | track_i++) | 2326 | track_i++) |
2328 | { | 2327 | { |
2329 | MYLCD(getstringsize)(get_track_name(track_i), &titletxt_w, NULL); | 2328 | mylcd_getstringsize(get_track_name(track_i), &titletxt_w, NULL); |
2330 | titletxt_x = (LCD_WIDTH-titletxt_w)/2; | 2329 | titletxt_x = (LCD_WIDTH-titletxt_w)/2; |
2331 | if ( track_i == selected_track ) { | 2330 | if ( track_i == selected_track ) { |
2332 | draw_gradient(titletxt_y, titletxt_h); | 2331 | draw_gradient(titletxt_y, titletxt_h); |
2333 | MYLCD(set_foreground)(G_BRIGHT(255)); | 2332 | mylcd_set_foreground(G_BRIGHT(255)); |
2334 | if (titletxt_w > LCD_WIDTH ) { | 2333 | if (titletxt_w > LCD_WIDTH ) { |
2335 | if ( titletxt_w + track_scroll_index <= LCD_WIDTH ) | 2334 | if ( titletxt_w + track_scroll_index <= LCD_WIDTH ) |
2336 | track_scroll_dir = 1; | 2335 | track_scroll_dir = 1; |
@@ -2338,12 +2337,12 @@ void show_track_list(void) | |||
2338 | track_scroll_index += track_scroll_dir*2; | 2337 | track_scroll_index += track_scroll_dir*2; |
2339 | titletxt_x = track_scroll_index; | 2338 | titletxt_x = track_scroll_index; |
2340 | } | 2339 | } |
2341 | MYLCD(putsxy)(titletxt_x,titletxt_y,get_track_name(track_i)); | 2340 | mylcd_putsxy(titletxt_x,titletxt_y,get_track_name(track_i)); |
2342 | } | 2341 | } |
2343 | else { | 2342 | else { |
2344 | color = 250 - (abs(selected_track - track_i) * 200 / track_count); | 2343 | color = 250 - (abs(selected_track - track_i) * 200 / track_count); |
2345 | MYLCD(set_foreground)(G_BRIGHT(color)); | 2344 | mylcd_set_foreground(G_BRIGHT(color)); |
2346 | MYLCD(putsxy)(titletxt_x,titletxt_y,get_track_name(track_i)); | 2345 | mylcd_putsxy(titletxt_x,titletxt_y,get_track_name(track_i)); |
2347 | } | 2346 | } |
2348 | titletxt_y += titletxt_h; | 2347 | titletxt_y += titletxt_h; |
2349 | } | 2348 | } |
@@ -2446,8 +2445,8 @@ void draw_album_text(void) | |||
2446 | albumtxt = get_album_name(center_index); | 2445 | albumtxt = get_album_name(center_index); |
2447 | } | 2446 | } |
2448 | 2447 | ||
2449 | MYLCD(set_foreground)(G_BRIGHT(c)); | 2448 | mylcd_set_foreground(G_BRIGHT(c)); |
2450 | MYLCD(getstringsize)(albumtxt, &albumtxt_w, &albumtxt_h); | 2449 | mylcd_getstringsize(albumtxt, &albumtxt_w, &albumtxt_h); |
2451 | if (center_index != prev_center_index) { | 2450 | if (center_index != prev_center_index) { |
2452 | albumtxt_x = 0; | 2451 | albumtxt_x = 0; |
2453 | albumtxt_dir = -1; | 2452 | albumtxt_dir = -1; |
@@ -2460,7 +2459,7 @@ void draw_album_text(void) | |||
2460 | albumtxt_y = LCD_HEIGHT - albumtxt_h - albumtxt_h/2; | 2459 | albumtxt_y = LCD_HEIGHT - albumtxt_h - albumtxt_h/2; |
2461 | 2460 | ||
2462 | if (albumtxt_w > LCD_WIDTH ) { | 2461 | if (albumtxt_w > LCD_WIDTH ) { |
2463 | MYLCD(putsxy)(albumtxt_x, albumtxt_y , albumtxt); | 2462 | mylcd_putsxy(albumtxt_x, albumtxt_y , albumtxt); |
2464 | if ( pf_state == pf_idle || pf_state == pf_show_tracks ) { | 2463 | if ( pf_state == pf_idle || pf_state == pf_show_tracks ) { |
2465 | if ( albumtxt_w + albumtxt_x <= LCD_WIDTH ) albumtxt_dir = 1; | 2464 | if ( albumtxt_w + albumtxt_x <= LCD_WIDTH ) albumtxt_dir = 1; |
2466 | else if ( albumtxt_x >= 0 ) albumtxt_dir = -1; | 2465 | else if ( albumtxt_x >= 0 ) albumtxt_dir = -1; |
@@ -2468,7 +2467,7 @@ void draw_album_text(void) | |||
2468 | } | 2467 | } |
2469 | } | 2468 | } |
2470 | else { | 2469 | else { |
2471 | MYLCD(putsxy)((LCD_WIDTH - albumtxt_w) /2, albumtxt_y , albumtxt); | 2470 | mylcd_putsxy((LCD_WIDTH - albumtxt_w) /2, albumtxt_y , albumtxt); |
2472 | } | 2471 | } |
2473 | 2472 | ||
2474 | 2473 | ||
@@ -2641,9 +2640,9 @@ int main(void) | |||
2641 | if (show_fps) | 2640 | if (show_fps) |
2642 | { | 2641 | { |
2643 | #ifdef USEGSLIB | 2642 | #ifdef USEGSLIB |
2644 | MYLCD(set_foreground)(G_BRIGHT(255)); | 2643 | mylcd_set_foreground(G_BRIGHT(255)); |
2645 | #else | 2644 | #else |
2646 | MYLCD(set_foreground)(G_PIX(255,0,0)); | 2645 | mylcd_set_foreground(G_PIX(255,0,0)); |
2647 | #endif | 2646 | #endif |
2648 | rb->snprintf(fpstxt, sizeof(fpstxt), "FPS: %d", fps); | 2647 | rb->snprintf(fpstxt, sizeof(fpstxt), "FPS: %d", fps); |
2649 | if (show_album_name == album_name_top) | 2648 | if (show_album_name == album_name_top) |
@@ -2651,13 +2650,13 @@ int main(void) | |||
2651 | rb->screens[SCREEN_MAIN]->getcharheight(); | 2650 | rb->screens[SCREEN_MAIN]->getcharheight(); |
2652 | else | 2651 | else |
2653 | fpstxt_y = 0; | 2652 | fpstxt_y = 0; |
2654 | MYLCD(putsxy)(0, fpstxt_y, fpstxt); | 2653 | mylcd_putsxy(0, fpstxt_y, fpstxt); |
2655 | } | 2654 | } |
2656 | draw_album_text(); | 2655 | draw_album_text(); |
2657 | 2656 | ||
2658 | 2657 | ||
2659 | /* Copy offscreen buffer to LCD and give time to other threads */ | 2658 | /* Copy offscreen buffer to LCD and give time to other threads */ |
2660 | MYLCD(update)(); | 2659 | mylcd_update(); |
2661 | rb->yield(); | 2660 | rb->yield(); |
2662 | 2661 | ||
2663 | /*/ Handle buttons */ | 2662 | /*/ Handle buttons */ |
@@ -2695,7 +2694,7 @@ int main(void) | |||
2695 | #ifdef USEGSLIB | 2694 | #ifdef USEGSLIB |
2696 | grey_show(true); | 2695 | grey_show(true); |
2697 | #endif | 2696 | #endif |
2698 | MYLCD(set_drawmode)(DRMODE_FG); | 2697 | mylcd_set_drawmode(DRMODE_FG); |
2699 | break; | 2698 | break; |
2700 | 2699 | ||
2701 | case PF_NEXT: | 2700 | case PF_NEXT: |