A modern Music Player Daemon based on Rockbox open source high quality audio player
libadwaita audio rust zig deno mpris rockbox mpd

Add a wrapper header, mylcd.h, in the lib subdirectory, which lets plugins' code automatically call the proper functions depending if compilation is for greylib or color display, also forms proper call to grey_ and xlcd_. mylcd_ub_ call greylib unbuffered routines, regular lcd routines otherwise. Form is mylcd_<fnname>, <fnname> is the symbol name stripped of prefixes lcd_, grey_, or xlcd_. Convert a couple plugins I know well (easy job).

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26542 a1c6a512-1295-4272-9138-f99709370657

+278 -156
+45 -55
apps/plugins/fft/fft.c
··· 22 22 23 23 #include "lib/helper.h" 24 24 #include "lib/xlcd.h" 25 + #include "lib/mylcd.h" 25 26 #include "math.h" 26 27 #include "fracmul.h" 27 28 ··· 255 256 #define FFT_SIZE 2048 /* 1024*2 */ 256 257 #else 257 258 #define FFT_SIZE 4096 /* 2048*2 */ 258 - #endif 259 - 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 259 #endif 269 260 270 261 #define ARRAYLEN_IN (FFT_SIZE) ··· 568 559 static void draw_spectrogram_vertical(void); 569 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 565 #ifdef HAVE_LCD_COLOR 572 - #define COLOR_DEFAULT_FG LCD_DEFAULT_FG 573 - #define COLOR_DEFAULT_BG LCD_DEFAULT_BG 574 566 #define COLOR_MESSAGE_FRAME LCD_RGBPACK(0xc6, 0x00, 0x00) 575 567 #define COLOR_MESSAGE_BG LCD_BLACK 576 568 #define COLOR_MESSAGE_FG LCD_WHITE 577 569 #else 578 - #define COLOR_DEFAULT_FG GREY_BLACK 579 - #define COLOR_DEFAULT_BG GREY_WHITE 580 570 #define COLOR_MESSAGE_FRAME GREY_DARKGRAY 581 571 #define COLOR_MESSAGE_BG GREY_WHITE 582 572 #define COLOR_MESSAGE_FG GREY_BLACK ··· 588 578 static void draw_message_string(const unsigned char *message, bool active) 589 579 { 590 580 int x, y; 591 - lcd_(getstringsize)(message, &x, &y); 581 + mylcd_getstringsize(message, &x, &y); 592 582 593 583 /* x and y give the size of the box for the popup */ 594 584 x += POPUP_HPADDING*2; ··· 601 591 graph_settings.orientation_vertical && 602 592 graph_settings.spectrogram_pos >= LCD_WIDTH - x) 603 593 { 604 - lcd_scroll_left(graph_settings.spectrogram_pos - 605 - LCD_WIDTH + x); 594 + mylcd_scroll_left(graph_settings.spectrogram_pos - 595 + LCD_WIDTH + x); 606 596 graph_settings.spectrogram_pos = LCD_WIDTH - x - 1; 607 597 } 608 598 609 - lcd_(set_foreground)(COLOR_MESSAGE_FRAME); 610 - lcd_(fillrect)(LCD_WIDTH - x, 0, LCD_WIDTH - 1, y); 599 + mylcd_set_foreground(COLOR_MESSAGE_FRAME); 600 + mylcd_fillrect(LCD_WIDTH - x, 0, LCD_WIDTH - 1, y); 611 601 612 - lcd_(set_foreground)(COLOR_MESSAGE_FG); 613 - lcd_(set_background)(COLOR_MESSAGE_BG); 614 - lcd_(putsxy)(LCD_WIDTH - x + POPUP_HPADDING, 602 + mylcd_set_foreground(COLOR_MESSAGE_FG); 603 + mylcd_set_background(COLOR_MESSAGE_BG); 604 + mylcd_putsxy(LCD_WIDTH - x + POPUP_HPADDING, 615 605 POPUP_VPADDING, message); 616 - lcd_(set_foreground)(COLOR_DEFAULT_FG); 617 - lcd_(set_background)(COLOR_DEFAULT_BG); 606 + mylcd_set_foreground(COLOR_DEFAULT_FG); 607 + mylcd_set_background(COLOR_DEFAULT_BG); 618 608 } 619 609 620 610 static void draw(const unsigned char* message) ··· 647 637 if(graph_settings.changed.freq_scale) 648 638 graph_settings.changed.freq_scale = true; 649 639 650 - lcd_(set_foreground)(COLOR_DEFAULT_FG); 651 - lcd_(set_background)(COLOR_DEFAULT_BG); 640 + mylcd_set_foreground(COLOR_DEFAULT_FG); 641 + mylcd_set_background(COLOR_DEFAULT_BG); 652 642 653 643 switch (graph_settings.mode) 654 644 { 655 645 default: 656 646 case FFT_DM_LINES: { 657 647 658 - lcd_(clear_display)(); 648 + mylcd_clear_display(); 659 649 660 650 if (graph_settings.orientation_vertical) 661 651 draw_lines_vertical(); ··· 665 655 } 666 656 case FFT_DM_BARS: { 667 657 668 - lcd_(clear_display()); 658 + mylcd_clear_display(); 669 659 670 660 if(graph_settings.orientation_vertical) 671 661 draw_bars_vertical(); ··· 679 669 if(graph_settings.changed.do_clear) 680 670 { 681 671 graph_settings.spectrogram_pos = 0; 682 - lcd_(clear_display)(); 672 + mylcd_clear_display(); 683 673 } 684 674 685 675 if(graph_settings.orientation_vertical) ··· 709 699 { 710 700 /* Spectrogram mode - need to erase the popup */ 711 701 int x, y; 712 - lcd_(getstringsize)(last_message, &x, &y); 702 + mylcd_getstringsize(last_message, &x, &y); 713 703 /* Recalculate the size */ 714 704 x += POPUP_HPADDING*2; 715 705 y += POPUP_VPADDING*2; ··· 717 707 if(!graph_settings.orientation_vertical) 718 708 { 719 709 /* In horizontal spectrogram mode, just scroll up by Y lines */ 720 - lcd_scroll_up(y); 710 + mylcd_scroll_up(y); 721 711 graph_settings.spectrogram_pos -= y; 722 712 if(graph_settings.spectrogram_pos < 0) 723 713 graph_settings.spectrogram_pos = 0; ··· 725 715 else 726 716 { 727 717 /* In vertical spectrogram mode, erase the popup */ 728 - lcd_(set_foreground)(COLOR_DEFAULT_BG); 729 - lcd_(fillrect)(graph_settings.spectrogram_pos + 1, 0, 718 + mylcd_set_foreground(COLOR_DEFAULT_BG); 719 + mylcd_fillrect(graph_settings.spectrogram_pos + 1, 0, 730 720 LCD_WIDTH, y); 731 - lcd_(set_foreground)(COLOR_DEFAULT_FG); 721 + mylcd_set_foreground(COLOR_DEFAULT_FG); 732 722 } 733 723 } 734 724 /* else These modes clear the screen themselves */ ··· 736 726 last_message = NULL; 737 727 } 738 728 739 - lcd_(update)(); 729 + mylcd_update(); 740 730 741 731 graph_settings.changed.clear_all = false; 742 732 } ··· 763 753 764 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 757 return; 768 758 } 769 759 ··· 812 802 for(x = 0; x < plotwidth; ++x) 813 803 { 814 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 828 839 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 832 return; 843 833 } 844 834 ··· 888 878 for(y = 0; y < plotwidth; ++y) 889 879 { 890 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 899 if(graph_settings.changed.amp_scale) 910 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 904 if(calc_magnitudes(graph_settings.logarithmic_amp) == 0) 915 905 return; /* nothing more to draw */ ··· 948 938 for(i = 0, x = offset; i < bars; ++i, x += barwidth) 949 939 { 950 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 959 if(graph_settings.changed.amp_scale) 970 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 964 if(calc_magnitudes(graph_settings.logarithmic_amp) == 0) 975 965 return; /* nothing more to draw */ ··· 1008 998 for(i = 0, y = offset; i < bars; ++i, y += barwidth) 1009 999 { 1010 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 1038 if(index >= SHADES) 1049 1039 index = SHADES-1; 1050 1040 1051 - lcd_(set_foreground)(SPECTROGRAPH_PALETTE(index)); 1052 - lcd_(drawpixel)(graph_settings.spectrogram_pos, 1041 + mylcd_set_foreground(SPECTROGRAPH_PALETTE(index)); 1042 + mylcd_drawpixel(graph_settings.spectrogram_pos, 1053 1043 scale_factor-1 - y); 1054 1044 1055 1045 if(++y >= scale_factor) ··· 1063 1053 if(graph_settings.spectrogram_pos < LCD_WIDTH-1) 1064 1054 graph_settings.spectrogram_pos++; 1065 1055 else 1066 - lcd_scroll_left(1); 1056 + mylcd_scroll_left(1); 1067 1057 } 1068 1058 1069 1059 static void draw_spectrogram_horizontal(void) ··· 1102 1092 if(index >= SHADES) 1103 1093 index = SHADES-1; 1104 1094 1105 - lcd_(set_foreground)(SPECTROGRAPH_PALETTE(index)); 1106 - lcd_(drawpixel)(x, graph_settings.spectrogram_pos); 1095 + mylcd_set_foreground(SPECTROGRAPH_PALETTE(index)); 1096 + mylcd_drawpixel(x, graph_settings.spectrogram_pos); 1107 1097 1108 1098 if(++x >= scale_factor) 1109 1099 break; ··· 1116 1106 if(graph_settings.spectrogram_pos < LCD_HEIGHT-1) 1117 1107 graph_settings.spectrogram_pos++; 1118 1108 else 1119 - lcd_scroll_up(1); 1109 + mylcd_scroll_up(1); 1120 1110 } 1121 1111 1122 1112 /********************* End of plotting functions (modes) *********************/ ··· 1334 1324 1335 1325 #if LCD_DEPTH > 1 1336 1326 rb->lcd_set_backdrop(NULL); 1337 - lcd_(clear_display)(); 1338 - lcd_(update)(); 1327 + mylcd_clear_display(); 1328 + mylcd_update(); 1339 1329 #endif 1340 1330 backlight_force_on(); 1341 1331 ··· 1357 1347 if(!rb->pcm_is_playing()) 1358 1348 { 1359 1349 showing_warning = true; 1360 - lcd_(clear_display)(); 1350 + mylcd_clear_display(); 1361 1351 draw_message_string("No audio playing", false); 1362 - lcd_(update)(); 1352 + mylcd_update(); 1363 1353 timeout = HZ/5; 1364 1354 } 1365 1355 else ··· 1367 1357 if(showing_warning) 1368 1358 { 1369 1359 showing_warning = false; 1370 - lcd_(clear_display)(); 1371 - lcd_(update)(); 1360 + mylcd_clear_display(); 1361 + mylcd_update(); 1372 1362 } 1373 1363 1374 1364 timeout = HZ/100; /* 'till end of curent tick, don't use 100% CPU */
+142
apps/plugins/lib/mylcd.h
··· 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 */
+34 -34
apps/plugins/mpegplayer/mpeg_settings.c
··· 540 540 541 541 static void show_loading(struct vo_rect *rc) 542 542 { 543 - int oldmode = lcd_(get_drawmode)(); 544 - lcd_(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); 546 - lcd_(set_drawmode)(oldmode); 547 - lcd_(splash)(0, "Loading..."); 543 + int oldmode = mylcd_get_drawmode(); 544 + mylcd_set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID); 545 + mylcd_fillrect(rc->l-1, rc->t-1, rc->r - rc->l + 2, rc->b - rc->t + 2); 546 + mylcd_set_drawmode(oldmode); 547 + mylcd_splash(0, "Loading..."); 548 548 } 549 549 550 550 static void draw_slider(uint32_t range, uint32_t pos, struct vo_rect *rc) ··· 567 567 /* Put positition on left */ 568 568 ts_to_hms(pos, &hms); 569 569 hms_format(str, sizeof(str), &hms); 570 - lcd_(getstringsize)(str, NULL, &text_h); 570 + mylcd_getstringsize(str, NULL, &text_h); 571 571 text_y = SLIDER_Y - SLIDER_TEXTMARGIN - text_h; 572 572 573 573 if (rc == NULL) 574 574 { 575 - int oldmode = lcd_(get_drawmode)(); 576 - lcd_(set_drawmode)(DRMODE_BG | DRMODE_INVERSEVID); 577 - lcd_(fillrect)(SLIDER_X, text_y, SLIDER_WIDTH, 575 + int oldmode = mylcd_get_drawmode(); 576 + mylcd_set_drawmode(DRMODE_BG | DRMODE_INVERSEVID); 577 + mylcd_fillrect(SLIDER_X, text_y, SLIDER_WIDTH, 578 578 LCD_HEIGHT - SLIDER_BMARGIN - text_y 579 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 584 /* Put duration on right */ 585 585 ts_to_hms(range, &hms); 586 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 591 /* Draw slider */ 592 - lcd_(drawrect)(SLIDER_X, SLIDER_Y, SLIDER_WIDTH, SLIDER_HEIGHT); 593 - lcd_(fillrect)(SLIDER_X, SLIDER_Y, 594 - muldiv_uint32(pos, SLIDER_WIDTH, range), 595 - SLIDER_HEIGHT); 592 + mylcd_drawrect(SLIDER_X, SLIDER_Y, SLIDER_WIDTH, SLIDER_HEIGHT); 593 + mylcd_fillrect(SLIDER_X, SLIDER_Y, 594 + muldiv_uint32(pos, SLIDER_WIDTH, range), 595 + SLIDER_HEIGHT); 596 596 597 597 /* Update screen */ 598 - lcd_(update_rect)(SLIDER_X, text_y - SLIDER_TMARGIN, SLIDER_WIDTH, 599 - LCD_HEIGHT - SLIDER_BMARGIN - text_y + SLIDER_TEXTMARGIN); 598 + mylcd_update_rect(SLIDER_X, text_y - SLIDER_TMARGIN, SLIDER_WIDTH, 599 + LCD_HEIGHT - SLIDER_BMARGIN - text_y + SLIDER_TEXTMARGIN); 600 600 } 601 601 else 602 602 { ··· 612 612 { 613 613 if (!stream_display_thumb(rc)) 614 614 { 615 - lcd_(splash)(0, "Frame not available"); 615 + mylcd_splash(0, "Frame not available"); 616 616 return false; 617 617 } 618 618 619 619 /* Draw a raised border around the frame */ 620 - int oldcolor = lcd_(get_foreground)(); 621 - lcd_(set_foreground)(DRAW_LIGHTGRAY); 620 + int oldcolor = mylcd_get_foreground(); 621 + mylcd_set_foreground(MYLCD_LIGHTGRAY); 622 622 623 - lcd_(hline)(rc->l-1, rc->r-1, rc->t-1); 624 - lcd_(vline)(rc->l-1, rc->t, rc->b-1); 623 + mylcd_hline(rc->l-1, rc->r-1, rc->t-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); 629 - lcd_(vline)(rc->r, rc->t-1, rc->b); 628 + mylcd_hline(rc->l-1, rc->r, 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); 634 - lcd_(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); 636 - lcd_(update_rect)(rc->r, rc->t, 1, rc->b - rc->t); 633 + mylcd_update_rect(rc->l-1, rc->t-1, rc->r - rc->l + 2, 1); 634 + mylcd_update_rect(rc->l-1, rc->t, 1, rc->b - rc->t); 635 + mylcd_update_rect(rc->l-1, rc->b, rc->r - rc->l + 2, 1); 636 + mylcd_update_rect(rc->r, rc->t, 1, rc->b - rc->t); 637 637 638 638 return true; 639 639 } ··· 679 679 680 680 enum state_enum slider_state = STATE0; 681 681 682 - lcd_(clear_display)(); 683 - lcd_(update)(); 682 + mylcd_clear_display(); 683 + mylcd_update(); 684 684 685 685 #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) 686 686 rb->add_event(LCD_EVENT_ACTIVATION, false, get_start_time_lcd_enable_hook);
+46 -46
apps/plugins/mpegplayer/mpegplayer.c
··· 473 473 * The origin is the upper-left corner of the OSD area */ 474 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 479 static void draw_clear_area(int x, int y, int width, int height) ··· 495 495 496 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 501 static void draw_hline(int x1, int x2, int y) 502 502 { 503 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 505 #else 506 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 508 #endif 509 509 } 510 510 511 511 static void draw_vline(int x, int y1, int y2) 512 512 { 513 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 515 #else 516 516 y1 = LCD_WIDTH - (y1 + osd.y) - 1; 517 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 519 #endif 520 520 } 521 521 522 522 static void draw_scrollbar_draw(int x, int y, int width, int height, 523 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 527 draw_hline(x + 1, x + width - 2, y); 528 528 draw_hline(x + 1, x + width - 2, y + height - 1); ··· 534 534 535 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 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 544 static void draw_scrollbar_draw_rect(const struct vo_rect *rc, int min, ··· 656 656 int stride, int x, int y, 657 657 int width, int height) 658 658 { 659 - int mode = lcd_(get_drawmode)(); 660 - lcd_(set_drawmode)(DRMODE_FG); 661 - lcd_(mono_bitmap_part)(src, src_x, src_y, stride, x, y, width, height); 662 - lcd_(set_drawmode)(mode); 659 + int mode = mylcd_get_drawmode(); 660 + mylcd_set_drawmode(DRMODE_FG); 661 + mylcd_mono_bitmap_part(src, src_x, src_y, stride, x, y, width, height); 662 + mylcd_set_drawmode(mode); 663 663 } 664 664 665 665 static void draw_putsxy_oriented(int x, int y, const char *str) 666 666 { 667 - int mode = lcd_(get_drawmode)(); 668 - lcd_(set_drawmode)(DRMODE_FG); 669 - lcd_(putsxy)(x + osd.x, y + osd.y, str); 670 - lcd_(set_drawmode)(mode); 667 + int mode = mylcd_get_drawmode(); 668 + mylcd_set_drawmode(DRMODE_FG); 669 + mylcd_putsxy(x + osd.x, y + osd.y, str); 670 + mylcd_set_drawmode(mode); 671 671 } 672 672 #endif /* LCD_PORTRAIT */ 673 673 ··· 718 718 int phys; 719 719 int spc_width; 720 720 721 - lcd_(setfont)(FONT_UI); 721 + mylcd_setfont(FONT_UI); 722 722 723 723 osd.x = 0; 724 724 osd.width = SCREEN_WIDTH; ··· 730 730 731 731 ts_to_hms(stream_get_duration(), &hms); 732 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 735 /* Choose well-sized bitmap images relative to font height */ 736 736 if (osd.time_rect.b < 12) { ··· 760 760 rb->snprintf(buf, sizeof(buf), "%d%s", phys, 761 761 rb->sound_unit(SOUND_VOLUME)); 762 762 763 - lcd_(getstringsize)(" ", &spc_width, NULL); 764 - lcd_(getstringsize)(buf, &osd.vol_rect.r, &osd.vol_rect.b); 763 + mylcd_getstringsize(" ", &spc_width, NULL); 764 + mylcd_getstringsize(buf, &osd.vol_rect.r, &osd.vol_rect.b); 765 765 766 766 osd.prog_rect.r = SCREEN_WIDTH - OSD_BDR_L - spc_width - 767 767 osd.vol_rect.r - OSD_BDR_R; ··· 787 787 #endif 788 788 osd.y = SCREEN_HEIGHT - osd.height; 789 789 790 - lcd_(setfont)(FONT_SYSFIXED); 790 + mylcd_setfont(FONT_SYSFIXED); 791 791 } 792 792 793 793 static void osd_init(void) ··· 836 836 char buf[32]; 837 837 struct hms hms; 838 838 839 - unsigned bg = lcd_(get_background)(); 840 - lcd_(set_drawmode)(DRMODE_SOLID | DRMODE_INVERSEVID); 839 + unsigned bg = mylcd_get_background(); 840 + mylcd_set_drawmode(DRMODE_SOLID | DRMODE_INVERSEVID); 841 841 842 842 #ifdef HAVE_LCD_COLOR 843 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 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 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 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 854 draw_hline(0, osd.width, osd.height-1); 855 855 856 - lcd_(set_background)(bg); 856 + mylcd_set_background(bg); 857 857 draw_clear_area(0, 2, osd.width, osd.height - 4); 858 858 #else 859 859 /* Give contrast with the main background */ 860 - lcd_(set_background)(GREY_WHITE); 860 + mylcd_set_background(MYLCD_WHITE); 861 861 draw_hline(0, osd.width, 0); 862 862 863 - lcd_(set_background)(GREY_DARKGRAY); 863 + mylcd_set_background(MYLCD_DARKGRAY); 864 864 draw_hline(0, osd.width, osd.height-1); 865 865 866 - lcd_(set_background)(bg); 866 + mylcd_set_background(bg); 867 867 draw_clear_area(0, 1, osd.width, osd.height - 2); 868 868 #endif 869 869 870 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 873 if (stream_get_duration() != INVALID_TIMESTAMP) { 874 874 /* Draw the movie duration */ ··· 912 912 rb->snprintf(buf, sizeof (buf), "%d%s", 913 913 rb->sound_val2phys(SOUND_VOLUME, volume), 914 914 rb->sound_unit(SOUND_VOLUME)); 915 - lcd_(getstringsize)(buf, &width, NULL); 915 + mylcd_getstringsize(buf, &width, NULL); 916 916 917 917 /* Right-justified */ 918 918 draw_clear_area_rect(&osd.vol_rect); ··· 930 930 931 931 #ifdef HAVE_LCD_COLOR 932 932 /* Draw status icon with a drop shadow */ 933 - unsigned oldfg = lcd_(get_foreground)(); 933 + unsigned oldfg = mylcd_get_foreground(); 934 934 int i = 1; 935 935 936 - lcd_(set_foreground)(draw_blendcolor(lcd_(get_background)(), 937 - DRAW_BLACK, 96)); 936 + mylcd_set_foreground(draw_blendcolor(mylcd_get_background(), 937 + MYLCD_BLACK, 96)); 938 938 939 939 while (1) 940 940 { ··· 949 949 if (--i < 0) 950 950 break; 951 951 952 - lcd_(set_foreground)(oldfg); 952 + mylcd_set_foreground(oldfg); 953 953 } 954 954 955 955 vo_rect_union(&osd.update_rect, &osd.update_rect, &osd.stat_rect); ··· 1076 1076 1077 1077 /* Set basic drawing params that are used. Elements that perform variations 1078 1078 * will restore them. */ 1079 - oldfg = lcd_(get_foreground)(); 1080 - oldbg = lcd_(get_background)(); 1079 + oldfg = mylcd_get_foreground(); 1080 + oldbg = mylcd_get_background(); 1081 1081 1082 - lcd_(setfont)(FONT_UI); 1083 - lcd_(set_foreground)(osd.fgcolor); 1084 - lcd_(set_background)(osd.bgcolor); 1082 + mylcd_setfont(FONT_UI); 1083 + mylcd_set_foreground(osd.fgcolor); 1084 + mylcd_set_background(osd.bgcolor); 1085 1085 1086 1086 vo_rect_clear(&osd.update_rect); 1087 1087 ··· 1103 1103 } 1104 1104 1105 1105 /* Go back to defaults */ 1106 - lcd_(setfont)(FONT_SYSFIXED); 1107 - lcd_(set_foreground)(oldfg); 1108 - lcd_(set_background)(oldbg); 1106 + mylcd_setfont(FONT_SYSFIXED); 1107 + mylcd_set_foreground(oldfg); 1108 + mylcd_set_background(oldbg); 1109 1109 1110 1110 /* Update the dirty rectangle */ 1111 1111 vo_lock();
+4 -14
apps/plugins/mpegplayer/mpegplayer.h
··· 67 67 #define DISK_GUARDBUF_SIZE ALIGN_UP(65535+6, 4) 68 68 69 69 #ifdef HAVE_LCD_COLOR 70 - #define DRAW_BLACK LCD_BLACK 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 - 70 + #define mylcd_splash rb->splash 77 71 #else 78 - 79 72 #include "lib/grey.h" 80 - #define DRAW_BLACK GREY_BLACK 81 - #define DRAW_DARKGRAY GREY_DARKGRAY 82 - #define DRAW_LIGHTGRAY GREY_LIGHTGRAY 83 - #define DRAW_WHITE GREY_WHITE 84 - #define lcd_(fn) grey_##fn 73 + #define mylcd_splash grey_splash 74 + #endif 85 75 86 - #endif 76 + #include "lib/mylcd.h" 87 77 88 78 #include "mpeg2.h" 89 79 #include "video_out.h"
+5 -5
apps/plugins/mpegplayer/video_out_rockbox.c
··· 86 86 87 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 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 96 vo.output_height); 97 97 98 - lcd_(set_foreground)(foreground); 98 + mylcd_set_foreground(foreground); 99 99 100 100 video_unlock(); 101 101 }
+2 -2
apps/plugins/mpegplayer/video_thread.c
··· 80 80 td->info->display_picture->temporal_reference, 81 81 /* Audio information */ 82 82 buf_pct, pcm_underruns, pcm_skipped); 83 - lcd_(putsxy)(0, 0, str); 83 + mylcd_putsxy(0, 0, str); 84 84 85 85 vo_lock(); 86 - lcd_(update_rect)(0, 0, LCD_WIDTH, 8); 86 + mylcd_update_rect(0, 0, LCD_WIDTH, 8); 87 87 vo_unlock(); 88 88 89 89 td->last_showfps = *rb->current_tick;