summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/main_menu.c4
-rw-r--r--apps/menu.c3
-rw-r--r--apps/playlist_viewer.c3
-rw-r--r--apps/plugin.c3
-rw-r--r--apps/plugin.h18
-rw-r--r--apps/plugins/bounce.c15
-rw-r--r--apps/plugins/chessclock.c2
-rw-r--r--apps/plugins/clock.c200
-rw-r--r--apps/plugins/flipit.c10
-rw-r--r--apps/plugins/logo.c2
-rw-r--r--apps/plugins/minesweeper.c4
-rw-r--r--apps/plugins/sliding_puzzle.c2
-rw-r--r--apps/plugins/snake2.c12
-rw-r--r--apps/plugins/snow.c2
-rw-r--r--apps/plugins/solitaire.c12
-rw-r--r--apps/plugins/splitedit.c8
-rw-r--r--apps/plugins/star.c24
-rw-r--r--apps/plugins/vu_meter.c61
-rw-r--r--apps/recorder/icons.c12
-rw-r--r--apps/recorder/peakmeter.c8
-rw-r--r--apps/recorder/recording.c10
-rw-r--r--apps/screens.c26
-rw-r--r--apps/status.c4
-rw-r--r--apps/tree.c3
-rw-r--r--apps/wps-display.c4
-rw-r--r--firmware/drivers/lcd-h100.c355
-rw-r--r--firmware/drivers/lcd-recorder.c360
-rw-r--r--firmware/export/lcd.h9
28 files changed, 621 insertions, 555 deletions
diff --git a/apps/main_menu.c b/apps/main_menu.c
index 33e9269a8a..9654b806e3 100644
--- a/apps/main_menu.c
+++ b/apps/main_menu.c
@@ -72,10 +72,10 @@ int show_logo( void )
72 72
73 lcd_clear_display(); 73 lcd_clear_display();
74#if LCD_WIDTH == 112 || LCD_WIDTH == 128 74#if LCD_WIDTH == 112 || LCD_WIDTH == 128
75 lcd_bitmap(rockbox112x37, 0, 10, 112, 37, false); 75 lcd_bitmap(rockbox112x37, 0, 10, 112, 37);
76#endif 76#endif
77#if LCD_WIDTH >= 160 77#if LCD_WIDTH >= 160
78 lcd_bitmap(rockbox160x53, 0, 10, 160, 53, false); 78 lcd_bitmap(rockbox160x53, 0, 10, 160, 53);
79#endif 79#endif
80 80
81#ifdef HAVE_REMOTE_LCD 81#ifdef HAVE_REMOTE_LCD
diff --git a/apps/menu.c b/apps/menu.c
index d431097553..459abe6849 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -116,8 +116,7 @@ void put_cursorxy(int x, int y, bool on)
116 /* place the cursor */ 116 /* place the cursor */
117 if(on) { 117 if(on) {
118#ifdef HAVE_LCD_BITMAP 118#ifdef HAVE_LCD_BITMAP
119 lcd_bitmap ( bitmap_icons_6x8[Cursor], 119 lcd_bitmap(bitmap_icons_6x8[Cursor], xpos, ypos, 4, 8);
120 xpos, ypos, 4, 8, true);
121#else 120#else
122 lcd_putc(x, y, CURSOR_CHAR); 121 lcd_putc(x, y, CURSOR_CHAR);
123#endif 122#endif
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index 1d82c2e7e0..21ae4d7645 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -463,8 +463,7 @@ static void display_playlist(void)
463 offset = (viewer.line_height - 8) / 2; 463 offset = (viewer.line_height - 8) / 2;
464 lcd_bitmap(bitmap_icons_6x8[File], 464 lcd_bitmap(bitmap_icons_6x8[File],
465 CURSOR_X * 6 + CURSOR_WIDTH, 465 CURSOR_X * 6 + CURSOR_WIDTH,
466 MARGIN_Y+(i*viewer.line_height) + offset, 466 MARGIN_Y+(i*viewer.line_height) + offset, 6, 8);
467 6, 8, true);
468#else 467#else
469 lcd_putc(LINE_X-1, i, File); 468 lcd_putc(LINE_X-1, i, File);
470#endif 469#endif
diff --git a/apps/plugin.c b/apps/plugin.c
index fb9da5bd5d..2a8d2c0841 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -110,8 +110,11 @@ static const struct plugin_api rockbox_api = {
110 lcd_getstringsize, 110 lcd_getstringsize,
111 lcd_drawpixel, 111 lcd_drawpixel,
112 lcd_drawline, 112 lcd_drawline,
113 lcd_hline,
114 lcd_vline,
113 lcd_drawrect, 115 lcd_drawrect,
114 lcd_fillrect, 116 lcd_fillrect,
117 lcd_bitmap_part,
115 lcd_bitmap, 118 lcd_bitmap,
116 lcd_putsxy, 119 lcd_putsxy,
117 lcd_puts_style, 120 lcd_puts_style,
diff --git a/apps/plugin.h b/apps/plugin.h
index d2253b42c6..78bffe08ed 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -87,12 +87,12 @@
87#endif 87#endif
88 88
89/* increase this every time the api struct changes */ 89/* increase this every time the api struct changes */
90#define PLUGIN_API_VERSION 41 90#define PLUGIN_API_VERSION 42
91 91
92/* update this to latest version if a change to the api struct breaks 92/* update this to latest version if a change to the api struct breaks
93 backwards compatibility (and please take the opportunity to sort in any 93 backwards compatibility (and please take the opportunity to sort in any
94 new function which are "waiting" at the end of the function table) */ 94 new function which are "waiting" at the end of the function table) */
95#define PLUGIN_MIN_API_VERSION 41 95#define PLUGIN_MIN_API_VERSION 42
96 96
97/* plugin return codes */ 97/* plugin return codes */
98enum plugin_status { 98enum plugin_status {
@@ -160,17 +160,21 @@ struct plugin_api {
160 int (*lcd_getstringsize)(const unsigned char *str, int *w, int *h); 160 int (*lcd_getstringsize)(const unsigned char *str, int *w, int *h);
161 void (*lcd_drawpixel)(int x, int y); 161 void (*lcd_drawpixel)(int x, int y);
162 void (*lcd_drawline)(int x1, int y1, int x2, int y2); 162 void (*lcd_drawline)(int x1, int y1, int x2, int y2);
163 void (*lcd_drawrect)(int x, int y, int nx, int ny); 163 void (*lcd_hline)(int x1, int x2, int y);
164 void (*lcd_fillrect)(int x, int y, int nx, int ny); 164 void (*lcd_vline)(int x, int y1, int y2);
165 void (*lcd_drawrect)(int x, int y, int width, int height);
166 void (*lcd_fillrect)(int x, int y, int width, int height);
167 void (*lcd_bitmap_part)(const unsigned char *src, int src_x, int src_y,
168 int stride, int x, int y, int width, int height);
165 void (*lcd_bitmap)(const unsigned char *src, int x, int y, 169 void (*lcd_bitmap)(const unsigned char *src, int x, int y,
166 int nx, int ny, bool clear); 170 int width, int height);
167 void (*lcd_putsxy)(int x, int y, const unsigned char *string); 171 void (*lcd_putsxy)(int x, int y, const unsigned char *string);
168 void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style); 172 void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style);
169 void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string, 173 void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string,
170 int style); 174 int style);
171 unsigned char* lcd_framebuffer; 175 unsigned char* lcd_framebuffer;
172 void (*lcd_blit) (const unsigned char* p_data, int x, int y, int width, 176 void (*lcd_blit) (const unsigned char* data, int x, int by, int width,
173 int height, int stride); 177 int bheight, int stride);
174 void (*lcd_update)(void); 178 void (*lcd_update)(void);
175 void (*lcd_update_rect)(int x, int y, int width, int height); 179 void (*lcd_update_rect)(int x, int y, int width, int height);
176 void (*scrollbar)(int x, int y, int width, int height, int items, 180 void (*scrollbar)(int x, int y, int width, int height, int items,
diff --git a/apps/plugins/bounce.c b/apps/plugins/bounce.c
index 232d9a9cc5..fa0e22f196 100644
--- a/apps/plugins/bounce.c
+++ b/apps/plugins/bounce.c
@@ -269,9 +269,9 @@ static void addclock(void)
269 /* draw a circle */ 269 /* draw a circle */
270 for(i=0; i < 60; i+=3) { 270 for(i=0; i < 60; i+=3) {
271 rb->lcd_drawline( xminute[i], 271 rb->lcd_drawline( xminute[i],
272 yminute[i], 272 yminute[i],
273 xminute[(i+1)%60], 273 xminute[(i+1)%60],
274 yminute[(i+1)%60]); 274 yminute[(i+1)%60]);
275 } 275 }
276} 276}
277#endif /* HAVE_RTC */ 277#endif /* HAVE_RTC */
@@ -303,16 +303,17 @@ static int scrollit(void)
303 return -1; 303 return -1;
304 304
305 rb->lcd_clear_display(); 305 rb->lcd_clear_display();
306 rb->lcd_set_drawmode(DRMODE_FG);
306 307
307 for(i=0, yy=y, xx=x; i< LETTERS_ON_SCREEN; i++) { 308 for(i=0, yy=y, xx=x; i< LETTERS_ON_SCREEN; i++) {
308 letter = rock[(i+textpos) % rocklen ]; 309 letter = rock[(i+textpos) % rocklen ];
309 310
310 rb->lcd_bitmap((char *)char_gen_12x16[letter-0x20], 311 rb->lcd_bitmap((char *)char_gen_12x16[letter-0x20],
311 xx, table[yy&(TABLE_SIZE-1)], 312 xx, table[yy&(TABLE_SIZE-1)], 11, 16);
312 11, 16, false);
313 yy += YADD; 313 yy += YADD;
314 xx+= LCD_WIDTH/LETTERS_ON_SCREEN; 314 xx+= LCD_WIDTH/LETTERS_ON_SCREEN;
315 } 315 }
316 rb->lcd_set_drawmode(DRMODE_SOLID);
316#ifdef HAVE_RTC 317#ifdef HAVE_RTC
317 addclock(); 318 addclock();
318#endif 319#endif
@@ -393,13 +394,15 @@ static int loopit(void)
393 rb->lcd_putsxy(0, LCD_HEIGHT - 8, buffer); 394 rb->lcd_putsxy(0, LCD_HEIGHT - 8, buffer);
394 timeout--; 395 timeout--;
395 } 396 }
397 rb->lcd_set_drawmode(DRMODE_FG);
396 for(i=0, yy=y, xx=x; 398 for(i=0, yy=y, xx=x;
397 i<rocklen; 399 i<rocklen;
398 i++, yy+=values[NUM_YDIST].num, xx+=values[NUM_XDIST].num) 400 i++, yy+=values[NUM_YDIST].num, xx+=values[NUM_XDIST].num)
399 rb->lcd_bitmap((char *)char_gen_12x16[rock[i]-0x20], 401 rb->lcd_bitmap((char *)char_gen_12x16[rock[i]-0x20],
400 xtable[xx&(TABLE_SIZE-1)], table[yy&(TABLE_SIZE-1)], 402 xtable[xx&(TABLE_SIZE-1)], table[yy&(TABLE_SIZE-1)],
401 11, 16, false); 403 11, 16);
402 rb->lcd_update(); 404 rb->lcd_update();
405 rb->lcd_set_drawmode(DRMODE_SOLID);
403 406
404 ysanke+= values[NUM_YSANKE].num; 407 ysanke+= values[NUM_YSANKE].num;
405 xsanke+= values[NUM_XSANKE].num; 408 xsanke+= values[NUM_XSANKE].num;
diff --git a/apps/plugins/chessclock.c b/apps/plugins/chessclock.c
index 8485d40aae..b66ed2a385 100644
--- a/apps/plugins/chessclock.c
+++ b/apps/plugins/chessclock.c
@@ -214,7 +214,7 @@ static void show_pause_mode(bool enabled)
214 static const char pause_icon[] = {0x00,0x7f,0x7f,0x00,0x7f,0x7f,0x00}; 214 static const char pause_icon[] = {0x00,0x7f,0x7f,0x00,0x7f,0x7f,0x00};
215 215
216 if (enabled) 216 if (enabled)
217 rb->lcd_bitmap(pause_icon, 52, 0, 7, 8, true); 217 rb->lcd_bitmap(pause_icon, 52, 0, 7, 8);
218 else 218 else
219 { 219 {
220 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); 220 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
diff --git a/apps/plugins/clock.c b/apps/plugins/clock.c
index d58f746158..bddda15f5f 100644
--- a/apps/plugins/clock.c
+++ b/apps/plugins/clock.c
@@ -788,9 +788,9 @@ bool colon, bool lcd)
788 if(settings.digital_12h) 788 if(settings.digital_12h)
789 { 789 {
790 if(hour > 12) 790 if(hour > 12)
791 rb->lcd_bitmap(pm, 97, 55, 15, 8, true); 791 rb->lcd_bitmap(pm, 97, 55, 15, 8);
792 else 792 else
793 rb->lcd_bitmap(am, 1, 55, 15, 8, true); 793 rb->lcd_bitmap(am, 1, 55, 15, 8);
794 } 794 }
795 } 795 }
796 else 796 else
@@ -798,9 +798,9 @@ bool colon, bool lcd)
798 if(settings.lcd_12h) 798 if(settings.lcd_12h)
799 { 799 {
800 if(hour > 12) 800 if(hour > 12)
801 rb->lcd_bitmap(pm, 97, 55, 15, 8, true); 801 rb->lcd_bitmap(pm, 97, 55, 15, 8);
802 else 802 else
803 rb->lcd_bitmap(am, 1, 55, 15, 8, true); 803 rb->lcd_bitmap(am, 1, 55, 15, 8);
804 } 804 }
805 } 805 }
806 806
@@ -881,138 +881,138 @@ void binary(int hour, int minute, int second)
881 *****/ 881 *****/
882 if(temphour >= 32) 882 if(temphour >= 32)
883 { 883 {
884 rb->lcd_bitmap(bitmap_1, 0, 1, 15, 20, true); 884 rb->lcd_bitmap(bitmap_1, 0, 1, 15, 20);
885 temphour -= 32; 885 temphour -= 32;
886 } 886 }
887 else 887 else
888 rb->lcd_bitmap(bitmap_0, 0, 1, 15, 20, true); 888 rb->lcd_bitmap(bitmap_0, 0, 1, 15, 20);
889 if(temphour >= 16) 889 if(temphour >= 16)
890 { 890 {
891 rb->lcd_bitmap(bitmap_1, 19, 1, 15, 20, true); 891 rb->lcd_bitmap(bitmap_1, 19, 1, 15, 20);
892 temphour -= 16; 892 temphour -= 16;
893 } 893 }
894 else 894 else
895 rb->lcd_bitmap(bitmap_0, 19, 1, 15, 20, true); 895 rb->lcd_bitmap(bitmap_0, 19, 1, 15, 20);
896 if(temphour >= 8) 896 if(temphour >= 8)
897 { 897 {
898 rb->lcd_bitmap(bitmap_1, 38, 1, 15, 20, true); 898 rb->lcd_bitmap(bitmap_1, 38, 1, 15, 20);
899 temphour -= 8; 899 temphour -= 8;
900 } 900 }
901 else 901 else
902 rb->lcd_bitmap(bitmap_0, 38, 1, 15, 20, true); 902 rb->lcd_bitmap(bitmap_0, 38, 1, 15, 20);
903 if(temphour >= 4) 903 if(temphour >= 4)
904 { 904 {
905 rb->lcd_bitmap(bitmap_1, 57, 1, 15, 20, true); 905 rb->lcd_bitmap(bitmap_1, 57, 1, 15, 20);
906 temphour -= 4; 906 temphour -= 4;
907 } 907 }
908 else 908 else
909 rb->lcd_bitmap(bitmap_0, 57, 1, 15, 20, true); 909 rb->lcd_bitmap(bitmap_0, 57, 1, 15, 20);
910 if(temphour >= 2) 910 if(temphour >= 2)
911 { 911 {
912 rb->lcd_bitmap(bitmap_1, 76, 1, 15, 20, true); 912 rb->lcd_bitmap(bitmap_1, 76, 1, 15, 20);
913 temphour -= 2; 913 temphour -= 2;
914 } 914 }
915 else 915 else
916 rb->lcd_bitmap(bitmap_0, 76, 1, 15, 20, true); 916 rb->lcd_bitmap(bitmap_0, 76, 1, 15, 20);
917 if(temphour >= 1) 917 if(temphour >= 1)
918 { 918 {
919 rb->lcd_bitmap(bitmap_1, 95, 1, 15, 20, true); 919 rb->lcd_bitmap(bitmap_1, 95, 1, 15, 20);
920 temphour -= 1; 920 temphour -= 1;
921 } 921 }
922 else 922 else
923 rb->lcd_bitmap(bitmap_0, 95, 1, 15, 20, true); 923 rb->lcd_bitmap(bitmap_0, 95, 1, 15, 20);
924 924
925 /********* 925 /*********
926 * MINUTES 926 * MINUTES
927 ********/ 927 ********/
928 if(tempmin >= 32) 928 if(tempmin >= 32)
929 { 929 {
930 rb->lcd_bitmap(bitmap_1, 0, 21, 15, 20, true); 930 rb->lcd_bitmap(bitmap_1, 0, 21, 15, 20);
931 tempmin -= 32; 931 tempmin -= 32;
932 } 932 }
933 else 933 else
934 rb->lcd_bitmap(bitmap_0, 0, 21, 15, 20, true); 934 rb->lcd_bitmap(bitmap_0, 0, 21, 15, 20);
935 if(tempmin >= 16) 935 if(tempmin >= 16)
936 { 936 {
937 rb->lcd_bitmap(bitmap_1, 19, 21, 15, 20, true); 937 rb->lcd_bitmap(bitmap_1, 19, 21, 15, 20);
938 tempmin -= 16; 938 tempmin -= 16;
939 } 939 }
940 else 940 else
941 rb->lcd_bitmap(bitmap_0, 19, 21, 15, 20, true); 941 rb->lcd_bitmap(bitmap_0, 19, 21, 15, 20);
942 if(tempmin >= 8) 942 if(tempmin >= 8)
943 { 943 {
944 rb->lcd_bitmap(bitmap_1, 38, 21, 15, 20, true); 944 rb->lcd_bitmap(bitmap_1, 38, 21, 15, 20);
945 tempmin -= 8; 945 tempmin -= 8;
946 } 946 }
947 else 947 else
948 rb->lcd_bitmap(bitmap_0, 38, 21, 15, 20, true); 948 rb->lcd_bitmap(bitmap_0, 38, 21, 15, 20);
949 if(tempmin >= 4) 949 if(tempmin >= 4)
950 { 950 {
951 rb->lcd_bitmap(bitmap_1, 57, 21, 15, 20, true); 951 rb->lcd_bitmap(bitmap_1, 57, 21, 15, 20);
952 tempmin -= 4; 952 tempmin -= 4;
953 } 953 }
954 else 954 else
955 rb->lcd_bitmap(bitmap_0, 57, 21, 15, 20, true); 955 rb->lcd_bitmap(bitmap_0, 57, 21, 15, 20);
956 if(tempmin >= 2) 956 if(tempmin >= 2)
957 { 957 {
958 rb->lcd_bitmap(bitmap_1, 76, 21, 15, 20, true); 958 rb->lcd_bitmap(bitmap_1, 76, 21, 15, 20);
959 tempmin -= 2; 959 tempmin -= 2;
960 } 960 }
961 else 961 else
962 rb->lcd_bitmap(bitmap_0, 76, 21, 15, 20, true); 962 rb->lcd_bitmap(bitmap_0, 76, 21, 15, 20);
963 if(tempmin >= 1) 963 if(tempmin >= 1)
964 { 964 {
965 rb->lcd_bitmap(bitmap_1, 95, 21, 15, 20, true); 965 rb->lcd_bitmap(bitmap_1, 95, 21, 15, 20);
966 tempmin -= 1; 966 tempmin -= 1;
967 } 967 }
968 else 968 else
969 rb->lcd_bitmap(bitmap_0, 95, 21, 15, 20, true); 969 rb->lcd_bitmap(bitmap_0, 95, 21, 15, 20);
970 970
971 /********* 971 /*********
972 * SECONDS 972 * SECONDS
973 ********/ 973 ********/
974 if(tempsec >= 32) 974 if(tempsec >= 32)
975 { 975 {
976 rb->lcd_bitmap(bitmap_1, 0, 42, 15, 20, true); 976 rb->lcd_bitmap(bitmap_1, 0, 42, 15, 20);
977 tempsec -= 32; 977 tempsec -= 32;
978 } 978 }
979 else 979 else
980 rb->lcd_bitmap(bitmap_0, 0, 42, 15, 20, true); 980 rb->lcd_bitmap(bitmap_0, 0, 42, 15, 20);
981 if(tempsec >= 16) 981 if(tempsec >= 16)
982 { 982 {
983 rb->lcd_bitmap(bitmap_1, 19, 42, 15, 20, true); 983 rb->lcd_bitmap(bitmap_1, 19, 42, 15, 20);
984 tempsec -= 16; 984 tempsec -= 16;
985 } 985 }
986 else 986 else
987 rb->lcd_bitmap(bitmap_0, 19, 42, 15, 20, true); 987 rb->lcd_bitmap(bitmap_0, 19, 42, 15, 20);
988 if(tempsec >= 8) 988 if(tempsec >= 8)
989 { 989 {
990 rb->lcd_bitmap(bitmap_1, 38, 42, 15, 20, true); 990 rb->lcd_bitmap(bitmap_1, 38, 42, 15, 20);
991 tempsec -= 8; 991 tempsec -= 8;
992 } 992 }
993 else 993 else
994 rb->lcd_bitmap(bitmap_0, 38, 42, 15, 20, true); 994 rb->lcd_bitmap(bitmap_0, 38, 42, 15, 20);
995 if(tempsec >= 4) 995 if(tempsec >= 4)
996 { 996 {
997 rb->lcd_bitmap(bitmap_1, 57, 42, 15, 20, true); 997 rb->lcd_bitmap(bitmap_1, 57, 42, 15, 20);
998 tempsec -= 4; 998 tempsec -= 4;
999 } 999 }
1000 else 1000 else
1001 rb->lcd_bitmap(bitmap_0, 57, 42, 15, 20, true); 1001 rb->lcd_bitmap(bitmap_0, 57, 42, 15, 20);
1002 if(tempsec >= 2) 1002 if(tempsec >= 2)
1003 { 1003 {
1004 rb->lcd_bitmap(bitmap_1, 76, 42, 15, 20, true); 1004 rb->lcd_bitmap(bitmap_1, 76, 42, 15, 20);
1005 tempsec -= 2; 1005 tempsec -= 2;
1006 } 1006 }
1007 else 1007 else
1008 rb->lcd_bitmap(bitmap_0, 76, 42, 15, 20, true); 1008 rb->lcd_bitmap(bitmap_0, 76, 42, 15, 20);
1009 if(tempsec >= 1) 1009 if(tempsec >= 1)
1010 { 1010 {
1011 rb->lcd_bitmap(bitmap_1, 95, 42, 15, 20, true); 1011 rb->lcd_bitmap(bitmap_1, 95, 42, 15, 20);
1012 tempsec -= 1; 1012 tempsec -= 1;
1013 } 1013 }
1014 else 1014 else
1015 rb->lcd_bitmap(bitmap_0, 95, 42, 15, 20, true); 1015 rb->lcd_bitmap(bitmap_0, 95, 42, 15, 20);
1016 1016
1017 rb->lcd_update(); 1017 rb->lcd_update();
1018} 1018}
@@ -1039,7 +1039,7 @@ void show_logo(bool animate, bool show_clock_text)
1039 rb->lcd_drawline(0, y_position/2-1, 111, y_position/2-1); 1039 rb->lcd_drawline(0, y_position/2-1, 111, y_position/2-1);
1040 rb->lcd_drawline(0, y_position/2+38, 111, y_position/2+38); 1040 rb->lcd_drawline(0, y_position/2+38, 111, y_position/2+38);
1041 rb->lcd_set_drawmode(DRMODE_SOLID); 1041 rb->lcd_set_drawmode(DRMODE_SOLID);
1042 rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37, true); 1042 rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37);
1043 if(show_clock_text) 1043 if(show_clock_text)
1044 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf); 1044 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf);
1045 rb->lcd_update(); 1045 rb->lcd_update();
@@ -1051,7 +1051,7 @@ void show_logo(bool animate, bool show_clock_text)
1051 rb->lcd_drawline(0, y_position/2-1, 111, y_position/2-1); 1051 rb->lcd_drawline(0, y_position/2-1, 111, y_position/2-1);
1052 rb->lcd_drawline(0, y_position/2+38, 111, y_position/2+38); 1052 rb->lcd_drawline(0, y_position/2+38, 111, y_position/2+38);
1053 rb->lcd_set_drawmode(DRMODE_SOLID); 1053 rb->lcd_set_drawmode(DRMODE_SOLID);
1054 rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37, true); 1054 rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37);
1055 if(show_clock_text) 1055 if(show_clock_text)
1056 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf); 1056 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf);
1057 rb->lcd_update(); 1057 rb->lcd_update();
@@ -1063,7 +1063,7 @@ void show_logo(bool animate, bool show_clock_text)
1063 rb->lcd_drawline(0, y_position/2-1, 111, y_position/2-1); 1063 rb->lcd_drawline(0, y_position/2-1, 111, y_position/2-1);
1064 rb->lcd_drawline(0, y_position/2+38, 111, y_position/2+38); 1064 rb->lcd_drawline(0, y_position/2+38, 111, y_position/2+38);
1065 rb->lcd_set_drawmode(DRMODE_SOLID); 1065 rb->lcd_set_drawmode(DRMODE_SOLID);
1066 rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37, true); 1066 rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37);
1067 if(show_clock_text) 1067 if(show_clock_text)
1068 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf); 1068 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf);
1069 rb->lcd_update(); 1069 rb->lcd_update();
@@ -1071,7 +1071,7 @@ void show_logo(bool animate, bool show_clock_text)
1071 } 1071 }
1072 else /* don't animate, just show */ 1072 else /* don't animate, just show */
1073 { 1073 {
1074 rb->lcd_bitmap(clogo, 0, 10, 112, 37, true); 1074 rb->lcd_bitmap(clogo, 0, 10, 112, 37);
1075 if(show_clock_text) 1075 if(show_clock_text)
1076 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf); 1076 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf);
1077 rb->lcd_update(); 1077 rb->lcd_update();
@@ -1094,7 +1094,7 @@ void exit_logo(void)
1094 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); 1094 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1095 rb->lcd_drawline(0, y_position/2-1, 111, y_position/2-1); 1095 rb->lcd_drawline(0, y_position/2-1, 111, y_position/2-1);
1096 rb->lcd_set_drawmode(DRMODE_SOLID); 1096 rb->lcd_set_drawmode(DRMODE_SOLID);
1097 rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37, true); 1097 rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37);
1098 rb->lcd_update(); 1098 rb->lcd_update();
1099 } 1099 }
1100} 1100}
@@ -1511,9 +1511,9 @@ bool f1_screen(void)
1511void draw_checkbox(bool setting, int x, int y) 1511void draw_checkbox(bool setting, int x, int y)
1512{ 1512{
1513 if(setting) /* checkbox is on */ 1513 if(setting) /* checkbox is on */
1514 rb->lcd_bitmap(checkbox_full, x, y, 8, 6, true); 1514 rb->lcd_bitmap(checkbox_full, x, y, 8, 6);
1515 else /* checkbox is off */ 1515 else /* checkbox is off */
1516 rb->lcd_bitmap(checkbox_empty, x, y, 8, 6, true); 1516 rb->lcd_bitmap(checkbox_empty, x, y, 8, 6);
1517} 1517}
1518 1518
1519void draw_settings(void) 1519void draw_settings(void)
@@ -1544,18 +1544,18 @@ void draw_settings(void)
1544 draw_checkbox(settings.analog_digits, 1, 33); 1544 draw_checkbox(settings.analog_digits, 1, 33);
1545 1545
1546 if(settings.analog_date == 0) 1546 if(settings.analog_date == 0)
1547 rb->lcd_bitmap(checkbox_empty, 1, 41, 8, 6, true); 1547 rb->lcd_bitmap(checkbox_empty, 1, 41, 8, 6);
1548 else if(settings.analog_date == 1) 1548 else if(settings.analog_date == 1)
1549 rb->lcd_bitmap(checkbox_half, 1, 41, 8, 6, true); 1549 rb->lcd_bitmap(checkbox_half, 1, 41, 8, 6);
1550 else 1550 else
1551 rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6, true); 1551 rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6);
1552 1552
1553 if(settings.analog_time == 0) 1553 if(settings.analog_time == 0)
1554 rb->lcd_bitmap(checkbox_empty, 1, 49, 8, 6, true); 1554 rb->lcd_bitmap(checkbox_empty, 1, 49, 8, 6);
1555 else if(settings.analog_time == 1) 1555 else if(settings.analog_time == 1)
1556 rb->lcd_bitmap(checkbox_half, 1, 49, 8, 6, true); 1556 rb->lcd_bitmap(checkbox_half, 1, 49, 8, 6);
1557 else 1557 else
1558 rb->lcd_bitmap(checkbox_full, 1, 49, 8, 6, true); 1558 rb->lcd_bitmap(checkbox_full, 1, 49, 8, 6);
1559 1559
1560 draw_checkbox(settings.analog_secondhand, 1, 57); 1560 draw_checkbox(settings.analog_secondhand, 1, 57);
1561 } 1561 }
@@ -1584,20 +1584,20 @@ void draw_settings(void)
1584 1584
1585 /* Draw checkboxes */ 1585 /* Draw checkboxes */
1586 if(settings.digital_date == 0) 1586 if(settings.digital_date == 0)
1587 rb->lcd_bitmap(checkbox_empty, 1, 33, 8, 6, true); 1587 rb->lcd_bitmap(checkbox_empty, 1, 33, 8, 6);
1588 else if(settings.digital_date == 1) 1588 else if(settings.digital_date == 1)
1589 rb->lcd_bitmap(checkbox_half, 1, 33, 8, 6, true); 1589 rb->lcd_bitmap(checkbox_half, 1, 33, 8, 6);
1590 else 1590 else
1591 rb->lcd_bitmap(checkbox_full, 1, 33, 8, 6, true); 1591 rb->lcd_bitmap(checkbox_full, 1, 33, 8, 6);
1592 1592
1593 if(settings.digital_seconds == 0) 1593 if(settings.digital_seconds == 0)
1594 rb->lcd_bitmap(checkbox_empty, 1, 41, 8, 6, true); 1594 rb->lcd_bitmap(checkbox_empty, 1, 41, 8, 6);
1595 else if(settings.digital_seconds == 1) 1595 else if(settings.digital_seconds == 1)
1596 rb->lcd_bitmap(checkbox_onethird, 1, 41, 8, 6, true); 1596 rb->lcd_bitmap(checkbox_onethird, 1, 41, 8, 6);
1597 else if(settings.digital_seconds == 2) 1597 else if(settings.digital_seconds == 2)
1598 rb->lcd_bitmap(checkbox_twothird, 1, 41, 8, 6, true); 1598 rb->lcd_bitmap(checkbox_twothird, 1, 41, 8, 6);
1599 else 1599 else
1600 rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6, true); 1600 rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6);
1601 1601
1602 draw_checkbox(settings.digital_blinkcolon, 1, 49); 1602 draw_checkbox(settings.digital_blinkcolon, 1, 49);
1603 draw_checkbox(settings.digital_12h, 1, 57); 1603 draw_checkbox(settings.digital_12h, 1, 57);
@@ -1627,20 +1627,20 @@ void draw_settings(void)
1627 1627
1628 /* Draw checkboxes */ 1628 /* Draw checkboxes */
1629 if(settings.lcd_date == 0) 1629 if(settings.lcd_date == 0)
1630 rb->lcd_bitmap(checkbox_empty, 1, 33, 8, 6, true); 1630 rb->lcd_bitmap(checkbox_empty, 1, 33, 8, 6);
1631 else if(settings.lcd_date == 1) 1631 else if(settings.lcd_date == 1)
1632 rb->lcd_bitmap(checkbox_half, 1, 33, 8, 6, true); 1632 rb->lcd_bitmap(checkbox_half, 1, 33, 8, 6);
1633 else 1633 else
1634 rb->lcd_bitmap(checkbox_full, 1, 33, 8, 6, true); 1634 rb->lcd_bitmap(checkbox_full, 1, 33, 8, 6);
1635 1635
1636 if(settings.lcd_seconds == 0) 1636 if(settings.lcd_seconds == 0)
1637 rb->lcd_bitmap(checkbox_empty, 1, 41, 8, 6, true); 1637 rb->lcd_bitmap(checkbox_empty, 1, 41, 8, 6);
1638 else if(settings.lcd_seconds == 1) 1638 else if(settings.lcd_seconds == 1)
1639 rb->lcd_bitmap(checkbox_onethird, 1, 41, 8, 6, true); 1639 rb->lcd_bitmap(checkbox_onethird, 1, 41, 8, 6);
1640 else if(settings.lcd_seconds == 2) 1640 else if(settings.lcd_seconds == 2)
1641 rb->lcd_bitmap(checkbox_twothird, 1, 41, 8, 6, true); 1641 rb->lcd_bitmap(checkbox_twothird, 1, 41, 8, 6);
1642 else 1642 else
1643 rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6, true); 1643 rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6);
1644 1644
1645 draw_checkbox(settings.lcd_blinkcolon, 1, 49); 1645 draw_checkbox(settings.lcd_blinkcolon, 1, 49);
1646 draw_checkbox(settings.lcd_12h, 1, 57); 1646 draw_checkbox(settings.lcd_12h, 1, 57);
@@ -2131,16 +2131,16 @@ void general_settings(void)
2131 rb->lcd_getstringsize(buf, &buf_w, &buf_h); 2131 rb->lcd_getstringsize(buf, &buf_w, &buf_h);
2132 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); 2132 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf);
2133 2133
2134 rb->lcd_bitmap(arrow, 1, 17, 8, 6, true); 2134 rb->lcd_bitmap(arrow, 1, 17, 8, 6);
2135 rb->lcd_bitmap(arrow, 1, 25, 8, 6, true); 2135 rb->lcd_bitmap(arrow, 1, 25, 8, 6);
2136 draw_checkbox(settings.display_counter, 1, 33); 2136 draw_checkbox(settings.display_counter, 1, 33);
2137 2137
2138 if(settings.save_mode == 1) 2138 if(settings.save_mode == 1)
2139 rb->lcd_bitmap(checkbox_onethird, 1, 41, 8, 6, true); 2139 rb->lcd_bitmap(checkbox_onethird, 1, 41, 8, 6);
2140 else if(settings.save_mode == 2) 2140 else if(settings.save_mode == 2)
2141 rb->lcd_bitmap(checkbox_twothird, 1, 41, 8, 6, true); 2141 rb->lcd_bitmap(checkbox_twothird, 1, 41, 8, 6);
2142 else 2142 else
2143 rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6, true); 2143 rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6);
2144 2144
2145 switch(cursorpos) 2145 switch(cursorpos)
2146 { 2146 {
@@ -2181,15 +2181,15 @@ void general_settings(void)
2181 rb->lcd_puts(2, 5, "Save: Automatic"); 2181 rb->lcd_puts(2, 5, "Save: Automatic");
2182 else 2182 else
2183 rb->lcd_puts(2, 5, "Save: Manually"); 2183 rb->lcd_puts(2, 5, "Save: Manually");
2184 rb->lcd_bitmap(arrow, 1, 17, 8, 6, true); 2184 rb->lcd_bitmap(arrow, 1, 17, 8, 6);
2185 rb->lcd_bitmap(arrow, 1, 25, 8, 6, true); 2185 rb->lcd_bitmap(arrow, 1, 25, 8, 6);
2186 draw_checkbox(settings.display_counter, 1, 33); 2186 draw_checkbox(settings.display_counter, 1, 33);
2187 if(settings.save_mode == 1) 2187 if(settings.save_mode == 1)
2188 rb->lcd_bitmap(checkbox_onethird, 1, 41, 8, 6, true); 2188 rb->lcd_bitmap(checkbox_onethird, 1, 41, 8, 6);
2189 else if(settings.save_mode == 2) 2189 else if(settings.save_mode == 2)
2190 rb->lcd_bitmap(checkbox_twothird, 1, 41, 8, 6, true); 2190 rb->lcd_bitmap(checkbox_twothird, 1, 41, 8, 6);
2191 else 2191 else
2192 rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6, true); 2192 rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6);
2193 2193
2194 cursor(0, cursor_y, 112, 8); 2194 cursor(0, cursor_y, 112, 8);
2195 rb->lcd_update(); 2195 rb->lcd_update();
@@ -2218,15 +2218,15 @@ void general_settings(void)
2218 rb->lcd_puts(2, 5, "Save: Automatic"); 2218 rb->lcd_puts(2, 5, "Save: Automatic");
2219 else 2219 else
2220 rb->lcd_puts(2, 5, "Save: Manually"); 2220 rb->lcd_puts(2, 5, "Save: Manually");
2221 rb->lcd_bitmap(arrow, 1, 17, 8, 6, true); 2221 rb->lcd_bitmap(arrow, 1, 17, 8, 6);
2222 rb->lcd_bitmap(arrow, 1, 25, 8, 6, true); 2222 rb->lcd_bitmap(arrow, 1, 25, 8, 6);
2223 draw_checkbox(settings.display_counter, 1, 33); 2223 draw_checkbox(settings.display_counter, 1, 33);
2224 if(settings.save_mode == 1) 2224 if(settings.save_mode == 1)
2225 rb->lcd_bitmap(checkbox_onethird, 1, 41, 8, 6, true); 2225 rb->lcd_bitmap(checkbox_onethird, 1, 41, 8, 6);
2226 else if(settings.save_mode == 2) 2226 else if(settings.save_mode == 2)
2227 rb->lcd_bitmap(checkbox_twothird, 1, 41, 8, 6, true); 2227 rb->lcd_bitmap(checkbox_twothird, 1, 41, 8, 6);
2228 else 2228 else
2229 rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6, true); 2229 rb->lcd_bitmap(checkbox_full, 1, 41, 8, 6);
2230 2230
2231 cursor(0, cursor_y, 112, 8); 2231 cursor(0, cursor_y, 112, 8);
2232 rb->lcd_update(); 2232 rb->lcd_update();
@@ -2323,9 +2323,9 @@ void draw_extras(int year, int day, int month, int hour, int minute, int second)
2323 if(settings.analog_time == 2) 2323 if(settings.analog_time == 2)
2324 { 2324 {
2325 if(current_time->tm_hour > 12) /* PM */ 2325 if(current_time->tm_hour > 12) /* PM */
2326 rb->lcd_bitmap(pm, 96, 1, 15, 8, true); 2326 rb->lcd_bitmap(pm, 96, 1, 15, 8);
2327 else /* AM */ 2327 else /* AM */
2328 rb->lcd_bitmap(am, 96, 1, 15, 8, true); 2328 rb->lcd_bitmap(am, 96, 1, 15, 8);
2329 } 2329 }
2330 } 2330 }
2331 2331
@@ -2460,11 +2460,11 @@ void select_mode(void)
2460 rb->lcd_puts(0, 7, "PLAY:Go|OFF:Cancel"); 2460 rb->lcd_puts(0, 7, "PLAY:Go|OFF:Cancel");
2461 2461
2462 /* draw an arrow next to all of them */ 2462 /* draw an arrow next to all of them */
2463 rb->lcd_bitmap(arrow, 1, 9, 8, 6, true); 2463 rb->lcd_bitmap(arrow, 1, 9, 8, 6);
2464 rb->lcd_bitmap(arrow, 1, 17, 8, 6, true); 2464 rb->lcd_bitmap(arrow, 1, 17, 8, 6);
2465 rb->lcd_bitmap(arrow, 1, 25, 8, 6, true); 2465 rb->lcd_bitmap(arrow, 1, 25, 8, 6);
2466 rb->lcd_bitmap(arrow, 1, 33, 8, 6, true); 2466 rb->lcd_bitmap(arrow, 1, 33, 8, 6);
2467 rb->lcd_bitmap(arrow, 1, 41, 8, 6, true); 2467 rb->lcd_bitmap(arrow, 1, 41, 8, 6);
2468 2468
2469 /* draw line selector */ 2469 /* draw line selector */
2470 switch(cursorpos) 2470 switch(cursorpos)
@@ -2501,11 +2501,11 @@ void select_mode(void)
2501 rb->lcd_puts(0, 7, "PLAY:Go|OFF:Cancel"); 2501 rb->lcd_puts(0, 7, "PLAY:Go|OFF:Cancel");
2502 2502
2503 /* draw an arrow next to all of them */ 2503 /* draw an arrow next to all of them */
2504 rb->lcd_bitmap(arrow, 1, 9, 8, 6, true); 2504 rb->lcd_bitmap(arrow, 1, 9, 8, 6);
2505 rb->lcd_bitmap(arrow, 1, 17, 8, 6, true); 2505 rb->lcd_bitmap(arrow, 1, 17, 8, 6);
2506 rb->lcd_bitmap(arrow, 1, 25, 8, 6, true); 2506 rb->lcd_bitmap(arrow, 1, 25, 8, 6);
2507 rb->lcd_bitmap(arrow, 1, 33, 8, 6, true); 2507 rb->lcd_bitmap(arrow, 1, 33, 8, 6);
2508 rb->lcd_bitmap(arrow, 1, 41, 8, 6, true); 2508 rb->lcd_bitmap(arrow, 1, 41, 8, 6);
2509 2509
2510 cursor(0, cursor_y, 112, 8); 2510 cursor(0, cursor_y, 112, 8);
2511 rb->lcd_update(); 2511 rb->lcd_update();
@@ -2535,11 +2535,11 @@ void select_mode(void)
2535 rb->lcd_puts(0, 7, "PLAY:Go|OFF:Cancel"); 2535 rb->lcd_puts(0, 7, "PLAY:Go|OFF:Cancel");
2536 2536
2537 /* draw an arrow next to all of them */ 2537 /* draw an arrow next to all of them */
2538 rb->lcd_bitmap(arrow, 1, 9, 8, 6, true); 2538 rb->lcd_bitmap(arrow, 1, 9, 8, 6);
2539 rb->lcd_bitmap(arrow, 1, 17, 8, 6, true); 2539 rb->lcd_bitmap(arrow, 1, 17, 8, 6);
2540 rb->lcd_bitmap(arrow, 1, 25, 8, 6, true); 2540 rb->lcd_bitmap(arrow, 1, 25, 8, 6);
2541 rb->lcd_bitmap(arrow, 1, 33, 8, 6, true); 2541 rb->lcd_bitmap(arrow, 1, 33, 8, 6);
2542 rb->lcd_bitmap(arrow, 1, 41, 8, 6, true); 2542 rb->lcd_bitmap(arrow, 1, 41, 8, 6);
2543 2543
2544 cursor(0, cursor_y, 112, 8); 2544 cursor(0, cursor_y, 112, 8);
2545 rb->lcd_update(); 2545 rb->lcd_update();
@@ -2580,7 +2580,7 @@ void counter_finished(void)
2580 rb->lcd_clear_display(); 2580 rb->lcd_clear_display();
2581 2581
2582 /* draw "TIME'S UP" text */ 2582 /* draw "TIME'S UP" text */
2583 rb->lcd_bitmap(times_up, 0, xpos, 112, 50, true); 2583 rb->lcd_bitmap(times_up, 0, xpos, 112, 50);
2584 2584
2585 /* invert lcd */ 2585 /* invert lcd */
2586 rb->lcd_set_drawmode(DRMODE_COMPLEMENT); 2586 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
diff --git a/apps/plugins/flipit.c b/apps/plugins/flipit.c
index 57cbad213d..d6774fc968 100644
--- a/apps/plugins/flipit.c
+++ b/apps/plugins/flipit.c
@@ -71,9 +71,9 @@ static unsigned char cursor_pic[32] = {
71/* draw a spot at the coordinates (x,y), range of p is 0-19 */ 71/* draw a spot at the coordinates (x,y), range of p is 0-19 */
72static void draw_spot(int p) { 72static void draw_spot(int p) {
73 ptr = spot_pic[spots[p]]; 73 ptr = spot_pic[spots[p]];
74 rb->lcd_bitmap (ptr, (p%5)*16+1, (p/5)*16+1, 14, 8, true); 74 rb->lcd_bitmap (ptr, (p%5)*16+1, (p/5)*16+1, 14, 8);
75 ptr += 14; 75 ptr += 14;
76 rb->lcd_bitmap (ptr, (p%5)*16+1, (p/5)*16+9, 14, 6, true); 76 rb->lcd_bitmap (ptr, (p%5)*16+1, (p/5)*16+9, 14, 6);
77} 77}
78 78
79/* draw the cursor at the current cursor position */ 79/* draw the cursor at the current cursor position */
@@ -81,10 +81,12 @@ static void draw_cursor(void) {
81 int i,j; 81 int i,j;
82 i = (cursor_pos%5)*16; 82 i = (cursor_pos%5)*16;
83 j = (cursor_pos/5)*16; 83 j = (cursor_pos/5)*16;
84 rb->lcd_set_drawmode(DRMODE_FG);
84 ptr = cursor_pic; 85 ptr = cursor_pic;
85 rb->lcd_bitmap (ptr, i, j, 16, 8, false); 86 rb->lcd_bitmap (ptr, i, j, 16, 8);
86 ptr += 16; 87 ptr += 16;
87 rb->lcd_bitmap (ptr, i, j+8, 16, 8, false); 88 rb->lcd_bitmap (ptr, i, j+8, 16, 8);
89 rb->lcd_set_drawmode(DRMODE_SOLID);
88} 90}
89 91
90/* clear the cursor where it is */ 92/* clear the cursor where it is */
diff --git a/apps/plugins/logo.c b/apps/plugins/logo.c
index 7763fb9737..7807982ebc 100644
--- a/apps/plugins/logo.c
+++ b/apps/plugins/logo.c
@@ -229,7 +229,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter) {
229 while (1) { 229 while (1) {
230#ifdef HAVE_LCD_BITMAP 230#ifdef HAVE_LCD_BITMAP
231 rb->lcd_clear_display(); 231 rb->lcd_clear_display();
232 rb->lcd_bitmap(LOGO, x, y, LOGO_WIDTH, LOGO_HEIGHT, false); 232 rb->lcd_bitmap(LOGO, x, y, LOGO_WIDTH, LOGO_HEIGHT);
233#ifdef REMOTE_LOGO 233#ifdef REMOTE_LOGO
234 rb->remote_clear_display(); 234 rb->remote_clear_display();
235 rb->remote_bitmap(REMOTE_LOGO, 235 rb->remote_bitmap(REMOTE_LOGO,
diff --git a/apps/plugins/minesweeper.c b/apps/plugins/minesweeper.c
index d7e19e9423..18b57c42f2 100644
--- a/apps/plugins/minesweeper.c
+++ b/apps/plugins/minesweeper.c
@@ -379,7 +379,9 @@ int minesweeper(void)
379 if(minefield[i][j].mine){ 379 if(minefield[i][j].mine){
380 rb->lcd_putsxy(j*8+1,i*8+1,"b"); 380 rb->lcd_putsxy(j*8+1,i*8+1,"b");
381 } else if(minefield[i][j].neighbors){ 381 } else if(minefield[i][j].neighbors){
382 rb->lcd_bitmap(num[minefield[i][j].neighbors],j*8,i*8,8,8,false); 382 rb->lcd_set_drawmode(DRMODE_FG);
383 rb->lcd_bitmap(num[minefield[i][j].neighbors],j*8,i*8,8,8);
384 rb->lcd_set_drawmode(DRMODE_SOLID);
383 } 385 }
384 } else if(minefield[i][j].flag) { 386 } else if(minefield[i][j].flag) {
385 rb->lcd_drawline(j*8+2,i*8+2,j*8+5,i*8+5); 387 rb->lcd_drawline(j*8+2,i*8+2,j*8+5,i*8+5);
diff --git a/apps/plugins/sliding_puzzle.c b/apps/plugins/sliding_puzzle.c
index 83f92b241b..e222995e01 100644
--- a/apps/plugins/sliding_puzzle.c
+++ b/apps/plugins/sliding_puzzle.c
@@ -148,7 +148,7 @@ static unsigned char picture[20][32] = {
148static void draw_spot(int p, int x, int y) 148static void draw_spot(int p, int x, int y)
149{ 149{
150 if (pic || p==20) { 150 if (pic || p==20) {
151 rb->lcd_bitmap (picture[p-1], x, y, 16, 16, true); 151 rb->lcd_bitmap (picture[p-1], x, y, 16, 16);
152 } else { 152 } else {
153 rb->lcd_drawrect(x, y, 16, 16); 153 rb->lcd_drawrect(x, y, 16, 16);
154 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); 154 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
diff --git a/apps/plugins/snake2.c b/apps/plugins/snake2.c
index bd9792a23d..fdc317b7ef 100644
--- a/apps/plugins/snake2.c
+++ b/apps/plugins/snake2.c
@@ -619,11 +619,13 @@ void draw_apple( void )
619#if LCD_WIDTH >= 160 && LCD_HEIGHT >= 128 619#if LCD_WIDTH >= 160 && LCD_HEIGHT >= 128
620 char pscore[5], counter[4]; 620 char pscore[5], counter[4];
621 621
622 rb->lcd_bitmap(snakebmp,0,0,BMPWIDTH_snakebmp,BMPHEIGHT_snakebmp,false); 622 rb->lcd_set_drawmode(DRMODE_FG);
623 rb->lcd_bitmap(snakebmp,0,0,BMPWIDTH_snakebmp,BMPHEIGHT_snakebmp);
623 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); 624 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
624 rb->lcd_fillrect(0,0,BMPWIDTH_snakeupbmp,BMPHEIGHT_snakeupbmp); 625 rb->lcd_fillrect(0,0,BMPWIDTH_snakeupbmp,BMPHEIGHT_snakeupbmp);
626 rb->lcd_set_drawmode(DRMODE_FG);
627 rb->lcd_bitmap(snakeupbmp,0,0,BMPWIDTH_snakeupbmp,BMPHEIGHT_snakeupbmp);
625 rb->lcd_set_drawmode(DRMODE_SOLID); 628 rb->lcd_set_drawmode(DRMODE_SOLID);
626 rb->lcd_bitmap(snakeupbmp,0,0,BMPWIDTH_snakeupbmp,BMPHEIGHT_snakeupbmp,false);
627 629
628 rb->snprintf(counter,sizeof(counter),"%d",applecount); 630 rb->snprintf(counter,sizeof(counter),"%d",applecount);
629 rb->lcd_getstringsize(counter,&strwdt,&strhgt); 631 rb->lcd_getstringsize(counter,&strwdt,&strhgt);
@@ -1295,8 +1297,10 @@ void game_init(void)
1295 1297
1296#if LCD_WIDTH >= 160 && LCD_HEIGHT >= 128 1298#if LCD_WIDTH >= 160 && LCD_HEIGHT >= 128
1297 1299
1298 rb->lcd_bitmap(snakebmp,0,0,BMPWIDTH_snakebmp,BMPWIDTH_snakebmp,false); 1300 rb->lcd_set_drawmode(DRMODE_FG);
1299 1301 rb->lcd_bitmap(snakebmp,0,0,BMPWIDTH_snakebmp,BMPWIDTH_snakebmp);
1302 rb->lcd_set_drawmode(DRMODE_SOLID);
1303
1300 rb->snprintf(plevel,sizeof(plevel),"%d",level); 1304 rb->snprintf(plevel,sizeof(plevel),"%d",level);
1301 rb->lcd_getstringsize(plevel,&strwdt,&strhgt); 1305 rb->lcd_getstringsize(plevel,&strwdt,&strhgt);
1302 rb->lcd_putsxy(42-strwdt/2,25, plevel); 1306 rb->lcd_putsxy(42-strwdt/2,25, plevel);
diff --git a/apps/plugins/snow.c b/apps/plugins/snow.c
index dd97abc4fb..36181e6eae 100644
--- a/apps/plugins/snow.c
+++ b/apps/plugins/snow.c
@@ -115,7 +115,7 @@ static void snow_move(void)
115 if (particle_exists(i)) 115 if (particle_exists(i))
116#ifdef HAVE_LCD_BITMAP 116#ifdef HAVE_LCD_BITMAP
117 rb->lcd_bitmap(flake,particles[i][0],particles[i][1], 117 rb->lcd_bitmap(flake,particles[i][0],particles[i][1],
118 FLAKE_WIDTH,FLAKE_WIDTH,true); 118 FLAKE_WIDTH,FLAKE_WIDTH);
119#else 119#else
120 pgfx_drawpixel(particles[i][0],particles[i][1]); 120 pgfx_drawpixel(particles[i][0],particles[i][1]);
121#endif 121#endif
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c
index 9f2fbfa4f2..fca36aad82 100644
--- a/apps/plugins/solitaire.c
+++ b/apps/plugins/solitaire.c
@@ -900,8 +900,8 @@ int solitaire(void){
900 rb->lcd_set_drawmode(DRMODE_SOLID); 900 rb->lcd_set_drawmode(DRMODE_SOLID);
901 /* known card */ 901 /* known card */
902 if(deck[c].known){ 902 if(deck[c].known){
903 rb->lcd_bitmap(numbers[deck[c].num], i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+1, j, 8, 8, true); 903 rb->lcd_bitmap(numbers[deck[c].num], i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+1, j, 8, 8);
904 rb->lcd_bitmap(colors[deck[c].color], i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+7, j, 8, 8, true); 904 rb->lcd_bitmap(colors[deck[c].color], i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+7, j, 8, 8);
905 } 905 }
906 /* draw top line of the card */ 906 /* draw top line of the card */
907 rb->lcd_drawline(i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+1,j,i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+CARD_WIDTH-1,j); 907 rb->lcd_drawline(i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+1,j,i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+CARD_WIDTH-1,j);
@@ -944,9 +944,9 @@ int solitaire(void){
944 } 944 }
945 } 945 }
946 if(c != NOT_A_CARD) { 946 if(c != NOT_A_CARD) {
947 rb->lcd_bitmap(numbers[deck[c].num], LCD_WIDTH2 - CARD_WIDTH+1, i*CARD_HEIGHT, 8, 8, true); 947 rb->lcd_bitmap(numbers[deck[c].num], LCD_WIDTH2 - CARD_WIDTH+1, i*CARD_HEIGHT, 8, 8);
948 } 948 }
949 rb->lcd_bitmap(colors[i], LCD_WIDTH2 - CARD_WIDTH+7, i*CARD_HEIGHT, 8, 8, true); 949 rb->lcd_bitmap(colors[i], LCD_WIDTH2 - CARD_WIDTH+7, i*CARD_HEIGHT, 8, 8);
950 /* draw a selected card */ 950 /* draw a selected card */
951 if(c != NOT_A_CARD) { 951 if(c != NOT_A_CARD) {
952 if(sel_card == c){ 952 if(sel_card == c){
@@ -976,8 +976,8 @@ int solitaire(void){
976 rb->lcd_drawline(LCD_WIDTH2,LCD_HEIGHT-CARD_HEIGHT,LCD_WIDTH2,LCD_HEIGHT-2); 976 rb->lcd_drawline(LCD_WIDTH2,LCD_HEIGHT-CARD_HEIGHT,LCD_WIDTH2,LCD_HEIGHT-2);
977#endif 977#endif
978 if(cur_rem != NOT_A_CARD){ 978 if(cur_rem != NOT_A_CARD){
979 rb->lcd_bitmap(numbers[deck[cur_rem].num], LCD_WIDTH2 - CARD_WIDTH+1, LCD_HEIGHT-CARD_HEIGHT, 8, 8, true); 979 rb->lcd_bitmap(numbers[deck[cur_rem].num], LCD_WIDTH2 - CARD_WIDTH+1, LCD_HEIGHT-CARD_HEIGHT, 8, 8);
980 rb->lcd_bitmap(colors[deck[cur_rem].color], LCD_WIDTH2 - CARD_WIDTH+7, LCD_HEIGHT-CARD_HEIGHT, 8, 8, true); 980 rb->lcd_bitmap(colors[deck[cur_rem].color], LCD_WIDTH2 - CARD_WIDTH+7, LCD_HEIGHT-CARD_HEIGHT, 8, 8);
981 /* draw a selected card */ 981 /* draw a selected card */
982 if(sel_card == cur_rem){ 982 if(sel_card == cur_rem){
983 rb->lcd_drawrect(LCD_WIDTH2 - CARD_WIDTH+1, LCD_HEIGHT-CARD_HEIGHT,CARD_WIDTH-1, CARD_HEIGHT-1); 983 rb->lcd_drawrect(LCD_WIDTH2 - CARD_WIDTH+1, LCD_HEIGHT-CARD_HEIGHT,CARD_WIDTH-1, CARD_HEIGHT-1);
diff --git a/apps/plugins/splitedit.c b/apps/plugins/splitedit.c
index 20a9922a29..e6d8551d63 100644
--- a/apps/plugins/splitedit.c
+++ b/apps/plugins/splitedit.c
@@ -262,18 +262,18 @@ static void update_icons(void)
262 /* The CUT icon */ 262 /* The CUT icon */
263 rb->lcd_bitmap(CUT_BMP, 263 rb->lcd_bitmap(CUT_BMP,
264 LCD_WIDTH / 3 / 2 - BMPWIDTH / 2, LCD_HEIGHT - BMPHEIGHT, 264 LCD_WIDTH / 3 / 2 - BMPWIDTH / 2, LCD_HEIGHT - BMPHEIGHT,
265 BMPWIDTH, BMPHEIGHT, true); 265 BMPWIDTH, BMPHEIGHT);
266 266
267 /* The loop mode icon */ 267 /* The loop mode icon */
268 rb->lcd_bitmap(LOOP_BMP[splitedit_get_loop_mode()], 268 rb->lcd_bitmap(LOOP_BMP[splitedit_get_loop_mode()],
269 LCD_WIDTH/3 + LCD_WIDTH/3 / 2 - BMPWIDTH/2, LCD_HEIGHT - BMPHEIGHT, 269 LCD_WIDTH/3 + LCD_WIDTH/3 / 2 - BMPWIDTH/2, LCD_HEIGHT - BMPHEIGHT,
270 BMPWIDTH, BMPHEIGHT, true); 270 BMPWIDTH, BMPHEIGHT);
271 271
272#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F) 272#if (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
273 /* The scale icon */ 273 /* The scale icon */
274 rb->lcd_bitmap(SCALE_BMP[rb->peak_meter_get_use_dbfs()], 274 rb->lcd_bitmap(SCALE_BMP[rb->peak_meter_get_use_dbfs()],
275 2 *LCD_WIDTH/3 + LCD_WIDTH/3 / 2 - BMPWIDTH/2, LCD_HEIGHT - BMPHEIGHT, 275 2 *LCD_WIDTH/3 + LCD_WIDTH/3 / 2 - BMPWIDTH/2, LCD_HEIGHT - BMPHEIGHT,
276 BMPWIDTH, BMPHEIGHT, true); 276 BMPWIDTH, BMPHEIGHT);
277#else 277#else
278 { 278 {
279 static int idx; 279 static int idx;
@@ -281,7 +281,7 @@ static void update_icons(void)
281 idx = 1 - idx; 281 idx = 1 - idx;
282 rb->lcd_bitmap(SCALE_BMP[idx], 282 rb->lcd_bitmap(SCALE_BMP[idx],
283 2 *LCD_WIDTH/3 + LCD_WIDTH/3 / 2 - BMPWIDTH/2, LCD_HEIGHT - BMPHEIGHT, 283 2 *LCD_WIDTH/3 + LCD_WIDTH/3 / 2 - BMPWIDTH/2, LCD_HEIGHT - BMPHEIGHT,
284 BMPWIDTH, BMPHEIGHT, true); 284 BMPWIDTH, BMPHEIGHT);
285 } 285 }
286#endif 286#endif
287 287
diff --git a/apps/plugins/star.c b/apps/plugins/star.c
index fbaf8aeed6..acf34275be 100644
--- a/apps/plugins/star.c
+++ b/apps/plugins/star.c
@@ -485,10 +485,10 @@ static void star_display_board_info(void)
485 485
486 if (control == STAR_CONTROL_BALL) 486 if (control == STAR_CONTROL_BALL)
487 rb->lcd_bitmap (ball_bmp, 103, label_offset_y + 1, STAR_TILE_SIZE, 487 rb->lcd_bitmap (ball_bmp, 103, label_offset_y + 1, STAR_TILE_SIZE,
488 STAR_TILE_SIZE, true); 488 STAR_TILE_SIZE);
489 else 489 else
490 rb->lcd_bitmap (block_bmp, 103, label_offset_y + 1, STAR_TILE_SIZE, 490 rb->lcd_bitmap (block_bmp, 103, label_offset_y + 1, STAR_TILE_SIZE,
491 STAR_TILE_SIZE, true); 491 STAR_TILE_SIZE);
492 492
493 rb->lcd_update_rect(0, label_offset_y, LCD_WIDTH, char_height); 493 rb->lcd_update_rect(0, label_offset_y, LCD_WIDTH, char_height);
494} 494}
@@ -522,14 +522,14 @@ static int star_load_level(int current_level)
522 rb->lcd_bitmap (wall_bmp, 522 rb->lcd_bitmap (wall_bmp,
523 STAR_OFFSET_X + x * STAR_TILE_SIZE, 523 STAR_OFFSET_X + x * STAR_TILE_SIZE,
524 STAR_OFFSET_Y + y * STAR_TILE_SIZE, 524 STAR_OFFSET_Y + y * STAR_TILE_SIZE,
525 STAR_TILE_SIZE, STAR_TILE_SIZE, false); 525 STAR_TILE_SIZE, STAR_TILE_SIZE);
526 break; 526 break;
527 527
528 case STAR_STAR: 528 case STAR_STAR:
529 rb->lcd_bitmap (star_bmp, 529 rb->lcd_bitmap (star_bmp,
530 STAR_OFFSET_X + x * STAR_TILE_SIZE, 530 STAR_OFFSET_X + x * STAR_TILE_SIZE,
531 STAR_OFFSET_Y + y * STAR_TILE_SIZE, 531 STAR_OFFSET_Y + y * STAR_TILE_SIZE,
532 STAR_TILE_SIZE, STAR_TILE_SIZE, false); 532 STAR_TILE_SIZE, STAR_TILE_SIZE);
533 star_count++; 533 star_count++;
534 break; 534 break;
535 535
@@ -539,7 +539,7 @@ static int star_load_level(int current_level)
539 rb->lcd_bitmap (ball_bmp, 539 rb->lcd_bitmap (ball_bmp,
540 STAR_OFFSET_X + x * STAR_TILE_SIZE, 540 STAR_OFFSET_X + x * STAR_TILE_SIZE,
541 STAR_OFFSET_Y + y * STAR_TILE_SIZE, 541 STAR_OFFSET_Y + y * STAR_TILE_SIZE,
542 STAR_TILE_SIZE, STAR_TILE_SIZE, false); 542 STAR_TILE_SIZE, STAR_TILE_SIZE);
543 break; 543 break;
544 544
545 545
@@ -549,7 +549,7 @@ static int star_load_level(int current_level)
549 rb->lcd_bitmap (block_bmp, 549 rb->lcd_bitmap (block_bmp,
550 STAR_OFFSET_X + x * STAR_TILE_SIZE, 550 STAR_OFFSET_X + x * STAR_TILE_SIZE,
551 STAR_OFFSET_Y + y * STAR_TILE_SIZE, 551 STAR_OFFSET_Y + y * STAR_TILE_SIZE,
552 STAR_TILE_SIZE, STAR_TILE_SIZE, false); 552 STAR_TILE_SIZE, STAR_TILE_SIZE);
553 break; 553 break;
554 } 554 }
555 ptr_tab++; 555 ptr_tab++;
@@ -668,7 +668,7 @@ static int star_run_game(void)
668 ball_bmp, 668 ball_bmp,
669 STAR_OFFSET_X + ball_x * STAR_TILE_SIZE + move_x * i, 669 STAR_OFFSET_X + ball_x * STAR_TILE_SIZE + move_x * i,
670 STAR_OFFSET_Y + ball_y * STAR_TILE_SIZE + move_y * i, 670 STAR_OFFSET_Y + ball_y * STAR_TILE_SIZE + move_y * i,
671 STAR_TILE_SIZE, STAR_TILE_SIZE, true); 671 STAR_TILE_SIZE, STAR_TILE_SIZE);
672 672
673 rb->lcd_update_rect( 673 rb->lcd_update_rect(
674 STAR_OFFSET_X + ball_x * STAR_TILE_SIZE + move_x * i, 674 STAR_OFFSET_X + ball_x * STAR_TILE_SIZE + move_x * i,
@@ -700,7 +700,7 @@ static int star_run_game(void)
700 block_bmp, 700 block_bmp,
701 STAR_OFFSET_X + block_x * STAR_TILE_SIZE + move_x * i, 701 STAR_OFFSET_X + block_x * STAR_TILE_SIZE + move_x * i,
702 STAR_OFFSET_Y + block_y * STAR_TILE_SIZE + move_y * i, 702 STAR_OFFSET_Y + block_y * STAR_TILE_SIZE + move_y * i,
703 STAR_TILE_SIZE, STAR_TILE_SIZE, true); 703 STAR_TILE_SIZE, STAR_TILE_SIZE);
704 704
705 rb->lcd_update_rect( 705 rb->lcd_update_rect(
706 STAR_OFFSET_X + block_x * STAR_TILE_SIZE + move_x * i, 706 STAR_OFFSET_X + block_x * STAR_TILE_SIZE + move_x * i,
@@ -766,7 +766,7 @@ static int star_menu(void)
766 766
767 move_y = 0; 767 move_y = 0;
768 rb->lcd_bitmap(arrow_bmp[anim_arrow[(anim_state & 0x38) >> 3]], 768 rb->lcd_bitmap(arrow_bmp[anim_arrow[(anim_state & 0x38) >> 3]],
769 2, menu_offset_y + menu_y * char_height, 7, 8, true); 769 2, menu_offset_y + menu_y * char_height, 7, 8);
770 rb->lcd_update_rect (2, menu_offset_y + menu_y * 8, 8, 8); 770 rb->lcd_update_rect (2, menu_offset_y + menu_y * 8, 8, 8);
771 rb->sleep(STAR_SLEEP); 771 rb->sleep(STAR_SLEEP);
772 anim_state++; 772 anim_state++;
@@ -840,14 +840,14 @@ static int star_menu(void)
840 { 840 {
841 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); 841 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
842 rb->lcd_fillrect (2, 30, 7, 4 * 8); 842 rb->lcd_fillrect (2, 30, 7, 4 * 8);
843 rb->lcd_set_drawmode(DRMODE_SOLID); 843 rb->lcd_set_drawmode(DRMODE_FG);
844 rb->lcd_bitmap(arrow_bmp[anim_arrow[(anim_state & 0x38) >> 3]], 844 rb->lcd_bitmap(arrow_bmp[anim_arrow[(anim_state & 0x38) >> 3]],
845 2, menu_offset_y + menu_y * 8 + move_y * i, 7, 8, 845 2, menu_offset_y + menu_y * 8 + move_y * i, 7, 8);
846 false);
847 rb->lcd_update_rect(2, 30, 8, 4 * 8); 846 rb->lcd_update_rect(2, 30, 8, 4 * 8);
848 anim_state++; 847 anim_state++;
849 rb->sleep(STAR_SLEEP); 848 rb->sleep(STAR_SLEEP);
850 } 849 }
850 rb->lcd_set_drawmode(DRMODE_SOLID);
851 menu_y += move_y; 851 menu_y += move_y;
852 } 852 }
853} 853}
diff --git a/apps/plugins/vu_meter.c b/apps/plugins/vu_meter.c
index 1a6f723292..d54f86de06 100644
--- a/apps/plugins/vu_meter.c
+++ b/apps/plugins/vu_meter.c
@@ -278,47 +278,55 @@ void change_settings(void)
278} 278}
279 279
280void draw_analog_minimeters(void) { 280void draw_analog_minimeters(void) {
281 rb->lcd_bitmap(sound_speaker, 0, 12, 4, 8, true); 281 rb->lcd_bitmap(sound_speaker, 0, 12, 4, 8);
282 rb->lcd_set_drawmode(DRMODE_FG);
282 if(5<left_needle_top_x) 283 if(5<left_needle_top_x)
283 rb->lcd_bitmap(sound_low_level, 5, 12, 2, 8, false); 284 rb->lcd_bitmap(sound_low_level, 5, 12, 2, 8);
284 if(12<left_needle_top_x) 285 if(12<left_needle_top_x)
285 rb->lcd_bitmap(sound_med_level, 7, 12, 2, 8, false); 286 rb->lcd_bitmap(sound_med_level, 7, 12, 2, 8);
286 if(24<left_needle_top_x) 287 if(24<left_needle_top_x)
287 rb->lcd_bitmap(sound_high_level, 9, 12, 2, 8, false); 288 rb->lcd_bitmap(sound_high_level, 9, 12, 2, 8);
288 if(40<left_needle_top_x) 289 if(40<left_needle_top_x)
289 rb->lcd_bitmap(sound_max_level, 12, 12, 3, 8, false); 290 rb->lcd_bitmap(sound_max_level, 12, 12, 3, 8);
290 291
291 rb->lcd_bitmap(sound_speaker, 54, 12, 4, 8, true); 292 rb->lcd_set_drawmode(DRMODE_SOLID);
293 rb->lcd_bitmap(sound_speaker, 54, 12, 4, 8);
294 rb->lcd_set_drawmode(DRMODE_FG);
292 if(5<(right_needle_top_x-56)) 295 if(5<(right_needle_top_x-56))
293 rb->lcd_bitmap(sound_low_level, 59, 12, 2, 8, false); 296 rb->lcd_bitmap(sound_low_level, 59, 12, 2, 8);
294 if(12<(right_needle_top_x-56)) 297 if(12<(right_needle_top_x-56))
295 rb->lcd_bitmap(sound_med_level, 61, 12, 2, 8, false); 298 rb->lcd_bitmap(sound_med_level, 61, 12, 2, 8);
296 if(24<(right_needle_top_x-56)) 299 if(24<(right_needle_top_x-56))
297 rb->lcd_bitmap(sound_high_level, 63, 12, 2, 8, false); 300 rb->lcd_bitmap(sound_high_level, 63, 12, 2, 8);
298 if(40<(right_needle_top_x-56)) 301 if(40<(right_needle_top_x-56))
299 rb->lcd_bitmap(sound_max_level, 66, 12, 3, 8, false); 302 rb->lcd_bitmap(sound_max_level, 66, 12, 3, 8);
303 rb->lcd_set_drawmode(DRMODE_SOLID);
300} 304}
301 305
302void draw_digital_minimeters(void) { 306void draw_digital_minimeters(void) {
303 rb->lcd_bitmap(sound_speaker, 34, 24, 4, 8, true); 307 rb->lcd_bitmap(sound_speaker, 34, 24, 4, 8);
308 rb->lcd_set_drawmode(DRMODE_FG);
304 if(1<num_left_leds) 309 if(1<num_left_leds)
305 rb->lcd_bitmap(sound_low_level, 39, 24, 2, 8, false); 310 rb->lcd_bitmap(sound_low_level, 39, 24, 2, 8);
306 if(2<num_left_leds) 311 if(2<num_left_leds)
307 rb->lcd_bitmap(sound_med_level, 41, 24, 2, 8, false); 312 rb->lcd_bitmap(sound_med_level, 41, 24, 2, 8);
308 if(5<num_left_leds) 313 if(5<num_left_leds)
309 rb->lcd_bitmap(sound_high_level, 43, 24, 2, 8, false); 314 rb->lcd_bitmap(sound_high_level, 43, 24, 2, 8);
310 if(8<num_left_leds) 315 if(8<num_left_leds)
311 rb->lcd_bitmap(sound_max_level, 46, 24, 3, 8, false); 316 rb->lcd_bitmap(sound_max_level, 46, 24, 3, 8);
312 317
313 rb->lcd_bitmap(sound_speaker, 34, 40, 4, 8, true); 318 rb->lcd_set_drawmode(DRMODE_SOLID);
319 rb->lcd_bitmap(sound_speaker, 34, 40, 4, 8);
320 rb->lcd_set_drawmode(DRMODE_FG);
314 if(1<(num_right_leds)) 321 if(1<(num_right_leds))
315 rb->lcd_bitmap(sound_low_level, 39, 40, 2, 8, false); 322 rb->lcd_bitmap(sound_low_level, 39, 40, 2, 8);
316 if(2<(num_right_leds)) 323 if(2<(num_right_leds))
317 rb->lcd_bitmap(sound_med_level, 41, 40, 2, 8, false); 324 rb->lcd_bitmap(sound_med_level, 41, 40, 2, 8);
318 if(5<(num_right_leds)) 325 if(5<(num_right_leds))
319 rb->lcd_bitmap(sound_high_level, 43, 40, 2, 8, false); 326 rb->lcd_bitmap(sound_high_level, 43, 40, 2, 8);
320 if(8<(num_right_leds)) 327 if(8<(num_right_leds))
321 rb->lcd_bitmap(sound_max_level, 46, 40, 3, 8, false); 328 rb->lcd_bitmap(sound_max_level, 46, 40, 3, 8);
329 rb->lcd_set_drawmode(DRMODE_SOLID);
322} 330}
323 331
324void analog_meter(void) { 332void analog_meter(void) {
@@ -350,8 +358,10 @@ void analog_meter(void) {
350 draw_analog_minimeters(); 358 draw_analog_minimeters();
351 359
352 /* Needle covers */ 360 /* Needle covers */
353 rb->lcd_bitmap(needle_cover, 22, 59, 13, 5, false); 361 rb->lcd_set_drawmode(DRMODE_FG);
354 rb->lcd_bitmap(needle_cover, 78, 59, 13, 5, false); 362 rb->lcd_bitmap(needle_cover, 22, 59, 13, 5);
363 rb->lcd_bitmap(needle_cover, 78, 59, 13, 5);
364 rb->lcd_set_drawmode(DRMODE_SOLID);
355 365
356 /* Show Left/Right */ 366 /* Show Left/Right */
357 rb->lcd_putsxy(16, 12, "Left"); 367 rb->lcd_putsxy(16, 12, "Left");
@@ -383,12 +393,15 @@ void digital_meter(void) {
383 last_num_left_leds = num_left_leds; 393 last_num_left_leds = num_left_leds;
384 last_num_right_leds = num_right_leds; 394 last_num_right_leds = num_right_leds;
385 395
396 rb->lcd_set_drawmode(DRMODE_FG);
386 /* LEDS */ 397 /* LEDS */
387 for(i=0; i<num_left_leds; i++) 398 for(i=0; i<num_left_leds; i++)
388 rb->lcd_bitmap(led, i*9+2+i, 14, 9, 5, false); 399 rb->lcd_bitmap(led, i*9+2+i, 14, 9, 5);
389 400
390 for(i=0; i<num_right_leds; i++) 401 for(i=0; i<num_right_leds; i++)
391 rb->lcd_bitmap(led, i*9+2+i, 52, 9, 5, false); 402 rb->lcd_bitmap(led, i*9+2+i, 52, 9, 5);
403
404 rb->lcd_set_drawmode(DRMODE_SOLID);
392 405
393 if(settings.digital_minimeters) 406 if(settings.digital_minimeters)
394 draw_digital_minimeters(); 407 draw_digital_minimeters();
diff --git a/apps/recorder/icons.c b/apps/recorder/icons.c
index a10f2e1699..7a5a7bd8f7 100644
--- a/apps/recorder/icons.c
+++ b/apps/recorder/icons.c
@@ -323,7 +323,7 @@ bool statusbar_icon_volume(int percent)
323 if (volume==0) { 323 if (volume==0) {
324 lcd_bitmap(bitmap_icons_7x8[Icon_Mute], 324 lcd_bitmap(bitmap_icons_7x8[Icon_Mute],
325 ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 - 4, 325 ICON_VOLUME_X_POS + ICON_VOLUME_WIDTH / 2 - 4,
326 STATUSBAR_Y_POS, 7, STATUSBAR_HEIGHT, false); 326 STATUSBAR_Y_POS, 7, STATUSBAR_HEIGHT);
327 } 327 }
328 else { 328 else {
329 /* We want to redraw the icon later on */ 329 /* We want to redraw the icon later on */
@@ -371,7 +371,7 @@ bool statusbar_icon_volume(int percent)
371void statusbar_icon_play_state(int state) 371void statusbar_icon_play_state(int state)
372{ 372{
373 lcd_bitmap(bitmap_icons_7x8[state], ICON_PLAY_STATE_X_POS, STATUSBAR_Y_POS, 373 lcd_bitmap(bitmap_icons_7x8[state], ICON_PLAY_STATE_X_POS, STATUSBAR_Y_POS,
374 ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT, false); 374 ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT);
375} 375}
376 376
377/* 377/*
@@ -380,7 +380,7 @@ void statusbar_icon_play_state(int state)
380void statusbar_icon_play_mode(int mode) 380void statusbar_icon_play_mode(int mode)
381{ 381{
382 lcd_bitmap(bitmap_icons_7x8[mode], ICON_PLAY_MODE_X_POS, STATUSBAR_Y_POS, 382 lcd_bitmap(bitmap_icons_7x8[mode], ICON_PLAY_MODE_X_POS, STATUSBAR_Y_POS,
383 ICON_PLAY_MODE_WIDTH, STATUSBAR_HEIGHT, false); 383 ICON_PLAY_MODE_WIDTH, STATUSBAR_HEIGHT);
384} 384}
385 385
386/* 386/*
@@ -389,7 +389,7 @@ void statusbar_icon_play_mode(int mode)
389void statusbar_icon_shuffle(void) 389void statusbar_icon_shuffle(void)
390{ 390{
391 lcd_bitmap(bitmap_icons_7x8[Icon_Shuffle], ICON_SHUFFLE_X_POS, 391 lcd_bitmap(bitmap_icons_7x8[Icon_Shuffle], ICON_SHUFFLE_X_POS,
392 STATUSBAR_Y_POS, ICON_SHUFFLE_WIDTH, STATUSBAR_HEIGHT, false); 392 STATUSBAR_Y_POS, ICON_SHUFFLE_WIDTH, STATUSBAR_HEIGHT);
393} 393}
394 394
395/* 395/*
@@ -398,7 +398,7 @@ void statusbar_icon_shuffle(void)
398void statusbar_icon_lock(void) 398void statusbar_icon_lock(void)
399{ 399{
400 lcd_bitmap(bitmap_icons_5x8[Icon_Lock], LOCK_X_POS, 400 lcd_bitmap(bitmap_icons_5x8[Icon_Lock], LOCK_X_POS,
401 STATUSBAR_Y_POS, 5, 8, false); 401 STATUSBAR_Y_POS, 5, 8);
402} 402}
403 403
404#if CONFIG_LED == LED_VIRTUAL 404#if CONFIG_LED == LED_VIRTUAL
@@ -408,7 +408,7 @@ void statusbar_icon_lock(void)
408void statusbar_led(void) 408void statusbar_led(void)
409{ 409{
410 lcd_bitmap(bitmap_icon_disk, ICON_DISK_X_POS, 410 lcd_bitmap(bitmap_icon_disk, ICON_DISK_X_POS,
411 STATUSBAR_Y_POS, ICON_DISK_WIDTH, STATUSBAR_HEIGHT, false); 411 STATUSBAR_Y_POS, ICON_DISK_WIDTH, STATUSBAR_HEIGHT);
412} 412}
413#endif 413#endif
414 414
diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c
index 779200cb85..3bab002574 100644
--- a/apps/recorder/peakmeter.c
+++ b/apps/recorder/peakmeter.c
@@ -1108,7 +1108,7 @@ void peak_meter_draw_trig(int xpos, int ypos) {
1108 scrollbar(x, ypos + 1, TRIGBAR_WIDTH, TRIG_HEIGHT - 2, 1108 scrollbar(x, ypos + 1, TRIGBAR_WIDTH, TRIG_HEIGHT - 2,
1109 TRIGBAR_WIDTH, 0, 0, HORIZONTAL); 1109 TRIGBAR_WIDTH, 0, 0, HORIZONTAL);
1110 lcd_bitmap(bitmap_icons_7x8[Icon_Stop], xpos, ypos, 1110 lcd_bitmap(bitmap_icons_7x8[Icon_Stop], xpos, ypos,
1111 ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT, false); 1111 ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT);
1112 break; 1112 break;
1113 1113
1114 case TRIG_STEADY: 1114 case TRIG_STEADY:
@@ -1118,7 +1118,7 @@ void peak_meter_draw_trig(int xpos, int ypos) {
1118 scrollbar(x, ypos + 1, TRIGBAR_WIDTH, TRIG_HEIGHT - 2, 1118 scrollbar(x, ypos + 1, TRIGBAR_WIDTH, TRIG_HEIGHT - 2,
1119 TRIGBAR_WIDTH, 0, TRIGBAR_WIDTH - time_left, HORIZONTAL); 1119 TRIGBAR_WIDTH, 0, TRIGBAR_WIDTH - time_left, HORIZONTAL);
1120 lcd_bitmap(bitmap_icons_7x8[Icon_Stop], xpos, ypos, 1120 lcd_bitmap(bitmap_icons_7x8[Icon_Stop], xpos, ypos,
1121 ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT, false); 1121 ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT);
1122 break; 1122 break;
1123 1123
1124 case TRIG_GO: 1124 case TRIG_GO:
@@ -1127,7 +1127,7 @@ void peak_meter_draw_trig(int xpos, int ypos) {
1127 TRIGBAR_WIDTH, TRIGBAR_WIDTH, TRIGBAR_WIDTH, HORIZONTAL); 1127 TRIGBAR_WIDTH, TRIGBAR_WIDTH, TRIGBAR_WIDTH, HORIZONTAL);
1128 lcd_bitmap(bitmap_icons_7x8[Icon_Record], 1128 lcd_bitmap(bitmap_icons_7x8[Icon_Record],
1129 TRIG_WIDTH - ICON_PLAY_STATE_WIDTH, ypos, 1129 TRIG_WIDTH - ICON_PLAY_STATE_WIDTH, ypos,
1130 ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT, false); 1130 ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT);
1131 break; 1131 break;
1132 1132
1133 case TRIG_POSTREC: 1133 case TRIG_POSTREC:
@@ -1137,7 +1137,7 @@ void peak_meter_draw_trig(int xpos, int ypos) {
1137 TRIGBAR_WIDTH, time_left, TRIGBAR_WIDTH, HORIZONTAL); 1137 TRIGBAR_WIDTH, time_left, TRIGBAR_WIDTH, HORIZONTAL);
1138 lcd_bitmap(bitmap_icons_7x8[Icon_Record], 1138 lcd_bitmap(bitmap_icons_7x8[Icon_Record],
1139 TRIG_WIDTH - ICON_PLAY_STATE_WIDTH, ypos, 1139 TRIG_WIDTH - ICON_PLAY_STATE_WIDTH, ypos,
1140 ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT, false); 1140 ICON_PLAY_STATE_WIDTH, STATUSBAR_HEIGHT);
1141 break; 1141 break;
1142 } 1142 }
1143 1143
diff --git a/apps/recorder/recording.c b/apps/recorder/recording.c
index 84c90d2d86..9e58cec19e 100644
--- a/apps/recorder/recording.c
+++ b/apps/recorder/recording.c
@@ -870,7 +870,7 @@ bool f2_rec_screen(void)
870 snprintf(buf, 32, "%d", global_settings.rec_quality); 870 snprintf(buf, 32, "%d", global_settings.rec_quality);
871 lcd_putsxy(0, LCD_HEIGHT/2-h, buf); 871 lcd_putsxy(0, LCD_HEIGHT/2-h, buf);
872 lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], 872 lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward],
873 LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true); 873 LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8);
874 874
875 /* Frequency */ 875 /* Frequency */
876 snprintf(buf, sizeof buf, "%s:", str(LANG_RECORDING_FREQUENCY)); 876 snprintf(buf, sizeof buf, "%s:", str(LANG_RECORDING_FREQUENCY));
@@ -880,7 +880,7 @@ bool f2_rec_screen(void)
880 lcd_getstringsize(ptr, &w, &h); 880 lcd_getstringsize(ptr, &w, &h);
881 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr); 881 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr);
882 lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow], 882 lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow],
883 LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true); 883 LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8);
884 884
885 /* Channel mode */ 885 /* Channel mode */
886 switch ( global_settings.rec_channels ) { 886 switch ( global_settings.rec_channels ) {
@@ -901,7 +901,7 @@ bool f2_rec_screen(void)
901 lcd_getstringsize(ptr, &w, &h); 901 lcd_getstringsize(ptr, &w, &h);
902 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2, ptr); 902 lcd_putsxy(LCD_WIDTH - w, LCD_HEIGHT/2, ptr);
903 lcd_bitmap(bitmap_icons_7x8[Icon_FastForward], 903 lcd_bitmap(bitmap_icons_7x8[Icon_FastForward],
904 LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8, true); 904 LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8);
905 905
906 lcd_update(); 906 lcd_update();
907 907
@@ -995,14 +995,14 @@ bool f3_rec_screen(void)
995 lcd_getstringsize(ptr, &w, &h); 995 lcd_getstringsize(ptr, &w, &h);
996 lcd_putsxy(0, LCD_HEIGHT/2-h, ptr); 996 lcd_putsxy(0, LCD_HEIGHT/2-h, ptr);
997 lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], 997 lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward],
998 LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true); 998 LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8);
999 999
1000 /* trigger setup */ 1000 /* trigger setup */
1001 ptr = str(LANG_RECORD_TRIGGER); 1001 ptr = str(LANG_RECORD_TRIGGER);
1002 lcd_getstringsize(ptr,&w,&h); 1002 lcd_getstringsize(ptr,&w,&h);
1003 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, ptr); 1003 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h*2, ptr);
1004 lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow], 1004 lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow],
1005 LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true); 1005 LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8);
1006 1006
1007 lcd_update(); 1007 lcd_update();
1008 1008
diff --git a/apps/screens.c b/apps/screens.c
index 6849384cda..04a32813d1 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -94,7 +94,9 @@ void usb_display_info(void)
94 94
95#ifdef HAVE_LCD_BITMAP 95#ifdef HAVE_LCD_BITMAP
96 /* Center bitmap on screen */ 96 /* Center bitmap on screen */
97 lcd_bitmap(usb_logo, LCD_WIDTH/2-BMPWIDTH_usb_logo/2, LCD_HEIGHT/2-BMPHEIGHT_usb_logo/2, BMPWIDTH_usb_logo, BMPHEIGHT_usb_logo, false); 97 lcd_bitmap(usb_logo, LCD_WIDTH/2-BMPWIDTH_usb_logo/2,
98 LCD_HEIGHT/2-BMPHEIGHT_usb_logo/2, BMPWIDTH_usb_logo,
99 BMPHEIGHT_usb_logo);
98 status_draw(true); 100 status_draw(true);
99 lcd_update(); 101 lcd_update();
100#else 102#else
@@ -231,14 +233,16 @@ void charging_display_info(bool animate)
231 if (!animate) 233 if (!animate)
232 { /* draw the outline */ 234 { /* draw the outline */
233 /* middle part */ 235 /* middle part */
234 lcd_bitmap(charging_logo, pox_x, pox_y + 8, sizeof(charging_logo), 8, true); 236 lcd_bitmap(charging_logo, pox_x, pox_y + 8, sizeof(charging_logo), 8);
237 lcd_set_drawmode(DRMODE_FG);
235 /* upper line */ 238 /* upper line */
236 charging_logo[0] = charging_logo[1] = 0x00; 239 charging_logo[0] = charging_logo[1] = 0x00;
237 memset(charging_logo+2, 0x80, 34); 240 memset(charging_logo+2, 0x80, 34);
238 lcd_bitmap(charging_logo, pox_x, pox_y, sizeof(charging_logo), 8, false); 241 lcd_bitmap(charging_logo, pox_x, pox_y, sizeof(charging_logo), 8);
239 /* lower line */ 242 /* lower line */
240 memset(charging_logo+2, 0x01, 34); 243 memset(charging_logo+2, 0x01, 34);
241 lcd_bitmap(charging_logo, pox_x, pox_y + 16, sizeof(charging_logo), 8, false); 244 lcd_bitmap(charging_logo, pox_x, pox_y + 16, sizeof(charging_logo), 8);
245 lcd_set_drawmode(DRMODE_SOLID);
242 } 246 }
243 else 247 else
244 { /* animate the middle part */ 248 { /* animate the middle part */
@@ -253,7 +257,7 @@ void charging_display_info(bool animate)
253 charging_logo[i] = 0x01 << bitpos; 257 charging_logo[i] = 0x01 << bitpos;
254 } 258 }
255 } 259 }
256 lcd_bitmap(charging_logo, pox_x, pox_y + 8, sizeof(charging_logo), 8, true); 260 lcd_bitmap(charging_logo, pox_x, pox_y + 8, sizeof(charging_logo), 8);
257 phase++; 261 phase++;
258 } 262 }
259 lcd_update(); 263 lcd_update();
@@ -411,7 +415,7 @@ int pitch_screen(void)
411 lcd_getstringsize(ptr,&w,&h); 415 lcd_getstringsize(ptr,&w,&h);
412 lcd_putsxy((LCD_WIDTH-w)/2, 0, ptr); 416 lcd_putsxy((LCD_WIDTH-w)/2, 0, ptr);
413 lcd_bitmap(bitmap_icons_7x8[Icon_UpArrow], 417 lcd_bitmap(bitmap_icons_7x8[Icon_UpArrow],
414 LCD_WIDTH/2 - 3, h*2, 7, 8, true); 418 LCD_WIDTH/2 - 3, h*2, 7, 8);
415 419
416 snprintf(buf, sizeof buf, "%d.%d%%", pitch / 10, pitch % 10 ); 420 snprintf(buf, sizeof buf, "%d.%d%%", pitch / 10, pitch % 10 );
417 lcd_getstringsize(buf,&w,&h); 421 lcd_getstringsize(buf,&w,&h);
@@ -421,13 +425,13 @@ int pitch_screen(void)
421 lcd_getstringsize(ptr,&w,&h); 425 lcd_getstringsize(ptr,&w,&h);
422 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr); 426 lcd_putsxy((LCD_WIDTH-w)/2, LCD_HEIGHT - h, ptr);
423 lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow], 427 lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow],
424 LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true); 428 LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8);
425 429
426 ptr = str(LANG_PAUSE); 430 ptr = str(LANG_PAUSE);
427 lcd_getstringsize(ptr,&w,&h); 431 lcd_getstringsize(ptr,&w,&h);
428 lcd_putsxy((LCD_WIDTH-(w/2))/2, LCD_HEIGHT/2 - h/2, ptr); 432 lcd_putsxy((LCD_WIDTH-(w/2))/2, LCD_HEIGHT/2 - h/2, ptr);
429 lcd_bitmap(bitmap_icons_7x8[Icon_Pause], 433 lcd_bitmap(bitmap_icons_7x8[Icon_Pause],
430 (LCD_WIDTH-(w/2))/2-10, LCD_HEIGHT/2 - h/2, 7, 8, true); 434 (LCD_WIDTH-(w/2))/2-10, LCD_HEIGHT/2 - h/2, 7, 8);
431 435
432 lcd_update(); 436 lcd_update();
433 } 437 }
@@ -632,11 +636,11 @@ bool quick_screen(int context, int button)
632 } 636 }
633 637
634 lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward], 638 lcd_bitmap(bitmap_icons_7x8[Icon_FastBackward],
635 LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8, true); 639 LCD_WIDTH/2 - 16, LCD_HEIGHT/2 - 4, 7, 8);
636 lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow], 640 lcd_bitmap(bitmap_icons_7x8[Icon_DownArrow],
637 LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8, true); 641 LCD_WIDTH/2 - 3, LCD_HEIGHT - h*3, 7, 8);
638 lcd_bitmap(bitmap_icons_7x8[Icon_FastForward], 642 lcd_bitmap(bitmap_icons_7x8[Icon_FastForward],
639 LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8, true); 643 LCD_WIDTH/2 + 8, LCD_HEIGHT/2 - 4, 7, 8);
640 644
641 lcd_update(); 645 lcd_update();
642 key = button_get(true); 646 key = button_get(true);
diff --git a/apps/status.c b/apps/status.c
index 535337e8c1..03a69dd210 100644
--- a/apps/status.c
+++ b/apps/status.c
@@ -245,11 +245,11 @@ void status_draw(bool force_redraw)
245 /* draw power plug if charging */ 245 /* draw power plug if charging */
246 if (info.inserted) 246 if (info.inserted)
247 lcd_bitmap(bitmap_icons_7x8[Icon_Plug], ICON_PLUG_X_POS, 247 lcd_bitmap(bitmap_icons_7x8[Icon_Plug], ICON_PLUG_X_POS,
248 STATUSBAR_Y_POS, ICON_PLUG_WIDTH, STATUSBAR_HEIGHT, false); 248 STATUSBAR_Y_POS, ICON_PLUG_WIDTH, STATUSBAR_HEIGHT);
249#ifdef HAVE_USB_POWER 249#ifdef HAVE_USB_POWER
250 else if (info.usb_power) 250 else if (info.usb_power)
251 lcd_bitmap(bitmap_icons_7x8[Icon_USBPlug], ICON_PLUG_X_POS, 251 lcd_bitmap(bitmap_icons_7x8[Icon_USBPlug], ICON_PLUG_X_POS,
252 STATUSBAR_Y_POS, ICON_PLUG_WIDTH, STATUSBAR_HEIGHT, false); 252 STATUSBAR_Y_POS, ICON_PLUG_WIDTH, STATUSBAR_HEIGHT);
253#endif 253#endif
254 254
255 info.redraw_volume = statusbar_icon_volume(info.volume); 255 info.redraw_volume = statusbar_icon_volume(info.volume);
diff --git a/apps/tree.c b/apps/tree.c
index 66a163ab8e..6d25203eac 100644
--- a/apps/tree.c
+++ b/apps/tree.c
@@ -395,8 +395,7 @@ static int showdir(void)
395 offset = (line_height - 8) / 2; 395 offset = (line_height - 8) / 2;
396 lcd_bitmap(icon, 396 lcd_bitmap(icon,
397 CURSOR_X * 6 + CURSOR_WIDTH, 397 CURSOR_X * 6 + CURSOR_WIDTH,
398 MARGIN_Y+(i-start)*line_height + offset, 398 MARGIN_Y+(i-start)*line_height + offset, 6, 8);
399 6, 8, true);
400#else 399#else
401 if (icon < 0 ) 400 if (icon < 0 )
402 icon = Unknown; 401 icon = Unknown;
diff --git a/apps/wps-display.c b/apps/wps-display.c
index 1b7b76547a..841196f46a 100644
--- a/apps/wps-display.c
+++ b/apps/wps-display.c
@@ -112,11 +112,13 @@ static bool wps_loaded = false;
112/* Display images */ 112/* Display images */
113static void wps_display_images(void) { 113static void wps_display_images(void) {
114 int n; 114 int n;
115 lcd_set_drawmode(DRMODE_FG);
115 for (n = 0; n < MAX_IMAGES; n++) { 116 for (n = 0; n < MAX_IMAGES; n++) {
116 if (img[n].loaded) { 117 if (img[n].loaded) {
117 lcd_bitmap(img[n].ptr, img[n].x, img[n].y, img[n].w, img[n].h, false); 118 lcd_bitmap(img[n].ptr, img[n].x, img[n].y, img[n].w, img[n].h);
118 } 119 }
119 } 120 }
121 lcd_set_drawmode(DRMODE_SOLID);
120} 122}
121#endif 123#endif
122 124
diff --git a/firmware/drivers/lcd-h100.c b/firmware/drivers/lcd-h100.c
index 15cb351195..616a8521b0 100644
--- a/firmware/drivers/lcd-h100.c
+++ b/firmware/drivers/lcd-h100.c
@@ -208,19 +208,19 @@ void lcd_init(void)
208/*** update functions ***/ 208/*** update functions ***/
209 209
210/* Performance function that works with an external buffer 210/* Performance function that works with an external buffer
211 note that y and height are in 8-pixel units! */ 211 note that by and bheight are in 8-pixel units! */
212void lcd_blit(const unsigned char* p_data, int x, int y, int width, 212void lcd_blit(const unsigned char* data, int x, int by, int width,
213 int height, int stride) 213 int bheight, int stride)
214{ 214{
215 /* Copy display bitmap to hardware */ 215 /* Copy display bitmap to hardware */
216 while (height--) 216 while (bheight--)
217 { 217 {
218 lcd_write_command_ex(LCD_CNTL_PAGE, y++ & 0xf, -1); 218 lcd_write_command_ex(LCD_CNTL_PAGE, by++ & 0xf, -1);
219 lcd_write_command_ex(LCD_CNTL_COLUMN, x, -1); 219 lcd_write_command_ex(LCD_CNTL_COLUMN, x, -1);
220 220
221 lcd_write_command(LCD_CNTL_DATA_WRITE); 221 lcd_write_command(LCD_CNTL_DATA_WRITE);
222 lcd_write_data(p_data, width); 222 lcd_write_data(data, width);
223 p_data += stride; 223 data += stride;
224 } 224 }
225} 225}
226 226
@@ -245,16 +245,16 @@ void lcd_update(void)
245 245
246/* Update a fraction of the display. */ 246/* Update a fraction of the display. */
247void lcd_update_rect(int, int, int, int) __attribute__ ((section (".icode"))); 247void lcd_update_rect(int, int, int, int) __attribute__ ((section (".icode")));
248void lcd_update_rect(int x_start, int y, int width, int height) 248void lcd_update_rect(int x, int y, int width, int height)
249{ 249{
250 int ymax; 250 int ymax;
251 251
252 /* The Y coordinates have to work on even 8 pixel rows */ 252 /* The Y coordinates have to work on even 8 pixel rows */
253 ymax = (y + height-1)/8; 253 ymax = (y + height-1) >> 3;
254 y /= 8; 254 y >>= 3;
255 255
256 if(x_start + width > LCD_WIDTH) 256 if(x + width > LCD_WIDTH)
257 width = LCD_WIDTH - x_start; 257 width = LCD_WIDTH - x;
258 if (width <= 0) 258 if (width <= 0)
259 return; /* nothing left to do, 0 is harmful to lcd_write_data() */ 259 return; /* nothing left to do, 0 is harmful to lcd_write_data() */
260 if(ymax >= LCD_HEIGHT/8) 260 if(ymax >= LCD_HEIGHT/8)
@@ -264,10 +264,10 @@ void lcd_update_rect(int x_start, int y, int width, int height)
264 for (; y <= ymax; y++) 264 for (; y <= ymax; y++)
265 { 265 {
266 lcd_write_command_ex(LCD_CNTL_PAGE, y, -1); 266 lcd_write_command_ex(LCD_CNTL_PAGE, y, -1);
267 lcd_write_command_ex(LCD_CNTL_COLUMN, x_start, -1); 267 lcd_write_command_ex(LCD_CNTL_COLUMN, x, -1);
268 268
269 lcd_write_command(LCD_CNTL_DATA_WRITE); 269 lcd_write_command(LCD_CNTL_DATA_WRITE);
270 lcd_write_data (&lcd_framebuffer[y][x_start], width); 270 lcd_write_data (&lcd_framebuffer[y][x], width);
271 } 271 }
272} 272}
273#endif /* !SIMULATOR */ 273#endif /* !SIMULATOR */
@@ -333,8 +333,10 @@ static void nopixel(int x, int y)
333 (void)y; 333 (void)y;
334} 334}
335 335
336lcd_pixelfunc_type* pixelfunc[8] = {flippixel, nopixel, setpixel, setpixel, 336lcd_pixelfunc_type* pixelfunc[8] = {
337 nopixel, clearpixel, nopixel, clearpixel}; 337 flippixel, nopixel, setpixel, setpixel,
338 nopixel, clearpixel, nopixel, clearpixel
339};
338 340
339static void flipblock(unsigned char *address, unsigned mask, unsigned bits) 341static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
340{ 342{
@@ -356,7 +358,30 @@ static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
356 *address = (*address & ~mask) | (bits & mask); 358 *address = (*address & ~mask) | (bits & mask);
357} 359}
358 360
359lcd_blockfunc_type* blockfunc[4] = {flipblock, bgblock, fgblock, solidblock}; 361static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits)
362{
363 *address ^= (~bits & mask);
364}
365
366static void bginvblock(unsigned char *address, unsigned mask, unsigned bits)
367{
368 *address &= ~(bits & mask);
369}
370
371static void fginvblock(unsigned char *address, unsigned mask, unsigned bits)
372{
373 *address |= (~bits & mask);
374}
375
376static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
377{
378 *address = (*address & ~mask) | (~bits & mask);
379}
380
381lcd_blockfunc_type* blockfunc[8] = {
382 flipblock, bgblock, fgblock, solidblock,
383 flipinvblock, bginvblock, fginvblock, solidinvblock
384};
360 385
361/*** drawing functions ***/ 386/*** drawing functions ***/
362 387
@@ -452,7 +477,7 @@ void lcd_hline(int x1, int x2, int y)
452{ 477{
453 int x; 478 int x;
454 unsigned char *dst; 479 unsigned char *dst;
455 unsigned char mask, bits; 480 unsigned mask;
456 lcd_blockfunc_type *bfunc; 481 lcd_blockfunc_type *bfunc;
457 482
458 /* direction flip */ 483 /* direction flip */
@@ -473,13 +498,12 @@ void lcd_hline(int x1, int x2, int y)
473 if (x2 >= LCD_WIDTH) 498 if (x2 >= LCD_WIDTH)
474 x2 = LCD_WIDTH-1; 499 x2 = LCD_WIDTH-1;
475 500
476 bfunc = blockfunc[drawmode & ~DRMODE_INVERSEVID]; 501 bfunc = blockfunc[drawmode];
477 bits = (drawmode & DRMODE_INVERSEVID) ? 0x00 : 0xFFu; 502 dst = &lcd_framebuffer[y>>3][x1];
478 dst = &lcd_framebuffer[y/8][x1];
479 mask = 1 << (y & 7); 503 mask = 1 << (y & 7);
480 504
481 for (x = x1; x <= x2; x++) 505 for (x = x1; x <= x2; x++)
482 bfunc(dst++, mask, bits); 506 bfunc(dst++, mask, 0xFFu);
483} 507}
484 508
485/* Draw a vertical line (optimised) */ 509/* Draw a vertical line (optimised) */
@@ -487,7 +511,7 @@ void lcd_vline(int x, int y1, int y2)
487{ 511{
488 int ny; 512 int ny;
489 unsigned char *dst; 513 unsigned char *dst;
490 unsigned char mask_top, mask_bottom, bits; 514 unsigned mask, mask_bottom;
491 lcd_blockfunc_type *bfunc; 515 lcd_blockfunc_type *bfunc;
492 516
493 /* direction flip */ 517 /* direction flip */
@@ -508,28 +532,20 @@ void lcd_vline(int x, int y1, int y2)
508 if (y2 >= LCD_HEIGHT) 532 if (y2 >= LCD_HEIGHT)
509 y2 = LCD_HEIGHT-1; 533 y2 = LCD_HEIGHT-1;
510 534
511 bfunc = blockfunc[drawmode & ~DRMODE_INVERSEVID]; 535 bfunc = blockfunc[drawmode];
512 bits = (drawmode & DRMODE_INVERSEVID) ? 0x00 : 0xFFu; 536 dst = &lcd_framebuffer[y1>>3][x];
513 dst = &lcd_framebuffer[y1/8][x];
514 ny = y2 - (y1 & ~7); 537 ny = y2 - (y1 & ~7);
515 mask_top = 0xFFu << (y1 & 7); 538 mask = 0xFFu << (y1 & 7);
516 mask_bottom = 0xFFu >> (7 - (ny & 7)); 539 mask_bottom = 0xFFu >> (7 - (ny & 7));
517 540
518 if (ny >= 8) 541 for (; ny >= 8; ny -= 8)
519 { 542 {
520 bfunc(dst, mask_top, bits); 543 bfunc(dst, mask, 0xFFu);
521 dst += LCD_WIDTH; 544 dst += LCD_WIDTH;
522 545 mask = 0xFFu;
523 for (; ny > 15; ny -= 8)
524 {
525 bfunc(dst, 0xFFu, bits);
526 dst += LCD_WIDTH;
527 }
528 } 546 }
529 else 547 mask_bottom &= mask;
530 mask_bottom &= mask_top; 548 bfunc(dst, mask_bottom, 0xFFu);
531
532 bfunc(dst, mask_bottom, bits);
533} 549}
534 550
535/* Draw a rectangular box */ 551/* Draw a rectangular box */
@@ -547,29 +563,19 @@ void lcd_drawrect(int x, int y, int width, int height)
547 lcd_hline(x, x2, y2); 563 lcd_hline(x, x2, y2);
548} 564}
549 565
550/* helper function for lcd_fillrect() */
551static void fillrow(lcd_blockfunc_type *bfunc, unsigned char *address,
552 int width, unsigned mask, unsigned bits)
553{
554 int i;
555
556 for (i = 0; i < width; i++)
557 bfunc(address++, mask, bits);
558}
559
560/* Fill a rectangular area */ 566/* Fill a rectangular area */
561void lcd_fillrect(int x, int y, int width, int height) 567void lcd_fillrect(int x, int y, int width, int height)
562{ 568{
563 int ny; 569 int ny, i;
564 unsigned char *dst; 570 unsigned char *dst;
565 unsigned char mask_top, mask_bottom, bits; 571 unsigned mask, mask_bottom;
572 unsigned bits = 0xFFu;
566 lcd_blockfunc_type *bfunc; 573 lcd_blockfunc_type *bfunc;
567 bool fillopt = (drawmode & DRMODE_INVERSEVID) ? 574 bool fillopt;
568 (drawmode & DRMODE_BG) : (drawmode & DRMODE_FG);
569 575
570 /* nothing to draw? */ 576 /* nothing to draw? */
571 if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT) 577 if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
572 || (x + width < 0) || (y + height < 0)) 578 || (x + width <= 0) || (y + height <= 0))
573 return; 579 return;
574 580
575 /* clipping */ 581 /* clipping */
@@ -587,38 +593,41 @@ void lcd_fillrect(int x, int y, int width, int height)
587 width = LCD_WIDTH - x; 593 width = LCD_WIDTH - x;
588 if (y + height > LCD_HEIGHT) 594 if (y + height > LCD_HEIGHT)
589 height = LCD_HEIGHT - y; 595 height = LCD_HEIGHT - y;
590 596
591 bfunc = blockfunc[drawmode & ~DRMODE_INVERSEVID]; 597 fillopt = (drawmode & DRMODE_INVERSEVID) ?
592 bits = (drawmode & DRMODE_INVERSEVID) ? 0x00 : 0xFFu; 598 (drawmode & DRMODE_BG) : (drawmode & DRMODE_FG);
593 dst = &lcd_framebuffer[y/8][x]; 599 if (fillopt &&(drawmode & DRMODE_INVERSEVID))
600 bits = 0;
601 bfunc = blockfunc[drawmode];
602 dst = &lcd_framebuffer[y>>3][x];
594 ny = height - 1 + (y & 7); 603 ny = height - 1 + (y & 7);
595 mask_top = 0xFFu << (y & 7); 604 mask = 0xFFu << (y & 7);
596 mask_bottom = 0xFFu >> (7 - (ny & 7)); 605 mask_bottom = 0xFFu >> (7 - (ny & 7));
597 606
598 if (ny >= 8) 607 for (; ny >= 8; ny -= 8)
599 { 608 {
600 if (fillopt && mask_top == 0xFF) 609 if (fillopt && (mask == 0xFFu))
601 memset(dst, bits, width); 610 memset(dst, bits, width);
602 else 611 else
603 fillrow(bfunc, dst, width, mask_top, bits);
604 dst += LCD_WIDTH;
605
606 for (; ny > 15; ny -= 8)
607 { 612 {
608 if (fillopt) 613 unsigned char *dst_row = dst;
609 memset(dst, bits, width); 614
610 else 615 for (i = width; i > 0; i--)
611 fillrow(bfunc, dst, width, 0xFFu, bits); 616 bfunc(dst_row++, mask, 0xFFu);
612 dst += LCD_WIDTH;
613 } 617 }
618
619 dst += LCD_WIDTH;
620 mask = 0xFFu;
614 } 621 }
615 else 622 mask_bottom &= mask;
616 mask_bottom &= mask_top; 623
617 624 if (fillopt && (mask_bottom == 0xFFu))
618 if (fillopt && mask_bottom == 0xFF)
619 memset(dst, bits, width); 625 memset(dst, bits, width);
620 else 626 else
621 fillrow(bfunc, dst, width, mask_bottom, bits); 627 {
628 for (i = width; i > 0; i--)
629 bfunc(dst++, mask_bottom, 0xFFu);
630 }
622} 631}
623 632
624/* About Rockbox' internal bitmap format: 633/* About Rockbox' internal bitmap format:
@@ -632,95 +641,120 @@ void lcd_fillrect(int x, int y, int width, int height)
632 * 641 *
633 * This is the same as the internal lcd hw format. */ 642 * This is the same as the internal lcd hw format. */
634 643
635/* Draw a bitmap at (x, y), size (nx, ny) 644/* Draw a partial bitmap */
636 if 'clear' is true, clear destination area first */ 645void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
637void lcd_bitmap(const unsigned char *src, int x, int y, int nx, int ny, 646 int stride, int x, int y, int width, int height)
638 bool clear) __attribute__ ((section (".icode"))); 647 __attribute__ ((section(".icode")));
639void lcd_bitmap(const unsigned char *src, int x, int y, int nx, int ny, 648void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
640 bool clear) 649 int stride, int x, int y, int width, int height)
641{ 650{
642 const unsigned char *src_col; 651 int shift, ny, i;
643 unsigned char *dst, *dst_col; 652 unsigned char *dst;
644 unsigned int data, mask1, mask2, mask3, mask4; 653 unsigned mask, mask_bottom;
645 int stride, shift; 654 lcd_blockfunc_type *bfunc;
646 655
647 if (((unsigned) x >= LCD_WIDTH) || ((unsigned) y >= LCD_HEIGHT)) 656 /* nothing to draw? */
657 if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
658 || (x + width <= 0) || (y + height <= 0))
648 return; 659 return;
660
661 /* clipping */
662 if (x < 0)
663 {
664 width += x;
665 src_x -= x;
666 x = 0;
667 }
668 if (y < 0)
669 {
670 height += y;
671 src_y -= y;
672 y = 0;
673 }
674 if (x + width > LCD_WIDTH)
675 width = LCD_WIDTH - x;
676 if (y + height > LCD_HEIGHT)
677 height = LCD_HEIGHT - y;
649 678
650 stride = nx; /* otherwise right-clipping will destroy the image */ 679 src += stride * (src_y >> 3) + src_x; /* move starting point */
680 src_y &= 7;
681 y -= src_y;
682 dst = &lcd_framebuffer[y>>3][x];
683 shift = y & 7;
684 ny = height - 1 + shift + src_y;
651 685
652 if (((unsigned) (x + nx)) >= LCD_WIDTH) 686 bfunc = blockfunc[drawmode];
653 nx = LCD_WIDTH - x; 687 mask = 0xFFu << (shift + src_y);
654 if (((unsigned) (y + ny)) >= LCD_HEIGHT) 688 mask_bottom = 0xFFu >> (7 - (ny & 7));
655 ny = LCD_HEIGHT - y;
656
657 dst = &lcd_framebuffer[y >> 3][x];
658 shift = y & 7;
659 689
660 if (!shift && clear) /* shortcut for byte aligned match with clear */ 690 if (shift == 0)
661 { 691 {
662 while (ny >= 8) /* all full rows */ 692 bool copyopt = (drawmode == DRMODE_SOLID);
693
694 for (; ny >= 8; ny -= 8)
663 { 695 {
664 memcpy(dst, src, nx); 696 if (copyopt && (mask == 0xFFu))
697 memcpy(dst, src, width);
698 else
699 {
700 const unsigned char *src_row = src;
701 unsigned char *dst_row = dst;
702
703 for (i = width; i > 0; i--)
704 bfunc(dst_row++, mask, *src_row++);
705 }
706
665 src += stride; 707 src += stride;
666 dst += LCD_WIDTH; 708 dst += LCD_WIDTH;
667 ny -= 8; 709 mask = 0xFFu;
668 } 710 }
669 if (ny == 0) /* nothing left to do? */ 711 mask_bottom &= mask;
670 return;
671 /* last partial row to do by default routine */
672 }
673
674 ny += shift;
675 712
676 /* Calculate bit masks */ 713 if (copyopt && (mask_bottom == 0xFFu))
677 mask4 = ~(0xfe << ((ny-1) & 7)); /* data mask for last partial row */ 714 memcpy(dst, src, width);
678 if (clear) 715 else
679 { 716 {
680 mask1 = ~(0xff << shift); /* clearing of first partial row */ 717 for (i = width; i > 0; i--)
681 mask2 = 0; /* clearing of intermediate (full) rows */ 718 bfunc(dst++, mask_bottom, *src++);
682 mask3 = ~mask4; /* clearing of last partial row */ 719 }
683 if (ny <= 8)
684 mask3 |= mask1;
685 } 720 }
686 else 721 else
687 mask1 = mask2 = mask3 = 0xff;
688
689 /* Loop for each column */
690 for (x = 0; x < nx; x++)
691 { 722 {
692 src_col = src++; 723 for (x = 0; x < width; x++)
693 dst_col = dst++;
694 data = 0;
695 y = 0;
696
697 if (ny > 8)
698 { 724 {
699 /* First partial row */ 725 const unsigned char *src_col = src++;
700 data = *src_col << shift; 726 unsigned char *dst_col = dst++;
701 *dst_col = (*dst_col & mask1) | data; 727 unsigned mask_col = mask;
702 src_col += stride; 728 unsigned data = 0;
703 dst_col += LCD_WIDTH; 729
704 data >>= 8; 730 for (y = ny; y >= 8; y -= 8)
705
706 /* Intermediate rows */
707 for (y = 8; y < ny-8; y += 8)
708 { 731 {
709 data |= *src_col << shift; 732 data |= *src_col << shift;
710 *dst_col = (*dst_col & mask2) | data; 733
734 if (mask_col & 0xFFu)
735 {
736 bfunc(dst_col, mask_col, data);
737 mask_col = 0xFFu;
738 }
739 else
740 mask_col >>= 8;
741
711 src_col += stride; 742 src_col += stride;
712 dst_col += LCD_WIDTH; 743 dst_col += LCD_WIDTH;
713 data >>= 8; 744 data >>= 8;
714 } 745 }
715 }
716
717 /* Last partial row */
718 if (y + shift < ny)
719 data |= *src_col << shift; 746 data |= *src_col << shift;
720 *dst_col = (*dst_col & mask3) | (data & mask4); 747 bfunc(dst_col, mask_col & mask_bottom, data);
748 }
721 } 749 }
722} 750}
723 751
752/* Draw a full bitmap */
753void lcd_bitmap(const unsigned char *src, int x, int y, int width, int height)
754{
755 lcd_bitmap_part(src, 0, 0, width, x, y, width, height);
756}
757
724/* put a string at a given pixel position, skipping first ofs pixel columns */ 758/* put a string at a given pixel position, skipping first ofs pixel columns */
725static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str) 759static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str)
726{ 760{
@@ -729,7 +763,8 @@ static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str)
729 763
730 while ((ch = *str++) != '\0' && x < LCD_WIDTH) 764 while ((ch = *str++) != '\0' && x < LCD_WIDTH)
731 { 765 {
732 int gwidth, width; 766 int width;
767 const unsigned char *bits;
733 768
734 /* check input range */ 769 /* check input range */
735 if (ch < pf->firstchar || ch >= pf->firstchar+pf->size) 770 if (ch < pf->firstchar || ch >= pf->firstchar+pf->size)
@@ -737,40 +772,20 @@ static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str)
737 ch -= pf->firstchar; 772 ch -= pf->firstchar;
738 773
739 /* get proportional width and glyph bits */ 774 /* get proportional width and glyph bits */
740 gwidth = pf->width ? pf->width[ch] : pf->maxwidth; 775 width = pf->width ? pf->width[ch] : pf->maxwidth;
741 width = MIN (gwidth, LCD_WIDTH - x);
742 776
743 if (ofs != 0) 777 if (ofs > width)
744 { 778 {
745 if (ofs > width) 779 ofs -= width;
746 { 780 continue;
747 ofs -= width;
748 continue;
749 }
750 width -= ofs;
751 } 781 }
782
783 bits = pf->bits + (pf->offset ?
784 pf->offset[ch] : ((pf->height + 7) / 8 * pf->maxwidth * ch));
752 785
753 if (width > 0) 786 lcd_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height);
754 { 787
755 unsigned int i; 788 x += width - ofs;
756 const unsigned char* bits = pf->bits +
757 (pf->offset ? pf->offset[ch]
758 : ((pf->height + 7) / 8 * pf->maxwidth * ch));
759
760 if (ofs != 0)
761 {
762 for (i = 0; i < pf->height; i += 8)
763 {
764 lcd_bitmap (bits + ofs, x, y + i, width,
765 MIN(8, pf->height - i), true);
766 bits += gwidth;
767 }
768 }
769 else
770 lcd_bitmap ((unsigned char*) bits, x, y, gwidth,
771 pf->height, true);
772 x += width;
773 }
774 ofs = 0; 789 ofs = 0;
775 } 790 }
776} 791}
diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c
index d464e30f0a..9513c26380 100644
--- a/firmware/drivers/lcd-recorder.c
+++ b/firmware/drivers/lcd-recorder.c
@@ -265,20 +265,20 @@ void lcd_init(void)
265/*** Update functions ***/ 265/*** Update functions ***/
266 266
267/* Performance function that works with an external buffer 267/* Performance function that works with an external buffer
268 note that y and height are in 8-pixel units! */ 268 note that by and bheight are in 8-pixel units! */
269void lcd_blit(const unsigned char* p_data, int x, int y, int width, 269void lcd_blit(const unsigned char* data, int x, int by, int width,
270 int height, int stride) 270 int bheight, int stride)
271{ 271{
272 /* Copy display bitmap to hardware */ 272 /* Copy display bitmap to hardware */
273 while (height--) 273 while (bheight--)
274 { 274 {
275 lcd_write_command (LCD_CNTL_PAGE | (y++ & 0xf)); 275 lcd_write_command (LCD_CNTL_PAGE | (by++ & 0xf));
276 lcd_write_command (LCD_CNTL_HIGHCOL | (((x+xoffset)>>4) & 0xf)); 276 lcd_write_command (LCD_CNTL_HIGHCOL | (((x+xoffset)>>4) & 0xf));
277 lcd_write_command (LCD_CNTL_LOWCOL | ((x+xoffset) & 0xf)); 277 lcd_write_command (LCD_CNTL_LOWCOL | ((x+xoffset) & 0xf));
278 278
279 lcd_write_data(p_data, width); 279 lcd_write_data(data, width);
280 p_data += stride; 280 data += stride;
281 } 281 }
282} 282}
283 283
284 284
@@ -302,29 +302,31 @@ void lcd_update(void)
302 302
303/* Update a fraction of the display. */ 303/* Update a fraction of the display. */
304void lcd_update_rect(int, int, int, int) __attribute__ ((section (".icode"))); 304void lcd_update_rect(int, int, int, int) __attribute__ ((section (".icode")));
305void lcd_update_rect(int x_start, int y, int width, int height) 305void lcd_update_rect(int x, int y, int width, int height)
306{ 306{
307 int ymax; 307 int ymax;
308 308
309 /* The Y coordinates have to work on even 8 pixel rows */ 309 /* The Y coordinates have to work on even 8 pixel rows */
310 ymax = (y + height-1)/8; 310 ymax = (y + height-1) >> 3;
311 y /= 8; 311 y >>= 3;
312 312
313 if(x_start + width > LCD_WIDTH) 313 if(x + width > LCD_WIDTH)
314 width = LCD_WIDTH - x_start; 314 width = LCD_WIDTH - x;
315 if (width <= 0) 315 if (width <= 0)
316 return; /* nothing left to do, 0 is harmful to lcd_write_data() */ 316 return; /* nothing left to do, 0 is harmful to lcd_write_data() */
317 if(ymax >= LCD_HEIGHT/8) 317 if(ymax >= LCD_HEIGHT/8)
318 ymax = LCD_HEIGHT/8-1; 318 ymax = LCD_HEIGHT/8-1;
319
320 x += xoffset;
319 321
320 /* Copy specified rectange bitmap to hardware */ 322 /* Copy specified rectange bitmap to hardware */
321 for (; y <= ymax; y++) 323 for (; y <= ymax; y++)
322 { 324 {
323 lcd_write_command (LCD_CNTL_PAGE | (y & 0xf)); 325 lcd_write_command (LCD_CNTL_PAGE | (y & 0xf));
324 lcd_write_command (LCD_CNTL_HIGHCOL | (((x_start+xoffset)>>4) & 0xf)); 326 lcd_write_command (LCD_CNTL_HIGHCOL | ((x >> 4) & 0xf));
325 lcd_write_command (LCD_CNTL_LOWCOL | ((x_start+xoffset) & 0xf)); 327 lcd_write_command (LCD_CNTL_LOWCOL | (x & 0xf));
326 328
327 lcd_write_data (&lcd_framebuffer[y][x_start], width); 329 lcd_write_data (&lcd_framebuffer[y][x], width);
328 } 330 }
329} 331}
330#endif /* !SIMULATOR */ 332#endif /* !SIMULATOR */
@@ -390,8 +392,10 @@ static void nopixel(int x, int y)
390 (void)y; 392 (void)y;
391} 393}
392 394
393lcd_pixelfunc_type* pixelfunc[8] = {flippixel, nopixel, setpixel, setpixel, 395lcd_pixelfunc_type* pixelfunc[8] = {
394 nopixel, clearpixel, nopixel, clearpixel}; 396 flippixel, nopixel, setpixel, setpixel,
397 nopixel, clearpixel, nopixel, clearpixel
398};
395 399
396static void flipblock(unsigned char *address, unsigned mask, unsigned bits) 400static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
397{ 401{
@@ -413,7 +417,30 @@ static void solidblock(unsigned char *address, unsigned mask, unsigned bits)
413 *address = (*address & ~mask) | (bits & mask); 417 *address = (*address & ~mask) | (bits & mask);
414} 418}
415 419
416lcd_blockfunc_type* blockfunc[4] = {flipblock, bgblock, fgblock, solidblock}; 420static void flipinvblock(unsigned char *address, unsigned mask, unsigned bits)
421{
422 *address ^= (~bits & mask);
423}
424
425static void bginvblock(unsigned char *address, unsigned mask, unsigned bits)
426{
427 *address &= ~(bits & mask);
428}
429
430static void fginvblock(unsigned char *address, unsigned mask, unsigned bits)
431{
432 *address |= (~bits & mask);
433}
434
435static void solidinvblock(unsigned char *address, unsigned mask, unsigned bits)
436{
437 *address = (*address & ~mask) | (~bits & mask);
438}
439
440lcd_blockfunc_type* blockfunc[8] = {
441 flipblock, bgblock, fgblock, solidblock,
442 flipinvblock, bginvblock, fginvblock, solidinvblock
443};
417 444
418/*** drawing functions ***/ 445/*** drawing functions ***/
419 446
@@ -509,7 +536,7 @@ void lcd_hline(int x1, int x2, int y)
509{ 536{
510 int x; 537 int x;
511 unsigned char *dst; 538 unsigned char *dst;
512 unsigned char mask, bits; 539 unsigned mask;
513 lcd_blockfunc_type *bfunc; 540 lcd_blockfunc_type *bfunc;
514 541
515 /* direction flip */ 542 /* direction flip */
@@ -530,13 +557,12 @@ void lcd_hline(int x1, int x2, int y)
530 if (x2 >= LCD_WIDTH) 557 if (x2 >= LCD_WIDTH)
531 x2 = LCD_WIDTH-1; 558 x2 = LCD_WIDTH-1;
532 559
533 bfunc = blockfunc[drawmode & ~DRMODE_INVERSEVID]; 560 bfunc = blockfunc[drawmode];
534 bits = (drawmode & DRMODE_INVERSEVID) ? 0x00 : 0xFFu; 561 dst = &lcd_framebuffer[y>>3][x1];
535 dst = &lcd_framebuffer[y/8][x1];
536 mask = 1 << (y & 7); 562 mask = 1 << (y & 7);
537 563
538 for (x = x1; x <= x2; x++) 564 for (x = x1; x <= x2; x++)
539 bfunc(dst++, mask, bits); 565 bfunc(dst++, mask, 0xFFu);
540} 566}
541 567
542/* Draw a vertical line (optimised) */ 568/* Draw a vertical line (optimised) */
@@ -544,7 +570,7 @@ void lcd_vline(int x, int y1, int y2)
544{ 570{
545 int ny; 571 int ny;
546 unsigned char *dst; 572 unsigned char *dst;
547 unsigned char mask_top, mask_bottom, bits; 573 unsigned mask, mask_bottom;
548 lcd_blockfunc_type *bfunc; 574 lcd_blockfunc_type *bfunc;
549 575
550 /* direction flip */ 576 /* direction flip */
@@ -565,28 +591,20 @@ void lcd_vline(int x, int y1, int y2)
565 if (y2 >= LCD_HEIGHT) 591 if (y2 >= LCD_HEIGHT)
566 y2 = LCD_HEIGHT-1; 592 y2 = LCD_HEIGHT-1;
567 593
568 bfunc = blockfunc[drawmode & ~DRMODE_INVERSEVID]; 594 bfunc = blockfunc[drawmode];
569 bits = (drawmode & DRMODE_INVERSEVID) ? 0x00 : 0xFFu; 595 dst = &lcd_framebuffer[y1>>3][x];
570 dst = &lcd_framebuffer[y1/8][x];
571 ny = y2 - (y1 & ~7); 596 ny = y2 - (y1 & ~7);
572 mask_top = 0xFFu << (y1 & 7); 597 mask = 0xFFu << (y1 & 7);
573 mask_bottom = 0xFFu >> (7 - (ny & 7)); 598 mask_bottom = 0xFFu >> (7 - (ny & 7));
574 599
575 if (ny >= 8) 600 for (; ny >= 8; ny -= 8)
576 { 601 {
577 bfunc(dst, mask_top, bits); 602 bfunc(dst, mask, 0xFFu);
578 dst += LCD_WIDTH; 603 dst += LCD_WIDTH;
579 604 mask = 0xFFu;
580 for (; ny > 15; ny -= 8)
581 {
582 bfunc(dst, 0xFFu, bits);
583 dst += LCD_WIDTH;
584 }
585 } 605 }
586 else 606 mask_bottom &= mask;
587 mask_bottom &= mask_top; 607 bfunc(dst, mask_bottom, 0xFFu);
588
589 bfunc(dst, mask_bottom, bits);
590} 608}
591 609
592/* Draw a rectangular box */ 610/* Draw a rectangular box */
@@ -604,29 +622,19 @@ void lcd_drawrect(int x, int y, int width, int height)
604 lcd_hline(x, x2, y2); 622 lcd_hline(x, x2, y2);
605} 623}
606 624
607/* helper function for lcd_fillrect() */
608static void fillrow(lcd_blockfunc_type *bfunc, unsigned char *address,
609 int width, unsigned mask, unsigned bits)
610{
611 int i;
612
613 for (i = 0; i < width; i++)
614 bfunc(address++, mask, bits);
615}
616
617/* Fill a rectangular area */ 625/* Fill a rectangular area */
618void lcd_fillrect(int x, int y, int width, int height) 626void lcd_fillrect(int x, int y, int width, int height)
619{ 627{
620 int ny; 628 int ny, i;
621 unsigned char *dst; 629 unsigned char *dst;
622 unsigned char mask_top, mask_bottom, bits; 630 unsigned mask, mask_bottom;
631 unsigned bits = 0xFFu;
623 lcd_blockfunc_type *bfunc; 632 lcd_blockfunc_type *bfunc;
624 bool fillopt = (drawmode & DRMODE_INVERSEVID) ? 633 bool fillopt;
625 (drawmode & DRMODE_BG) : (drawmode & DRMODE_FG);
626 634
627 /* nothing to draw? */ 635 /* nothing to draw? */
628 if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT) 636 if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
629 || (x + width < 0) || (y + height < 0)) 637 || (x + width <= 0) || (y + height <= 0))
630 return; 638 return;
631 639
632 /* clipping */ 640 /* clipping */
@@ -644,38 +652,41 @@ void lcd_fillrect(int x, int y, int width, int height)
644 width = LCD_WIDTH - x; 652 width = LCD_WIDTH - x;
645 if (y + height > LCD_HEIGHT) 653 if (y + height > LCD_HEIGHT)
646 height = LCD_HEIGHT - y; 654 height = LCD_HEIGHT - y;
647 655
648 bfunc = blockfunc[drawmode & ~DRMODE_INVERSEVID]; 656 fillopt = (drawmode & DRMODE_INVERSEVID) ?
649 bits = (drawmode & DRMODE_INVERSEVID) ? 0x00 : 0xFFu; 657 (drawmode & DRMODE_BG) : (drawmode & DRMODE_FG);
650 dst = &lcd_framebuffer[y/8][x]; 658 if (fillopt &&(drawmode & DRMODE_INVERSEVID))
659 bits = 0;
660 bfunc = blockfunc[drawmode];
661 dst = &lcd_framebuffer[y>>3][x];
651 ny = height - 1 + (y & 7); 662 ny = height - 1 + (y & 7);
652 mask_top = 0xFFu << (y & 7); 663 mask = 0xFFu << (y & 7);
653 mask_bottom = 0xFFu >> (7 - (ny & 7)); 664 mask_bottom = 0xFFu >> (7 - (ny & 7));
654 665
655 if (ny >= 8) 666 for (; ny >= 8; ny -= 8)
656 { 667 {
657 if (fillopt && mask_top == 0xFF) 668 if (fillopt && (mask == 0xFFu))
658 memset(dst, bits, width); 669 memset(dst, bits, width);
659 else 670 else
660 fillrow(bfunc, dst, width, mask_top, bits);
661 dst += LCD_WIDTH;
662
663 for (; ny > 15; ny -= 8)
664 { 671 {
665 if (fillopt) 672 unsigned char *dst_row = dst;
666 memset(dst, bits, width); 673
667 else 674 for (i = width; i > 0; i--)
668 fillrow(bfunc, dst, width, 0xFFu, bits); 675 bfunc(dst_row++, mask, 0xFFu);
669 dst += LCD_WIDTH;
670 } 676 }
677
678 dst += LCD_WIDTH;
679 mask = 0xFFu;
671 } 680 }
672 else 681 mask_bottom &= mask;
673 mask_bottom &= mask_top; 682
674 683 if (fillopt && (mask_bottom == 0xFFu))
675 if (fillopt && mask_bottom == 0xFF)
676 memset(dst, bits, width); 684 memset(dst, bits, width);
677 else 685 else
678 fillrow(bfunc, dst, width, mask_bottom, bits); 686 {
687 for (i = width; i > 0; i--)
688 bfunc(dst++, mask_bottom, 0xFFu);
689 }
679} 690}
680 691
681/* About Rockbox' internal bitmap format: 692/* About Rockbox' internal bitmap format:
@@ -689,95 +700,120 @@ void lcd_fillrect(int x, int y, int width, int height)
689 * 700 *
690 * This is the same as the internal lcd hw format. */ 701 * This is the same as the internal lcd hw format. */
691 702
692/* Draw a bitmap at (x, y), size (nx, ny) 703/* Draw a partial bitmap */
693 if 'clear' is true, clear destination area first */ 704void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
694void lcd_bitmap(const unsigned char *src, int x, int y, int nx, int ny, 705 int stride, int x, int y, int width, int height)
695 bool clear) __attribute__ ((section (".icode"))); 706 __attribute__ ((section(".icode")));
696void lcd_bitmap(const unsigned char *src, int x, int y, int nx, int ny, 707void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
697 bool clear) 708 int stride, int x, int y, int width, int height)
698{ 709{
699 const unsigned char *src_col; 710 int shift, ny, i;
700 unsigned char *dst, *dst_col; 711 unsigned char *dst;
701 unsigned int data, mask1, mask2, mask3, mask4; 712 unsigned mask, mask_bottom;
702 int stride, shift; 713 lcd_blockfunc_type *bfunc;
703 714
704 if (((unsigned) x >= LCD_WIDTH) || ((unsigned) y >= LCD_HEIGHT)) 715 /* nothing to draw? */
716 if ((width <= 0) || (height <= 0) || (x >= LCD_WIDTH) || (y >= LCD_HEIGHT)
717 || (x + width <= 0) || (y + height <= 0))
705 return; 718 return;
719
720 /* clipping */
721 if (x < 0)
722 {
723 width += x;
724 src_x -= x;
725 x = 0;
726 }
727 if (y < 0)
728 {
729 height += y;
730 src_y -= y;
731 y = 0;
732 }
733 if (x + width > LCD_WIDTH)
734 width = LCD_WIDTH - x;
735 if (y + height > LCD_HEIGHT)
736 height = LCD_HEIGHT - y;
706 737
707 stride = nx; /* otherwise right-clipping will destroy the image */ 738 src += stride * (src_y >> 3) + src_x; /* move starting point */
739 src_y &= 7;
740 y -= src_y;
741 dst = &lcd_framebuffer[y>>3][x];
742 shift = y & 7;
743 ny = height - 1 + shift + src_y;
708 744
709 if (((unsigned) (x + nx)) >= LCD_WIDTH) 745 bfunc = blockfunc[drawmode];
710 nx = LCD_WIDTH - x; 746 mask = 0xFFu << (shift + src_y);
711 if (((unsigned) (y + ny)) >= LCD_HEIGHT) 747 mask_bottom = 0xFFu >> (7 - (ny & 7));
712 ny = LCD_HEIGHT - y;
713
714 dst = &lcd_framebuffer[y >> 3][x];
715 shift = y & 7;
716 748
717 if (!shift && clear) /* shortcut for byte aligned match with clear */ 749 if (shift == 0)
718 { 750 {
719 while (ny >= 8) /* all full rows */ 751 bool copyopt = (drawmode == DRMODE_SOLID);
752
753 for (; ny >= 8; ny -= 8)
720 { 754 {
721 memcpy(dst, src, nx); 755 if (copyopt && (mask == 0xFFu))
756 memcpy(dst, src, width);
757 else
758 {
759 const unsigned char *src_row = src;
760 unsigned char *dst_row = dst;
761
762 for (i = width; i > 0; i--)
763 bfunc(dst_row++, mask, *src_row++);
764 }
765
722 src += stride; 766 src += stride;
723 dst += LCD_WIDTH; 767 dst += LCD_WIDTH;
724 ny -= 8; 768 mask = 0xFFu;
725 } 769 }
726 if (ny == 0) /* nothing left to do? */ 770 mask_bottom &= mask;
727 return;
728 /* last partial row to do by default routine */
729 }
730
731 ny += shift;
732 771
733 /* Calculate bit masks */ 772 if (copyopt && (mask_bottom == 0xFFu))
734 mask4 = ~(0xfe << ((ny-1) & 7)); /* data mask for last partial row */ 773 memcpy(dst, src, width);
735 if (clear) 774 else
736 { 775 {
737 mask1 = ~(0xff << shift); /* clearing of first partial row */ 776 for (i = width; i > 0; i--)
738 mask2 = 0; /* clearing of intermediate (full) rows */ 777 bfunc(dst++, mask_bottom, *src++);
739 mask3 = ~mask4; /* clearing of last partial row */ 778 }
740 if (ny <= 8)
741 mask3 |= mask1;
742 } 779 }
743 else 780 else
744 mask1 = mask2 = mask3 = 0xff;
745
746 /* Loop for each column */
747 for (x = 0; x < nx; x++)
748 { 781 {
749 src_col = src++; 782 for (x = 0; x < width; x++)
750 dst_col = dst++;
751 data = 0;
752 y = 0;
753
754 if (ny > 8)
755 { 783 {
756 /* First partial row */ 784 const unsigned char *src_col = src++;
757 data = *src_col << shift; 785 unsigned char *dst_col = dst++;
758 *dst_col = (*dst_col & mask1) | data; 786 unsigned mask_col = mask;
759 src_col += stride; 787 unsigned data = 0;
760 dst_col += LCD_WIDTH; 788
761 data >>= 8; 789 for (y = ny; y >= 8; y -= 8)
762
763 /* Intermediate rows */
764 for (y = 8; y < ny-8; y += 8)
765 { 790 {
766 data |= *src_col << shift; 791 data |= *src_col << shift;
767 *dst_col = (*dst_col & mask2) | data; 792
793 if (mask_col & 0xFFu)
794 {
795 bfunc(dst_col, mask_col, data);
796 mask_col = 0xFFu;
797 }
798 else
799 mask_col >>= 8;
800
768 src_col += stride; 801 src_col += stride;
769 dst_col += LCD_WIDTH; 802 dst_col += LCD_WIDTH;
770 data >>= 8; 803 data >>= 8;
771 } 804 }
772 }
773
774 /* Last partial row */
775 if (y + shift < ny)
776 data |= *src_col << shift; 805 data |= *src_col << shift;
777 *dst_col = (*dst_col & mask3) | (data & mask4); 806 bfunc(dst_col, mask_col & mask_bottom, data);
807 }
778 } 808 }
779} 809}
780 810
811/* Draw a full bitmap */
812void lcd_bitmap(const unsigned char *src, int x, int y, int width, int height)
813{
814 lcd_bitmap_part(src, 0, 0, width, x, y, width, height);
815}
816
781/* put a string at a given pixel position, skipping first ofs pixel columns */ 817/* put a string at a given pixel position, skipping first ofs pixel columns */
782static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str) 818static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str)
783{ 819{
@@ -786,7 +822,8 @@ static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str)
786 822
787 while ((ch = *str++) != '\0' && x < LCD_WIDTH) 823 while ((ch = *str++) != '\0' && x < LCD_WIDTH)
788 { 824 {
789 int gwidth, width; 825 int width;
826 const unsigned char *bits;
790 827
791 /* check input range */ 828 /* check input range */
792 if (ch < pf->firstchar || ch >= pf->firstchar+pf->size) 829 if (ch < pf->firstchar || ch >= pf->firstchar+pf->size)
@@ -794,44 +831,23 @@ static void lcd_putsxyofs(int x, int y, int ofs, const unsigned char *str)
794 ch -= pf->firstchar; 831 ch -= pf->firstchar;
795 832
796 /* get proportional width and glyph bits */ 833 /* get proportional width and glyph bits */
797 gwidth = pf->width ? pf->width[ch] : pf->maxwidth; 834 width = pf->width ? pf->width[ch] : pf->maxwidth;
798 width = MIN (gwidth, LCD_WIDTH - x);
799 835
800 if (ofs != 0) 836 if (ofs > width)
801 { 837 {
802 if (ofs > width) 838 ofs -= width;
803 { 839 continue;
804 ofs -= width;
805 continue;
806 }
807 width -= ofs;
808 } 840 }
809 841
810 if (width > 0) 842 bits = pf->bits + (pf->offset ?
811 { 843 pf->offset[ch] : ((pf->height + 7) / 8 * pf->maxwidth * ch));
812 unsigned int i;
813 const unsigned char* bits = pf->bits +
814 (pf->offset ? pf->offset[ch]
815 : ((pf->height + 7) / 8 * pf->maxwidth * ch));
816 844
817 if (ofs != 0) 845 lcd_bitmap_part(bits, ofs, 0, width, x, y, width - ofs, pf->height);
818 { 846
819 for (i = 0; i < pf->height; i += 8) 847 x += width - ofs;
820 {
821 lcd_bitmap (bits + ofs, x, y + i, width,
822 MIN(8, pf->height - i), true);
823 bits += gwidth;
824 }
825 }
826 else
827 lcd_bitmap ((unsigned char*) bits, x, y, gwidth,
828 pf->height, true);
829 x += width;
830 }
831 ofs = 0; 848 ofs = 0;
832 } 849 }
833} 850}
834
835/* put a string at a given pixel position */ 851/* put a string at a given pixel position */
836void lcd_putsxy(int x, int y, const unsigned char *str) 852void lcd_putsxy(int x, int y, const unsigned char *str)
837{ 853{
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 7456aa77a9..6a6a8e8697 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -57,8 +57,8 @@ extern void lcd_icon(int icon, bool enable);
57 57
58#if defined(SIMULATOR) || defined(HAVE_LCD_BITMAP) 58#if defined(SIMULATOR) || defined(HAVE_LCD_BITMAP)
59/* performance function */ 59/* performance function */
60extern void lcd_blit(const unsigned char* p_data, int x, int y, int width, 60extern void lcd_blit(const unsigned char* data, int x, int by, int width,
61 int height, int stride); 61 int bheight, int stride);
62 62
63extern void lcd_update(void); 63extern void lcd_update(void);
64/* update a fraction of the screen */ 64/* update a fraction of the screen */
@@ -150,8 +150,9 @@ extern void lcd_hline(int x1, int x2, int y);
150extern void lcd_vline(int x, int y1, int y2); 150extern void lcd_vline(int x, int y1, int y2);
151extern void lcd_drawrect(int x, int y, int width, int height); 151extern void lcd_drawrect(int x, int y, int width, int height);
152extern void lcd_fillrect(int x, int y, int width, int height); 152extern void lcd_fillrect(int x, int y, int width, int height);
153extern void lcd_bitmap(const unsigned char *src, int x, int y, int nx, int ny, 153extern void lcd_bitmap_part(const unsigned char *src, int src_x, int src_y,
154 bool clear); 154 int stride, int x, int y, int width, int height);
155extern void lcd_bitmap(const unsigned char *src, int x, int y, int nx, int ny);
155extern void lcd_putsxy(int x, int y, const unsigned char *string); 156extern void lcd_putsxy(int x, int y, const unsigned char *string);
156 157
157extern void lcd_invertscroll(int x, int y); 158extern void lcd_invertscroll(int x, int y);