diff options
author | Michael Sevakis <jethead71@rockbox.org> | 2010-06-04 08:43:32 +0000 |
---|---|---|
committer | Michael Sevakis <jethead71@rockbox.org> | 2010-06-04 08:43:32 +0000 |
commit | bc26fe7a96d6f5e443003cb871dcb4bfba525352 (patch) | |
tree | fa05f187ca308af7bbddbc74a0270cd46cb48b72 /apps/plugins/mpegplayer/mpegplayer.c | |
parent | e174a8ad8dc531ff093894b7f930f0b9750c74eb (diff) | |
download | rockbox-bc26fe7a96d6f5e443003cb871dcb4bfba525352.tar.gz rockbox-bc26fe7a96d6f5e443003cb871dcb4bfba525352.zip |
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
Diffstat (limited to 'apps/plugins/mpegplayer/mpegplayer.c')
-rw-r--r-- | apps/plugins/mpegplayer/mpegplayer.c | 92 |
1 files changed, 46 insertions, 46 deletions
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(); |