diff options
Diffstat (limited to 'apps/plugins')
-rw-r--r-- | apps/plugins/fft/fft.c | 100 | ||||
-rw-r--r-- | apps/plugins/lib/mylcd.h | 142 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/mpeg_settings.c | 68 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/mpegplayer.c | 92 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/mpegplayer.h | 18 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/video_out_rockbox.c | 10 | ||||
-rw-r--r-- | apps/plugins/mpegplayer/video_thread.c | 4 |
7 files changed, 278 insertions, 156 deletions
diff --git a/apps/plugins/fft/fft.c b/apps/plugins/fft/fft.c index 28e775a9c1..b971a8f92f 100644 --- a/apps/plugins/fft/fft.c +++ b/apps/plugins/fft/fft.c | |||
@@ -22,6 +22,7 @@ | |||
22 | 22 | ||
23 | #include "lib/helper.h" | 23 | #include "lib/helper.h" |
24 | #include "lib/xlcd.h" | 24 | #include "lib/xlcd.h" |
25 | #include "lib/mylcd.h" | ||
25 | #include "math.h" | 26 | #include "math.h" |
26 | #include "fracmul.h" | 27 | #include "fracmul.h" |
27 | 28 | ||
@@ -257,16 +258,6 @@ GREY_INFO_STRUCT | |||
257 | #define FFT_SIZE 4096 /* 2048*2 */ | 258 | #define FFT_SIZE 4096 /* 2048*2 */ |
258 | #endif | 259 | #endif |
259 | 260 | ||
260 | #ifdef HAVE_LCD_COLOR | ||
261 | #define lcd_(fn) rb->lcd_##fn | ||
262 | #define lcd_scroll_up xlcd_scroll_up | ||
263 | #define lcd_scroll_left xlcd_scroll_left | ||
264 | #else | ||
265 | #define lcd_(fn) grey_##fn | ||
266 | #define lcd_scroll_up grey_scroll_up | ||
267 | #define lcd_scroll_left grey_scroll_left | ||
268 | #endif | ||
269 | |||
270 | #define ARRAYLEN_IN (FFT_SIZE) | 261 | #define ARRAYLEN_IN (FFT_SIZE) |
271 | #define ARRAYLEN_OUT (FFT_SIZE) | 262 | #define ARRAYLEN_OUT (FFT_SIZE) |
272 | #define ARRAYLEN_PLOT (FFT_SIZE/2-1) /* FFT is symmetric, ignore DC */ | 263 | #define ARRAYLEN_PLOT (FFT_SIZE/2-1) /* FFT is symmetric, ignore DC */ |
@@ -568,15 +559,14 @@ static void draw_bars_horizontal(void); | |||
568 | static void draw_spectrogram_vertical(void); | 559 | static void draw_spectrogram_vertical(void); |
569 | static void draw_spectrogram_horizontal(void); | 560 | static void draw_spectrogram_horizontal(void); |
570 | 561 | ||
562 | #define COLOR_DEFAULT_FG MYLCD_DEFAULT_FG | ||
563 | #define COLOR_DEFAULT_BG MYLCD_DEFAULT_BG | ||
564 | |||
571 | #ifdef HAVE_LCD_COLOR | 565 | #ifdef HAVE_LCD_COLOR |
572 | #define COLOR_DEFAULT_FG LCD_DEFAULT_FG | ||
573 | #define COLOR_DEFAULT_BG LCD_DEFAULT_BG | ||
574 | #define COLOR_MESSAGE_FRAME LCD_RGBPACK(0xc6, 0x00, 0x00) | 566 | #define COLOR_MESSAGE_FRAME LCD_RGBPACK(0xc6, 0x00, 0x00) |
575 | #define COLOR_MESSAGE_BG LCD_BLACK | 567 | #define COLOR_MESSAGE_BG LCD_BLACK |
576 | #define COLOR_MESSAGE_FG LCD_WHITE | 568 | #define COLOR_MESSAGE_FG LCD_WHITE |
577 | #else | 569 | #else |
578 | #define COLOR_DEFAULT_FG GREY_BLACK | ||
579 | #define COLOR_DEFAULT_BG GREY_WHITE | ||
580 | #define COLOR_MESSAGE_FRAME GREY_DARKGRAY | 570 | #define COLOR_MESSAGE_FRAME GREY_DARKGRAY |
581 | #define COLOR_MESSAGE_BG GREY_WHITE | 571 | #define COLOR_MESSAGE_BG GREY_WHITE |
582 | #define COLOR_MESSAGE_FG GREY_BLACK | 572 | #define COLOR_MESSAGE_FG GREY_BLACK |
@@ -588,7 +578,7 @@ static void draw_spectrogram_horizontal(void); | |||
588 | static void draw_message_string(const unsigned char *message, bool active) | 578 | static void draw_message_string(const unsigned char *message, bool active) |
589 | { | 579 | { |
590 | int x, y; | 580 | int x, y; |
591 | lcd_(getstringsize)(message, &x, &y); | 581 | mylcd_getstringsize(message, &x, &y); |
592 | 582 | ||
593 | /* x and y give the size of the box for the popup */ | 583 | /* x and y give the size of the box for the popup */ |
594 | x += POPUP_HPADDING*2; | 584 | x += POPUP_HPADDING*2; |
@@ -601,20 +591,20 @@ static void draw_message_string(const unsigned char *message, bool active) | |||
601 | graph_settings.orientation_vertical && | 591 | graph_settings.orientation_vertical && |
602 | graph_settings.spectrogram_pos >= LCD_WIDTH - x) | 592 | graph_settings.spectrogram_pos >= LCD_WIDTH - x) |
603 | { | 593 | { |
604 | lcd_scroll_left(graph_settings.spectrogram_pos - | 594 | mylcd_scroll_left(graph_settings.spectrogram_pos - |
605 | LCD_WIDTH + x); | 595 | LCD_WIDTH + x); |
606 | graph_settings.spectrogram_pos = LCD_WIDTH - x - 1; | 596 | graph_settings.spectrogram_pos = LCD_WIDTH - x - 1; |
607 | } | 597 | } |
608 | 598 | ||
609 | lcd_(set_foreground)(COLOR_MESSAGE_FRAME); | 599 | mylcd_set_foreground(COLOR_MESSAGE_FRAME); |
610 | lcd_(fillrect)(LCD_WIDTH - x, 0, LCD_WIDTH - 1, y); | 600 | mylcd_fillrect(LCD_WIDTH - x, 0, LCD_WIDTH - 1, y); |
611 | 601 | ||
612 | lcd_(set_foreground)(COLOR_MESSAGE_FG); | 602 | mylcd_set_foreground(COLOR_MESSAGE_FG); |
613 | lcd_(set_background)(COLOR_MESSAGE_BG); | 603 | mylcd_set_background(COLOR_MESSAGE_BG); |
614 | lcd_(putsxy)(LCD_WIDTH - x + POPUP_HPADDING, | 604 | mylcd_putsxy(LCD_WIDTH - x + POPUP_HPADDING, |
615 | POPUP_VPADDING, message); | 605 | POPUP_VPADDING, message); |
616 | lcd_(set_foreground)(COLOR_DEFAULT_FG); | 606 | mylcd_set_foreground(COLOR_DEFAULT_FG); |
617 | lcd_(set_background)(COLOR_DEFAULT_BG); | 607 | mylcd_set_background(COLOR_DEFAULT_BG); |
618 | } | 608 | } |
619 | 609 | ||
620 | static void draw(const unsigned char* message) | 610 | static void draw(const unsigned char* message) |
@@ -647,15 +637,15 @@ static void draw(const unsigned char* message) | |||
647 | if(graph_settings.changed.freq_scale) | 637 | if(graph_settings.changed.freq_scale) |
648 | graph_settings.changed.freq_scale = true; | 638 | graph_settings.changed.freq_scale = true; |
649 | 639 | ||
650 | lcd_(set_foreground)(COLOR_DEFAULT_FG); | 640 | mylcd_set_foreground(COLOR_DEFAULT_FG); |
651 | lcd_(set_background)(COLOR_DEFAULT_BG); | 641 | mylcd_set_background(COLOR_DEFAULT_BG); |
652 | 642 | ||
653 | switch (graph_settings.mode) | 643 | switch (graph_settings.mode) |
654 | { | 644 | { |
655 | default: | 645 | default: |
656 | case FFT_DM_LINES: { | 646 | case FFT_DM_LINES: { |
657 | 647 | ||
658 | lcd_(clear_display)(); | 648 | mylcd_clear_display(); |
659 | 649 | ||
660 | if (graph_settings.orientation_vertical) | 650 | if (graph_settings.orientation_vertical) |
661 | draw_lines_vertical(); | 651 | draw_lines_vertical(); |
@@ -665,7 +655,7 @@ static void draw(const unsigned char* message) | |||
665 | } | 655 | } |
666 | case FFT_DM_BARS: { | 656 | case FFT_DM_BARS: { |
667 | 657 | ||
668 | lcd_(clear_display()); | 658 | mylcd_clear_display(); |
669 | 659 | ||
670 | if(graph_settings.orientation_vertical) | 660 | if(graph_settings.orientation_vertical) |
671 | draw_bars_vertical(); | 661 | draw_bars_vertical(); |
@@ -679,7 +669,7 @@ static void draw(const unsigned char* message) | |||
679 | if(graph_settings.changed.do_clear) | 669 | if(graph_settings.changed.do_clear) |
680 | { | 670 | { |
681 | graph_settings.spectrogram_pos = 0; | 671 | graph_settings.spectrogram_pos = 0; |
682 | lcd_(clear_display)(); | 672 | mylcd_clear_display(); |
683 | } | 673 | } |
684 | 674 | ||
685 | if(graph_settings.orientation_vertical) | 675 | if(graph_settings.orientation_vertical) |
@@ -709,7 +699,7 @@ static void draw(const unsigned char* message) | |||
709 | { | 699 | { |
710 | /* Spectrogram mode - need to erase the popup */ | 700 | /* Spectrogram mode - need to erase the popup */ |
711 | int x, y; | 701 | int x, y; |
712 | lcd_(getstringsize)(last_message, &x, &y); | 702 | mylcd_getstringsize(last_message, &x, &y); |
713 | /* Recalculate the size */ | 703 | /* Recalculate the size */ |
714 | x += POPUP_HPADDING*2; | 704 | x += POPUP_HPADDING*2; |
715 | y += POPUP_VPADDING*2; | 705 | y += POPUP_VPADDING*2; |
@@ -717,7 +707,7 @@ static void draw(const unsigned char* message) | |||
717 | if(!graph_settings.orientation_vertical) | 707 | if(!graph_settings.orientation_vertical) |
718 | { | 708 | { |
719 | /* In horizontal spectrogram mode, just scroll up by Y lines */ | 709 | /* In horizontal spectrogram mode, just scroll up by Y lines */ |
720 | lcd_scroll_up(y); | 710 | mylcd_scroll_up(y); |
721 | graph_settings.spectrogram_pos -= y; | 711 | graph_settings.spectrogram_pos -= y; |
722 | if(graph_settings.spectrogram_pos < 0) | 712 | if(graph_settings.spectrogram_pos < 0) |
723 | graph_settings.spectrogram_pos = 0; | 713 | graph_settings.spectrogram_pos = 0; |
@@ -725,10 +715,10 @@ static void draw(const unsigned char* message) | |||
725 | else | 715 | else |
726 | { | 716 | { |
727 | /* In vertical spectrogram mode, erase the popup */ | 717 | /* In vertical spectrogram mode, erase the popup */ |
728 | lcd_(set_foreground)(COLOR_DEFAULT_BG); | 718 | mylcd_set_foreground(COLOR_DEFAULT_BG); |
729 | lcd_(fillrect)(graph_settings.spectrogram_pos + 1, 0, | 719 | mylcd_fillrect(graph_settings.spectrogram_pos + 1, 0, |
730 | LCD_WIDTH, y); | 720 | LCD_WIDTH, y); |
731 | lcd_(set_foreground)(COLOR_DEFAULT_FG); | 721 | mylcd_set_foreground(COLOR_DEFAULT_FG); |
732 | } | 722 | } |
733 | } | 723 | } |
734 | /* else These modes clear the screen themselves */ | 724 | /* else These modes clear the screen themselves */ |
@@ -736,7 +726,7 @@ static void draw(const unsigned char* message) | |||
736 | last_message = NULL; | 726 | last_message = NULL; |
737 | } | 727 | } |
738 | 728 | ||
739 | lcd_(update)(); | 729 | mylcd_update(); |
740 | 730 | ||
741 | graph_settings.changed.clear_all = false; | 731 | graph_settings.changed.clear_all = false; |
742 | } | 732 | } |
@@ -763,7 +753,7 @@ static void draw_lines_vertical(void) | |||
763 | 753 | ||
764 | if(this_max == 0) | 754 | if(this_max == 0) |
765 | { | 755 | { |
766 | lcd_(hline)(0, LCD_WIDTH - 1, LCD_HEIGHT - 1); /* Draw all "zero" */ | 756 | mylcd_hline(0, LCD_WIDTH - 1, LCD_HEIGHT - 1); /* Draw all "zero" */ |
767 | return; | 757 | return; |
768 | } | 758 | } |
769 | 759 | ||
@@ -812,7 +802,7 @@ static void draw_lines_vertical(void) | |||
812 | for(x = 0; x < plotwidth; ++x) | 802 | for(x = 0; x < plotwidth; ++x) |
813 | { | 803 | { |
814 | int h = LCD_HEIGHT*plot[x] / max; | 804 | int h = LCD_HEIGHT*plot[x] / max; |
815 | lcd_(vline)(x + offset, LCD_HEIGHT - h, LCD_HEIGHT-1); | 805 | mylcd_vline(x + offset, LCD_HEIGHT - h, LCD_HEIGHT-1); |
816 | } | 806 | } |
817 | } | 807 | } |
818 | 808 | ||
@@ -838,7 +828,7 @@ static void draw_lines_horizontal(void) | |||
838 | 828 | ||
839 | if(this_max == 0) | 829 | if(this_max == 0) |
840 | { | 830 | { |
841 | lcd_(vline)(0, 0, LCD_HEIGHT-1); /* Draw all "zero" */ | 831 | mylcd_vline(0, 0, LCD_HEIGHT-1); /* Draw all "zero" */ |
842 | return; | 832 | return; |
843 | } | 833 | } |
844 | 834 | ||
@@ -888,7 +878,7 @@ static void draw_lines_horizontal(void) | |||
888 | for(y = 0; y < plotwidth; ++y) | 878 | for(y = 0; y < plotwidth; ++y) |
889 | { | 879 | { |
890 | int w = LCD_WIDTH*plot[y] / max; | 880 | int w = LCD_WIDTH*plot[y] / max; |
891 | lcd_(hline)(0, w - 1, y + offset); | 881 | mylcd_hline(0, w - 1, y + offset); |
892 | } | 882 | } |
893 | } | 883 | } |
894 | 884 | ||
@@ -909,7 +899,7 @@ static void draw_bars_vertical(void) | |||
909 | if(graph_settings.changed.amp_scale) | 899 | if(graph_settings.changed.amp_scale) |
910 | max = 0; /* reset the graph on scaling mode change */ | 900 | max = 0; /* reset the graph on scaling mode change */ |
911 | 901 | ||
912 | lcd_(hline)(0, LCD_WIDTH-1, LCD_HEIGHT-1); /* Draw baseline */ | 902 | mylcd_hline(0, LCD_WIDTH-1, LCD_HEIGHT-1); /* Draw baseline */ |
913 | 903 | ||
914 | if(calc_magnitudes(graph_settings.logarithmic_amp) == 0) | 904 | if(calc_magnitudes(graph_settings.logarithmic_amp) == 0) |
915 | return; /* nothing more to draw */ | 905 | return; /* nothing more to draw */ |
@@ -948,7 +938,7 @@ static void draw_bars_vertical(void) | |||
948 | for(i = 0, x = offset; i < bars; ++i, x += barwidth) | 938 | for(i = 0, x = offset; i < bars; ++i, x += barwidth) |
949 | { | 939 | { |
950 | int h = LCD_HEIGHT * plot[i] / max; | 940 | int h = LCD_HEIGHT * plot[i] / max; |
951 | lcd_(fillrect)(x, LCD_HEIGHT - h, width, h - 1); | 941 | mylcd_fillrect(x, LCD_HEIGHT - h, width, h - 1); |
952 | } | 942 | } |
953 | } | 943 | } |
954 | 944 | ||
@@ -969,7 +959,7 @@ static void draw_bars_horizontal(void) | |||
969 | if(graph_settings.changed.amp_scale) | 959 | if(graph_settings.changed.amp_scale) |
970 | max = 0; /* reset the graph on scaling mode change */ | 960 | max = 0; /* reset the graph on scaling mode change */ |
971 | 961 | ||
972 | lcd_(vline)(0, 0, LCD_HEIGHT-1); /* Draw baseline */ | 962 | mylcd_vline(0, 0, LCD_HEIGHT-1); /* Draw baseline */ |
973 | 963 | ||
974 | if(calc_magnitudes(graph_settings.logarithmic_amp) == 0) | 964 | if(calc_magnitudes(graph_settings.logarithmic_amp) == 0) |
975 | return; /* nothing more to draw */ | 965 | return; /* nothing more to draw */ |
@@ -1008,7 +998,7 @@ static void draw_bars_horizontal(void) | |||
1008 | for(i = 0, y = offset; i < bars; ++i, y += barwidth) | 998 | for(i = 0, y = offset; i < bars; ++i, y += barwidth) |
1009 | { | 999 | { |
1010 | int w = LCD_WIDTH * plot[i] / max; | 1000 | int w = LCD_WIDTH * plot[i] / max; |
1011 | lcd_(fillrect)(1, y, w, height); | 1001 | mylcd_fillrect(1, y, w, height); |
1012 | } | 1002 | } |
1013 | } | 1003 | } |
1014 | 1004 | ||
@@ -1048,8 +1038,8 @@ static void draw_spectrogram_vertical(void) | |||
1048 | if(index >= SHADES) | 1038 | if(index >= SHADES) |
1049 | index = SHADES-1; | 1039 | index = SHADES-1; |
1050 | 1040 | ||
1051 | lcd_(set_foreground)(SPECTROGRAPH_PALETTE(index)); | 1041 | mylcd_set_foreground(SPECTROGRAPH_PALETTE(index)); |
1052 | lcd_(drawpixel)(graph_settings.spectrogram_pos, | 1042 | mylcd_drawpixel(graph_settings.spectrogram_pos, |
1053 | scale_factor-1 - y); | 1043 | scale_factor-1 - y); |
1054 | 1044 | ||
1055 | if(++y >= scale_factor) | 1045 | if(++y >= scale_factor) |
@@ -1063,7 +1053,7 @@ static void draw_spectrogram_vertical(void) | |||
1063 | if(graph_settings.spectrogram_pos < LCD_WIDTH-1) | 1053 | if(graph_settings.spectrogram_pos < LCD_WIDTH-1) |
1064 | graph_settings.spectrogram_pos++; | 1054 | graph_settings.spectrogram_pos++; |
1065 | else | 1055 | else |
1066 | lcd_scroll_left(1); | 1056 | mylcd_scroll_left(1); |
1067 | } | 1057 | } |
1068 | 1058 | ||
1069 | static void draw_spectrogram_horizontal(void) | 1059 | static void draw_spectrogram_horizontal(void) |
@@ -1102,8 +1092,8 @@ static void draw_spectrogram_horizontal(void) | |||
1102 | if(index >= SHADES) | 1092 | if(index >= SHADES) |
1103 | index = SHADES-1; | 1093 | index = SHADES-1; |
1104 | 1094 | ||
1105 | lcd_(set_foreground)(SPECTROGRAPH_PALETTE(index)); | 1095 | mylcd_set_foreground(SPECTROGRAPH_PALETTE(index)); |
1106 | lcd_(drawpixel)(x, graph_settings.spectrogram_pos); | 1096 | mylcd_drawpixel(x, graph_settings.spectrogram_pos); |
1107 | 1097 | ||
1108 | if(++x >= scale_factor) | 1098 | if(++x >= scale_factor) |
1109 | break; | 1099 | break; |
@@ -1116,7 +1106,7 @@ static void draw_spectrogram_horizontal(void) | |||
1116 | if(graph_settings.spectrogram_pos < LCD_HEIGHT-1) | 1106 | if(graph_settings.spectrogram_pos < LCD_HEIGHT-1) |
1117 | graph_settings.spectrogram_pos++; | 1107 | graph_settings.spectrogram_pos++; |
1118 | else | 1108 | else |
1119 | lcd_scroll_up(1); | 1109 | mylcd_scroll_up(1); |
1120 | } | 1110 | } |
1121 | 1111 | ||
1122 | /********************* End of plotting functions (modes) *********************/ | 1112 | /********************* End of plotting functions (modes) *********************/ |
@@ -1334,8 +1324,8 @@ enum plugin_status plugin_start(const void* parameter) | |||
1334 | 1324 | ||
1335 | #if LCD_DEPTH > 1 | 1325 | #if LCD_DEPTH > 1 |
1336 | rb->lcd_set_backdrop(NULL); | 1326 | rb->lcd_set_backdrop(NULL); |
1337 | lcd_(clear_display)(); | 1327 | mylcd_clear_display(); |
1338 | lcd_(update)(); | 1328 | mylcd_update(); |
1339 | #endif | 1329 | #endif |
1340 | backlight_force_on(); | 1330 | backlight_force_on(); |
1341 | 1331 | ||
@@ -1357,9 +1347,9 @@ enum plugin_status plugin_start(const void* parameter) | |||
1357 | if(!rb->pcm_is_playing()) | 1347 | if(!rb->pcm_is_playing()) |
1358 | { | 1348 | { |
1359 | showing_warning = true; | 1349 | showing_warning = true; |
1360 | lcd_(clear_display)(); | 1350 | mylcd_clear_display(); |
1361 | draw_message_string("No audio playing", false); | 1351 | draw_message_string("No audio playing", false); |
1362 | lcd_(update)(); | 1352 | mylcd_update(); |
1363 | timeout = HZ/5; | 1353 | timeout = HZ/5; |
1364 | } | 1354 | } |
1365 | else | 1355 | else |
@@ -1367,8 +1357,8 @@ enum plugin_status plugin_start(const void* parameter) | |||
1367 | if(showing_warning) | 1357 | if(showing_warning) |
1368 | { | 1358 | { |
1369 | showing_warning = false; | 1359 | showing_warning = false; |
1370 | lcd_(clear_display)(); | 1360 | mylcd_clear_display(); |
1371 | lcd_(update)(); | 1361 | mylcd_update(); |
1372 | } | 1362 | } |
1373 | 1363 | ||
1374 | timeout = HZ/100; /* 'till end of curent tick, don't use 100% CPU */ | 1364 | timeout = HZ/100; /* 'till end of curent tick, don't use 100% CPU */ |
diff --git a/apps/plugins/lib/mylcd.h b/apps/plugins/lib/mylcd.h new file mode 100644 index 0000000000..8b6223c30b --- /dev/null +++ b/apps/plugins/lib/mylcd.h | |||
@@ -0,0 +1,142 @@ | |||
1 | /*************************************************************************** | ||
2 | * __________ __ ___. | ||
3 | * Open \______ \ ____ ____ | | _\_ |__ _______ ___ | ||
4 | * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ / | ||
5 | * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < < | ||
6 | * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \ | ||
7 | * \/ \/ \/ \/ \/ | ||
8 | * $Id$ | ||
9 | * | ||
10 | * Copyright (c) 2010 Michael Sevakis | ||
11 | * | ||
12 | * Helper defines for writing code for both grey and color targets. | ||
13 | * | ||
14 | * This program is free software; you can redistribute it and/or | ||
15 | * modify it under the terms of the GNU General Public License | ||
16 | * as published by the Free Software Foundation; either version 2 | ||
17 | * of the License, or (at your option) any later version. | ||
18 | * | ||
19 | * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY | ||
20 | * KIND, either express or implied. | ||
21 | * | ||
22 | ****************************************************************************/ | ||
23 | #ifndef MYLCD_H | ||
24 | #define MYLCD_H | ||
25 | |||
26 | /*** | ||
27 | * Most functions are, other than color depth, equivalent between grey, lcd | ||
28 | * and xlcd and most of the time the caller need not be concerned with which | ||
29 | * is actually called, making code nicer to read and maintain. | ||
30 | * | ||
31 | * Unbuffered routines revert to standard rb->lcd_XXXX funtions on color | ||
32 | * targets. On color, mylcd_ub_update_XXXX refer to the proper update | ||
33 | * functions, otherwise they are no-ops. | ||
34 | */ | ||
35 | |||
36 | #ifdef HAVE_LCD_COLOR | ||
37 | #define mylcd_(fn) rb->lcd_##fn | ||
38 | #define myxlcd_(fn) xlcd_##fn | ||
39 | #define mylcd_ub_(fn) rb->lcd_##fn | ||
40 | #define myxlcd_ub_(fn) xlcd_##fn | ||
41 | #else | ||
42 | #define mylcd_(fn) grey_##fn | ||
43 | #define myxlcd_(fn) grey_##fn | ||
44 | #define mylcd_ub_(fn) grey_ub_##fn | ||
45 | #define myxlcd_ub_(fn) grey_ub_##fn | ||
46 | #endif | ||
47 | |||
48 | /* Common colors */ | ||
49 | #ifdef HAVE_LCD_COLOR | ||
50 | #define MYLCD_BLACK LCD_BLACK | ||
51 | #define MYLCD_DARKGRAY LCD_DARKGRAY | ||
52 | #define MYLCD_LIGHTGRAY LCD_LIGHTGRAY | ||
53 | #define MYLCD_WHITE LCD_WHITE | ||
54 | #define MYLCD_DEFAULT_FG LCD_DEFAULT_FG | ||
55 | #define MYLCD_DEFAULT_BG LCD_DEFAULT_BG | ||
56 | #else | ||
57 | #define MYLCD_BLACK GREY_BLACK | ||
58 | #define MYLCD_DARKGRAY GREY_DARKGRAY | ||
59 | #define MYLCD_LIGHTGRAY GREY_LIGHTGRAY | ||
60 | #define MYLCD_WHITE GREY_WHITE | ||
61 | #define MYLCD_DEFAULT_FG GREY_BLACK | ||
62 | #define MYLCD_DEFAULT_BG GREY_WHITE | ||
63 | #endif /* HAVE_LCD_COLOR */ | ||
64 | |||
65 | /* Update functions */ | ||
66 | #define mylcd_update mylcd_(update) | ||
67 | #define mylcd_update_rect mylcd_(update_rect) | ||
68 | |||
69 | /* Update functions - unbuffered : special handling for these */ | ||
70 | #ifdef HAVE_LCD_COLOR | ||
71 | #define mylcd_ub_update() rb->lcd_update() | ||
72 | #define mylcd_ub_update_rect(...) rb->lcd_update_rect(__VA_ARGS__) | ||
73 | #else | ||
74 | /* Still evaluate args like functions */ | ||
75 | static inline void mylcd_ub_update(void) | ||
76 | {} | ||
77 | static inline void mylcd_ub_update_rect(int x, int y, int w, int h) | ||
78 | { (void)x; (void)y; (void)w; (void)h; } | ||
79 | #endif | ||
80 | |||
81 | /* Parameter handling */ | ||
82 | #define mylcd_set_drawmode mylcd_(set_drawmode) | ||
83 | #define mylcd_get_drawmode mylcd_(get_drawmode) | ||
84 | #define mylcd_set_foreground mylcd_(set_foreground) | ||
85 | #define mylcd_get_foreground mylcd_(get_foreground) | ||
86 | #define mylcd_set_background mylcd_(set_background) | ||
87 | #define mylcd_get_background mylcd_(get_background) | ||
88 | #define mylcd_set_drawinfo mylcd_(set_drawinfo) | ||
89 | #define mylcd_setfont mylcd_(setfont) | ||
90 | #define mylcd_getstringsize mylcd_(getstringsize) | ||
91 | |||
92 | /* Whole display */ | ||
93 | #define mylcd_clear_display mylcd_(clear_display) | ||
94 | |||
95 | /* Whole display - unbuffered */ | ||
96 | #define mylcd_ub_clear_display mylcd_ub_(clear_display) | ||
97 | |||
98 | /* Pixel */ | ||
99 | #define mylcd_drawpixel mylcd_(drawpixel) | ||
100 | |||
101 | /* Lines */ | ||
102 | #define mylcd_drawline mylcd_(drawline) | ||
103 | #define mylcd_hline mylcd_(hline) | ||
104 | #define mylcd_vline mylcd_(vline) | ||
105 | #define mylcd_drawrect mylcd_(drawrect) | ||
106 | |||
107 | /* Filled Primitives */ | ||
108 | #define mylcd_fillrect mylcd_(fillrect) | ||
109 | #define mylcd_filltriangle myxlcd_(filltriangle) | ||
110 | |||
111 | /* Bitmaps */ | ||
112 | #define mylcd_mono_bitmap_part mylcd_(mono_bitmap_part) | ||
113 | #define mylcd_mono_bitmap mylcd_(mono_bitmap) | ||
114 | #define mylcd_gray_bitmap_part myxlcd_(gray_bitmap_part) | ||
115 | #define mylcd_gray_bitmap myxlcd_(gray_bitmap) | ||
116 | #if 0 /* possible, but not implemented in greylib */ | ||
117 | #define mylcd_color_bitmap_part myxlcd_(color_bitmap_part) | ||
118 | #define mylcd_color_bitmap myxlcd_(color_bitmap) | ||
119 | #endif | ||
120 | |||
121 | /* Bitmaps - unbuffered */ | ||
122 | #define mylcd_ub_gray_bitmap_part myxlcd_ub_(gray_bitmap_part) | ||
123 | #define mylcd_ub_gray_bitmap myxlcd_ub_(gray_bitmap) | ||
124 | |||
125 | /* Text */ | ||
126 | /* lcd_putsxyofs is static'ed in the core for now on color */ | ||
127 | #define mylcd_putsxyofs mylcd_(putsxyofs) | ||
128 | #define mylcd_putsxy mylcd_(putsxy) | ||
129 | |||
130 | /* Scrolling */ | ||
131 | #define mylcd_scroll_left myxlcd_(scroll_left) | ||
132 | #define mylcd_scroll_right myxlcd_(scroll_right) | ||
133 | #define mylcd_scroll_up myxlcd_(scroll_up) | ||
134 | #define mylcd_scroll_down myxlcd_(scroll_down) | ||
135 | |||
136 | /* Scrolling - unbuffered */ | ||
137 | #define mylcd_ub_scroll_left myxlcd_ub_(scroll_left) | ||
138 | #define mylcd_ub_scroll_right myxlcd_ub_(scroll_right) | ||
139 | #define mylcd_ub_scroll_up myxlcd_ub_(scroll_up) | ||
140 | #define mylcd_ub_scroll_down myxlcd_ub_(scroll_down) | ||
141 | |||
142 | #endif /* MYLCD_H */ | ||
diff --git a/apps/plugins/mpegplayer/mpeg_settings.c b/apps/plugins/mpegplayer/mpeg_settings.c index 1ac2476b25..1f321c1285 100644 --- a/apps/plugins/mpegplayer/mpeg_settings.c +++ b/apps/plugins/mpegplayer/mpeg_settings.c | |||
@@ -540,11 +540,11 @@ static void grey_splash(int ticks, const unsigned char *fmt, ...) | |||
540 | 540 | ||
541 | static void show_loading(struct vo_rect *rc) | 541 | static void show_loading(struct vo_rect *rc) |
542 | { | 542 | { |
543 | int oldmode = lcd_(get_drawmode)(); | 543 | int oldmode = mylcd_get_drawmode(); |
544 | lcd_(set_drawmode)(DRMODE_SOLID | DRMODE_INVERSEVID); | 544 | mylcd_set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID); |
545 | lcd_(fillrect)(rc->l-1, rc->t-1, rc->r - rc->l + 2, rc->b - rc->t + 2); | 545 | mylcd_fillrect(rc->l-1, rc->t-1, rc->r - rc->l + 2, rc->b - rc->t + 2); |
546 | lcd_(set_drawmode)(oldmode); | 546 | mylcd_set_drawmode(oldmode); |
547 | lcd_(splash)(0, "Loading..."); | 547 | mylcd_splash(0, "Loading..."); |
548 | } | 548 | } |
549 | 549 | ||
550 | static void draw_slider(uint32_t range, uint32_t pos, struct vo_rect *rc) | 550 | static void draw_slider(uint32_t range, uint32_t pos, struct vo_rect *rc) |
@@ -567,36 +567,36 @@ static void draw_slider(uint32_t range, uint32_t pos, struct vo_rect *rc) | |||
567 | /* Put positition on left */ | 567 | /* Put positition on left */ |
568 | ts_to_hms(pos, &hms); | 568 | ts_to_hms(pos, &hms); |
569 | hms_format(str, sizeof(str), &hms); | 569 | hms_format(str, sizeof(str), &hms); |
570 | lcd_(getstringsize)(str, NULL, &text_h); | 570 | mylcd_getstringsize(str, NULL, &text_h); |
571 | text_y = SLIDER_Y - SLIDER_TEXTMARGIN - text_h; | 571 | text_y = SLIDER_Y - SLIDER_TEXTMARGIN - text_h; |
572 | 572 | ||
573 | if (rc == NULL) | 573 | if (rc == NULL) |
574 | { | 574 | { |
575 | int oldmode = lcd_(get_drawmode)(); | 575 | int oldmode = mylcd_get_drawmode(); |
576 | lcd_(set_drawmode)(DRMODE_BG | DRMODE_INVERSEVID); | 576 | mylcd_set_drawmode(DRMODE_BG | DRMODE_INVERSEVID); |
577 | lcd_(fillrect)(SLIDER_X, text_y, SLIDER_WIDTH, | 577 | mylcd_fillrect(SLIDER_X, text_y, SLIDER_WIDTH, |
578 | LCD_HEIGHT - SLIDER_BMARGIN - text_y | 578 | LCD_HEIGHT - SLIDER_BMARGIN - text_y |
579 | - SLIDER_TMARGIN); | 579 | - SLIDER_TMARGIN); |
580 | lcd_(set_drawmode)(oldmode); | 580 | mylcd_set_drawmode(oldmode); |
581 | 581 | ||
582 | lcd_(putsxy)(SLIDER_X, text_y, str); | 582 | mylcd_putsxy(SLIDER_X, text_y, str); |
583 | 583 | ||
584 | /* Put duration on right */ | 584 | /* Put duration on right */ |
585 | ts_to_hms(range, &hms); | 585 | ts_to_hms(range, &hms); |
586 | hms_format(str, sizeof(str), &hms); | 586 | hms_format(str, sizeof(str), &hms); |
587 | lcd_(getstringsize)(str, &text_w, NULL); | 587 | mylcd_getstringsize(str, &text_w, NULL); |
588 | 588 | ||
589 | lcd_(putsxy)(SLIDER_X + SLIDER_WIDTH - text_w, text_y, str); | 589 | mylcd_putsxy(SLIDER_X + SLIDER_WIDTH - text_w, text_y, str); |
590 | 590 | ||
591 | /* Draw slider */ | 591 | /* Draw slider */ |
592 | lcd_(drawrect)(SLIDER_X, SLIDER_Y, SLIDER_WIDTH, SLIDER_HEIGHT); | 592 | mylcd_drawrect(SLIDER_X, SLIDER_Y, SLIDER_WIDTH, SLIDER_HEIGHT); |
593 | lcd_(fillrect)(SLIDER_X, SLIDER_Y, | 593 | mylcd_fillrect(SLIDER_X, SLIDER_Y, |
594 | muldiv_uint32(pos, SLIDER_WIDTH, range), | 594 | muldiv_uint32(pos, SLIDER_WIDTH, range), |
595 | SLIDER_HEIGHT); | 595 | SLIDER_HEIGHT); |
596 | 596 | ||
597 | /* Update screen */ | 597 | /* Update screen */ |
598 | lcd_(update_rect)(SLIDER_X, text_y - SLIDER_TMARGIN, SLIDER_WIDTH, | 598 | mylcd_update_rect(SLIDER_X, text_y - SLIDER_TMARGIN, SLIDER_WIDTH, |
599 | LCD_HEIGHT - SLIDER_BMARGIN - text_y + SLIDER_TEXTMARGIN); | 599 | LCD_HEIGHT - SLIDER_BMARGIN - text_y + SLIDER_TEXTMARGIN); |
600 | } | 600 | } |
601 | else | 601 | else |
602 | { | 602 | { |
@@ -612,28 +612,28 @@ static bool display_thumb_image(const struct vo_rect *rc) | |||
612 | { | 612 | { |
613 | if (!stream_display_thumb(rc)) | 613 | if (!stream_display_thumb(rc)) |
614 | { | 614 | { |
615 | lcd_(splash)(0, "Frame not available"); | 615 | mylcd_splash(0, "Frame not available"); |
616 | return false; | 616 | return false; |
617 | } | 617 | } |
618 | 618 | ||
619 | /* Draw a raised border around the frame */ | 619 | /* Draw a raised border around the frame */ |
620 | int oldcolor = lcd_(get_foreground)(); | 620 | int oldcolor = mylcd_get_foreground(); |
621 | lcd_(set_foreground)(DRAW_LIGHTGRAY); | 621 | mylcd_set_foreground(MYLCD_LIGHTGRAY); |
622 | 622 | ||
623 | lcd_(hline)(rc->l-1, rc->r-1, rc->t-1); | 623 | mylcd_hline(rc->l-1, rc->r-1, rc->t-1); |
624 | lcd_(vline)(rc->l-1, rc->t, rc->b-1); | 624 | mylcd_vline(rc->l-1, rc->t, rc->b-1); |
625 | 625 | ||
626 | lcd_(set_foreground)(DRAW_DARKGRAY); | 626 | mylcd_set_foreground(MYLCD_DARKGRAY); |
627 | 627 | ||
628 | lcd_(hline)(rc->l-1, rc->r, rc->b); | 628 | mylcd_hline(rc->l-1, rc->r, rc->b); |
629 | lcd_(vline)(rc->r, rc->t-1, rc->b); | 629 | mylcd_vline(rc->r, rc->t-1, rc->b); |
630 | 630 | ||
631 | lcd_(set_foreground)(oldcolor); | 631 | mylcd_set_foreground(oldcolor); |
632 | 632 | ||
633 | lcd_(update_rect)(rc->l-1, rc->t-1, rc->r - rc->l + 2, 1); | 633 | mylcd_update_rect(rc->l-1, rc->t-1, rc->r - rc->l + 2, 1); |
634 | lcd_(update_rect)(rc->l-1, rc->t, 1, rc->b - rc->t); | 634 | mylcd_update_rect(rc->l-1, rc->t, 1, rc->b - rc->t); |
635 | lcd_(update_rect)(rc->l-1, rc->b, rc->r - rc->l + 2, 1); | 635 | mylcd_update_rect(rc->l-1, rc->b, rc->r - rc->l + 2, 1); |
636 | lcd_(update_rect)(rc->r, rc->t, 1, rc->b - rc->t); | 636 | mylcd_update_rect(rc->r, rc->t, 1, rc->b - rc->t); |
637 | 637 | ||
638 | return true; | 638 | return true; |
639 | } | 639 | } |
@@ -679,8 +679,8 @@ static int get_start_time(uint32_t duration) | |||
679 | 679 | ||
680 | enum state_enum slider_state = STATE0; | 680 | enum state_enum slider_state = STATE0; |
681 | 681 | ||
682 | lcd_(clear_display)(); | 682 | mylcd_clear_display(); |
683 | lcd_(update)(); | 683 | mylcd_update(); |
684 | 684 | ||
685 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) | 685 | #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) |
686 | rb->add_event(LCD_EVENT_ACTIVATION, false, get_start_time_lcd_enable_hook); | 686 | rb->add_event(LCD_EVENT_ACTIVATION, false, get_start_time_lcd_enable_hook); |
diff --git a/apps/plugins/mpegplayer/mpegplayer.c b/apps/plugins/mpegplayer/mpegplayer.c index ee38484b19..961214f407 100644 --- a/apps/plugins/mpegplayer/mpegplayer.c +++ b/apps/plugins/mpegplayer/mpegplayer.c | |||
@@ -473,7 +473,7 @@ static unsigned draw_blendcolor(unsigned c1, unsigned c2, unsigned char amount) | |||
473 | * The origin is the upper-left corner of the OSD area */ | 473 | * The origin is the upper-left corner of the OSD area */ |
474 | static void draw_update_rect(int x, int y, int width, int height) | 474 | static void draw_update_rect(int x, int y, int width, int height) |
475 | { | 475 | { |
476 | lcd_(update_rect)(_X, _Y, _W, _H); | 476 | mylcd_update_rect(_X, _Y, _W, _H); |
477 | } | 477 | } |
478 | 478 | ||
479 | static void draw_clear_area(int x, int y, int width, int height) | 479 | static void draw_clear_area(int x, int y, int width, int height) |
@@ -495,34 +495,34 @@ static void draw_clear_area_rect(const struct vo_rect *rc) | |||
495 | 495 | ||
496 | static void draw_fillrect(int x, int y, int width, int height) | 496 | static void draw_fillrect(int x, int y, int width, int height) |
497 | { | 497 | { |
498 | lcd_(fillrect)(_X, _Y, _W, _H); | 498 | mylcd_fillrect(_X, _Y, _W, _H); |
499 | } | 499 | } |
500 | 500 | ||
501 | static void draw_hline(int x1, int x2, int y) | 501 | static void draw_hline(int x1, int x2, int y) |
502 | { | 502 | { |
503 | #ifdef LCD_LANDSCAPE | 503 | #ifdef LCD_LANDSCAPE |
504 | lcd_(hline)(x1 + osd.x, x2 + osd.x, y + osd.y); | 504 | mylcd_hline(x1 + osd.x, x2 + osd.x, y + osd.y); |
505 | #else | 505 | #else |
506 | y = LCD_WIDTH - (y + osd.y) - 1; | 506 | y = LCD_WIDTH - (y + osd.y) - 1; |
507 | lcd_(vline)(y, x1 + osd.x, x2 + osd.x); | 507 | mylcd_vline(y, x1 + osd.x, x2 + osd.x); |
508 | #endif | 508 | #endif |
509 | } | 509 | } |
510 | 510 | ||
511 | static void draw_vline(int x, int y1, int y2) | 511 | static void draw_vline(int x, int y1, int y2) |
512 | { | 512 | { |
513 | #ifdef LCD_LANDSCAPE | 513 | #ifdef LCD_LANDSCAPE |
514 | lcd_(vline)(x + osd.x, y1 + osd.y, y2 + osd.y); | 514 | mylcd_vline(x + osd.x, y1 + osd.y, y2 + osd.y); |
515 | #else | 515 | #else |
516 | y1 = LCD_WIDTH - (y1 + osd.y) - 1; | 516 | y1 = LCD_WIDTH - (y1 + osd.y) - 1; |
517 | y2 = LCD_WIDTH - (y2 + osd.y) - 1; | 517 | y2 = LCD_WIDTH - (y2 + osd.y) - 1; |
518 | lcd_(hline)(y1, y2, x + osd.x); | 518 | mylcd_hline(y1, y2, x + osd.x); |
519 | #endif | 519 | #endif |
520 | } | 520 | } |
521 | 521 | ||
522 | static void draw_scrollbar_draw(int x, int y, int width, int height, | 522 | static void draw_scrollbar_draw(int x, int y, int width, int height, |
523 | uint32_t min, uint32_t max, uint32_t val) | 523 | uint32_t min, uint32_t max, uint32_t val) |
524 | { | 524 | { |
525 | unsigned oldfg = lcd_(get_foreground)(); | 525 | unsigned oldfg = mylcd_get_foreground(); |
526 | 526 | ||
527 | draw_hline(x + 1, x + width - 2, y); | 527 | draw_hline(x + 1, x + width - 2, y); |
528 | draw_hline(x + 1, x + width - 2, y + height - 1); | 528 | draw_hline(x + 1, x + width - 2, y + height - 1); |
@@ -534,11 +534,11 @@ static void draw_scrollbar_draw(int x, int y, int width, int height, | |||
534 | 534 | ||
535 | draw_fillrect(x + 1, y + 1, val, height - 2); | 535 | draw_fillrect(x + 1, y + 1, val, height - 2); |
536 | 536 | ||
537 | lcd_(set_foreground)(osd.prog_fillcolor); | 537 | mylcd_set_foreground(osd.prog_fillcolor); |
538 | 538 | ||
539 | draw_fillrect(x + 1 + val, y + 1, width - 2 - val, height - 2); | 539 | draw_fillrect(x + 1 + val, y + 1, width - 2 - val, height - 2); |
540 | 540 | ||
541 | lcd_(set_foreground)(oldfg); | 541 | mylcd_set_foreground(oldfg); |
542 | } | 542 | } |
543 | 543 | ||
544 | static void draw_scrollbar_draw_rect(const struct vo_rect *rc, int min, | 544 | static void draw_scrollbar_draw_rect(const struct vo_rect *rc, int min, |
@@ -656,18 +656,18 @@ static void draw_oriented_mono_bitmap_part(const unsigned char *src, | |||
656 | int stride, int x, int y, | 656 | int stride, int x, int y, |
657 | int width, int height) | 657 | int width, int height) |
658 | { | 658 | { |
659 | int mode = lcd_(get_drawmode)(); | 659 | int mode = mylcd_get_drawmode(); |
660 | lcd_(set_drawmode)(DRMODE_FG); | 660 | mylcd_set_drawmode(DRMODE_FG); |
661 | lcd_(mono_bitmap_part)(src, src_x, src_y, stride, x, y, width, height); | 661 | mylcd_mono_bitmap_part(src, src_x, src_y, stride, x, y, width, height); |
662 | lcd_(set_drawmode)(mode); | 662 | mylcd_set_drawmode(mode); |
663 | } | 663 | } |
664 | 664 | ||
665 | static void draw_putsxy_oriented(int x, int y, const char *str) | 665 | static void draw_putsxy_oriented(int x, int y, const char *str) |
666 | { | 666 | { |
667 | int mode = lcd_(get_drawmode)(); | 667 | int mode = mylcd_get_drawmode(); |
668 | lcd_(set_drawmode)(DRMODE_FG); | 668 | mylcd_set_drawmode(DRMODE_FG); |
669 | lcd_(putsxy)(x + osd.x, y + osd.y, str); | 669 | mylcd_putsxy(x + osd.x, y + osd.y, str); |
670 | lcd_(set_drawmode)(mode); | 670 | mylcd_set_drawmode(mode); |
671 | } | 671 | } |
672 | #endif /* LCD_PORTRAIT */ | 672 | #endif /* LCD_PORTRAIT */ |
673 | 673 | ||
@@ -718,7 +718,7 @@ static void osd_text_init(void) | |||
718 | int phys; | 718 | int phys; |
719 | int spc_width; | 719 | int spc_width; |
720 | 720 | ||
721 | lcd_(setfont)(FONT_UI); | 721 | mylcd_setfont(FONT_UI); |
722 | 722 | ||
723 | osd.x = 0; | 723 | osd.x = 0; |
724 | osd.width = SCREEN_WIDTH; | 724 | osd.width = SCREEN_WIDTH; |
@@ -730,7 +730,7 @@ static void osd_text_init(void) | |||
730 | 730 | ||
731 | ts_to_hms(stream_get_duration(), &hms); | 731 | ts_to_hms(stream_get_duration(), &hms); |
732 | hms_format(buf, sizeof (buf), &hms); | 732 | hms_format(buf, sizeof (buf), &hms); |
733 | lcd_(getstringsize)(buf, &osd.time_rect.r, &osd.time_rect.b); | 733 | mylcd_getstringsize(buf, &osd.time_rect.r, &osd.time_rect.b); |
734 | 734 | ||
735 | /* Choose well-sized bitmap images relative to font height */ | 735 | /* Choose well-sized bitmap images relative to font height */ |
736 | if (osd.time_rect.b < 12) { | 736 | if (osd.time_rect.b < 12) { |
@@ -760,8 +760,8 @@ static void osd_text_init(void) | |||
760 | rb->snprintf(buf, sizeof(buf), "%d%s", phys, | 760 | rb->snprintf(buf, sizeof(buf), "%d%s", phys, |
761 | rb->sound_unit(SOUND_VOLUME)); | 761 | rb->sound_unit(SOUND_VOLUME)); |
762 | 762 | ||
763 | lcd_(getstringsize)(" ", &spc_width, NULL); | 763 | mylcd_getstringsize(" ", &spc_width, NULL); |
764 | lcd_(getstringsize)(buf, &osd.vol_rect.r, &osd.vol_rect.b); | 764 | mylcd_getstringsize(buf, &osd.vol_rect.r, &osd.vol_rect.b); |
765 | 765 | ||
766 | osd.prog_rect.r = SCREEN_WIDTH - OSD_BDR_L - spc_width - | 766 | osd.prog_rect.r = SCREEN_WIDTH - OSD_BDR_L - spc_width - |
767 | osd.vol_rect.r - OSD_BDR_R; | 767 | osd.vol_rect.r - OSD_BDR_R; |
@@ -787,7 +787,7 @@ static void osd_text_init(void) | |||
787 | #endif | 787 | #endif |
788 | osd.y = SCREEN_HEIGHT - osd.height; | 788 | osd.y = SCREEN_HEIGHT - osd.height; |
789 | 789 | ||
790 | lcd_(setfont)(FONT_SYSFIXED); | 790 | mylcd_setfont(FONT_SYSFIXED); |
791 | } | 791 | } |
792 | 792 | ||
793 | static void osd_init(void) | 793 | static void osd_init(void) |
@@ -836,39 +836,39 @@ static void osd_refresh_background(void) | |||
836 | char buf[32]; | 836 | char buf[32]; |
837 | struct hms hms; | 837 | struct hms hms; |
838 | 838 | ||
839 | unsigned bg = lcd_(get_background)(); | 839 | unsigned bg = mylcd_get_background(); |
840 | lcd_(set_drawmode)(DRMODE_SOLID | DRMODE_INVERSEVID); | 840 | mylcd_set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID); |
841 | 841 | ||
842 | #ifdef HAVE_LCD_COLOR | 842 | #ifdef HAVE_LCD_COLOR |
843 | /* Draw a "raised" area for our graphics */ | 843 | /* Draw a "raised" area for our graphics */ |
844 | lcd_(set_background)(draw_blendcolor(bg, DRAW_WHITE, 192)); | 844 | mylcd_set_background(draw_blendcolor(bg, MYLCD_WHITE, 192)); |
845 | draw_hline(0, osd.width, 0); | 845 | draw_hline(0, osd.width, 0); |
846 | 846 | ||
847 | lcd_(set_background)(draw_blendcolor(bg, DRAW_WHITE, 80)); | 847 | mylcd_set_background(draw_blendcolor(bg, MYLCD_WHITE, 80)); |
848 | draw_hline(0, osd.width, 1); | 848 | draw_hline(0, osd.width, 1); |
849 | 849 | ||
850 | lcd_(set_background)(draw_blendcolor(bg, DRAW_BLACK, 48)); | 850 | mylcd_set_background(draw_blendcolor(bg, MYLCD_BLACK, 48)); |
851 | draw_hline(0, osd.width, osd.height-2); | 851 | draw_hline(0, osd.width, osd.height-2); |
852 | 852 | ||
853 | lcd_(set_background)(draw_blendcolor(bg, DRAW_BLACK, 128)); | 853 | mylcd_set_background(draw_blendcolor(bg, MYLCD_BLACK, 128)); |
854 | draw_hline(0, osd.width, osd.height-1); | 854 | draw_hline(0, osd.width, osd.height-1); |
855 | 855 | ||
856 | lcd_(set_background)(bg); | 856 | mylcd_set_background(bg); |
857 | draw_clear_area(0, 2, osd.width, osd.height - 4); | 857 | draw_clear_area(0, 2, osd.width, osd.height - 4); |
858 | #else | 858 | #else |
859 | /* Give contrast with the main background */ | 859 | /* Give contrast with the main background */ |
860 | lcd_(set_background)(GREY_WHITE); | 860 | mylcd_set_background(MYLCD_WHITE); |
861 | draw_hline(0, osd.width, 0); | 861 | draw_hline(0, osd.width, 0); |
862 | 862 | ||
863 | lcd_(set_background)(GREY_DARKGRAY); | 863 | mylcd_set_background(MYLCD_DARKGRAY); |
864 | draw_hline(0, osd.width, osd.height-1); | 864 | draw_hline(0, osd.width, osd.height-1); |
865 | 865 | ||
866 | lcd_(set_background)(bg); | 866 | mylcd_set_background(bg); |
867 | draw_clear_area(0, 1, osd.width, osd.height - 2); | 867 | draw_clear_area(0, 1, osd.width, osd.height - 2); |
868 | #endif | 868 | #endif |
869 | 869 | ||
870 | vo_rect_set_ext(&osd.update_rect, 0, 0, osd.width, osd.height); | 870 | vo_rect_set_ext(&osd.update_rect, 0, 0, osd.width, osd.height); |
871 | lcd_(set_drawmode)(DRMODE_SOLID); | 871 | mylcd_set_drawmode(DRMODE_SOLID); |
872 | 872 | ||
873 | if (stream_get_duration() != INVALID_TIMESTAMP) { | 873 | if (stream_get_duration() != INVALID_TIMESTAMP) { |
874 | /* Draw the movie duration */ | 874 | /* Draw the movie duration */ |
@@ -912,7 +912,7 @@ static void osd_refresh_volume(void) | |||
912 | rb->snprintf(buf, sizeof (buf), "%d%s", | 912 | rb->snprintf(buf, sizeof (buf), "%d%s", |
913 | rb->sound_val2phys(SOUND_VOLUME, volume), | 913 | rb->sound_val2phys(SOUND_VOLUME, volume), |
914 | rb->sound_unit(SOUND_VOLUME)); | 914 | rb->sound_unit(SOUND_VOLUME)); |
915 | lcd_(getstringsize)(buf, &width, NULL); | 915 | mylcd_getstringsize(buf, &width, NULL); |
916 | 916 | ||
917 | /* Right-justified */ | 917 | /* Right-justified */ |
918 | draw_clear_area_rect(&osd.vol_rect); | 918 | draw_clear_area_rect(&osd.vol_rect); |
@@ -930,11 +930,11 @@ static void osd_refresh_status(void) | |||
930 | 930 | ||
931 | #ifdef HAVE_LCD_COLOR | 931 | #ifdef HAVE_LCD_COLOR |
932 | /* Draw status icon with a drop shadow */ | 932 | /* Draw status icon with a drop shadow */ |
933 | unsigned oldfg = lcd_(get_foreground)(); | 933 | unsigned oldfg = mylcd_get_foreground(); |
934 | int i = 1; | 934 | int i = 1; |
935 | 935 | ||
936 | lcd_(set_foreground)(draw_blendcolor(lcd_(get_background)(), | 936 | mylcd_set_foreground(draw_blendcolor(mylcd_get_background(), |
937 | DRAW_BLACK, 96)); | 937 | MYLCD_BLACK, 96)); |
938 | 938 | ||
939 | while (1) | 939 | while (1) |
940 | { | 940 | { |
@@ -949,7 +949,7 @@ static void osd_refresh_status(void) | |||
949 | if (--i < 0) | 949 | if (--i < 0) |
950 | break; | 950 | break; |
951 | 951 | ||
952 | lcd_(set_foreground)(oldfg); | 952 | mylcd_set_foreground(oldfg); |
953 | } | 953 | } |
954 | 954 | ||
955 | vo_rect_union(&osd.update_rect, &osd.update_rect, &osd.stat_rect); | 955 | vo_rect_union(&osd.update_rect, &osd.update_rect, &osd.stat_rect); |
@@ -1076,12 +1076,12 @@ static void osd_refresh(int hint) | |||
1076 | 1076 | ||
1077 | /* Set basic drawing params that are used. Elements that perform variations | 1077 | /* Set basic drawing params that are used. Elements that perform variations |
1078 | * will restore them. */ | 1078 | * will restore them. */ |
1079 | oldfg = lcd_(get_foreground)(); | 1079 | oldfg = mylcd_get_foreground(); |
1080 | oldbg = lcd_(get_background)(); | 1080 | oldbg = mylcd_get_background(); |
1081 | 1081 | ||
1082 | lcd_(setfont)(FONT_UI); | 1082 | mylcd_setfont(FONT_UI); |
1083 | lcd_(set_foreground)(osd.fgcolor); | 1083 | mylcd_set_foreground(osd.fgcolor); |
1084 | lcd_(set_background)(osd.bgcolor); | 1084 | mylcd_set_background(osd.bgcolor); |
1085 | 1085 | ||
1086 | vo_rect_clear(&osd.update_rect); | 1086 | vo_rect_clear(&osd.update_rect); |
1087 | 1087 | ||
@@ -1103,9 +1103,9 @@ static void osd_refresh(int hint) | |||
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | /* Go back to defaults */ | 1105 | /* Go back to defaults */ |
1106 | lcd_(setfont)(FONT_SYSFIXED); | 1106 | mylcd_setfont(FONT_SYSFIXED); |
1107 | lcd_(set_foreground)(oldfg); | 1107 | mylcd_set_foreground(oldfg); |
1108 | lcd_(set_background)(oldbg); | 1108 | mylcd_set_background(oldbg); |
1109 | 1109 | ||
1110 | /* Update the dirty rectangle */ | 1110 | /* Update the dirty rectangle */ |
1111 | vo_lock(); | 1111 | vo_lock(); |
diff --git a/apps/plugins/mpegplayer/mpegplayer.h b/apps/plugins/mpegplayer/mpegplayer.h index f6617cedff..79c25f6109 100644 --- a/apps/plugins/mpegplayer/mpegplayer.h +++ b/apps/plugins/mpegplayer/mpegplayer.h | |||
@@ -67,24 +67,14 @@ | |||
67 | #define DISK_GUARDBUF_SIZE ALIGN_UP(65535+6, 4) | 67 | #define DISK_GUARDBUF_SIZE ALIGN_UP(65535+6, 4) |
68 | 68 | ||
69 | #ifdef HAVE_LCD_COLOR | 69 | #ifdef HAVE_LCD_COLOR |
70 | #define DRAW_BLACK LCD_BLACK | 70 | #define mylcd_splash rb->splash |
71 | #define DRAW_DARKGRAY LCD_DARKGRAY | ||
72 | #define DRAW_LIGHTGRAY LCD_LIGHTGRAY | ||
73 | #define DRAW_WHITE LCD_WHITE | ||
74 | #define lcd_(fn) rb->lcd_##fn | ||
75 | #define lcd_splash splash | ||
76 | |||
77 | #else | 71 | #else |
78 | |||
79 | #include "lib/grey.h" | 72 | #include "lib/grey.h" |
80 | #define DRAW_BLACK GREY_BLACK | 73 | #define mylcd_splash grey_splash |
81 | #define DRAW_DARKGRAY GREY_DARKGRAY | ||
82 | #define DRAW_LIGHTGRAY GREY_LIGHTGRAY | ||
83 | #define DRAW_WHITE GREY_WHITE | ||
84 | #define lcd_(fn) grey_##fn | ||
85 | |||
86 | #endif | 74 | #endif |
87 | 75 | ||
76 | #include "lib/mylcd.h" | ||
77 | |||
88 | #include "mpeg2.h" | 78 | #include "mpeg2.h" |
89 | #include "video_out.h" | 79 | #include "video_out.h" |
90 | #include "mpeg_stream.h" | 80 | #include "mpeg_stream.h" |
diff --git a/apps/plugins/mpegplayer/video_out_rockbox.c b/apps/plugins/mpegplayer/video_out_rockbox.c index ee0efb8824..cf47982ab7 100644 --- a/apps/plugins/mpegplayer/video_out_rockbox.c +++ b/apps/plugins/mpegplayer/video_out_rockbox.c | |||
@@ -86,16 +86,16 @@ static void vo_draw_black(void) | |||
86 | 86 | ||
87 | video_lock(); | 87 | video_lock(); |
88 | 88 | ||
89 | foreground = lcd_(get_foreground)(); | 89 | foreground = mylcd_get_foreground(); |
90 | 90 | ||
91 | lcd_(set_foreground)(DRAW_BLACK); | 91 | mylcd_set_foreground(MYLCD_BLACK); |
92 | 92 | ||
93 | lcd_(fillrect)(vo.output_x, vo.output_y, vo.output_width, | 93 | mylcd_fillrect(vo.output_x, vo.output_y, vo.output_width, |
94 | vo.output_height); | 94 | vo.output_height); |
95 | lcd_(update_rect)(vo.output_x, vo.output_y, vo.output_width, | 95 | mylcd_update_rect(vo.output_x, vo.output_y, vo.output_width, |
96 | vo.output_height); | 96 | vo.output_height); |
97 | 97 | ||
98 | lcd_(set_foreground)(foreground); | 98 | mylcd_set_foreground(foreground); |
99 | 99 | ||
100 | video_unlock(); | 100 | video_unlock(); |
101 | } | 101 | } |
diff --git a/apps/plugins/mpegplayer/video_thread.c b/apps/plugins/mpegplayer/video_thread.c index 6d60e64131..8feacbdef2 100644 --- a/apps/plugins/mpegplayer/video_thread.c +++ b/apps/plugins/mpegplayer/video_thread.c | |||
@@ -80,10 +80,10 @@ static void draw_fps(struct video_thread_data *td) | |||
80 | td->info->display_picture->temporal_reference, | 80 | td->info->display_picture->temporal_reference, |
81 | /* Audio information */ | 81 | /* Audio information */ |
82 | buf_pct, pcm_underruns, pcm_skipped); | 82 | buf_pct, pcm_underruns, pcm_skipped); |
83 | lcd_(putsxy)(0, 0, str); | 83 | mylcd_putsxy(0, 0, str); |
84 | 84 | ||
85 | vo_lock(); | 85 | vo_lock(); |
86 | lcd_(update_rect)(0, 0, LCD_WIDTH, 8); | 86 | mylcd_update_rect(0, 0, LCD_WIDTH, 8); |
87 | vo_unlock(); | 87 | vo_unlock(); |
88 | 88 | ||
89 | td->last_showfps = *rb->current_tick; | 89 | td->last_showfps = *rb->current_tick; |