summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-06-24 22:33:21 +0000
committerJens Arnold <amiconn@rockbox.org>2005-06-24 22:33:21 +0000
commit04daef17a1d180c68888c29d11a1b9087e9ace32 (patch)
treef2d794c196981fc605880e3bbb4447edbaba5f50 /apps
parent0e935bdf01aff1e3bc66221c9a0fcc80f935c3d6 (diff)
downloadrockbox-04daef17a1d180c68888c29d11a1b9087e9ace32.tar.gz
rockbox-04daef17a1d180c68888c29d11a1b9087e9ace32.zip
First part of graphics api rework. Special functions, parameter handling, pixel functions, lines and filled primitives done for black & white core, main display.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6856 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps')
-rw-r--r--apps/credits.c7
-rw-r--r--apps/debug_menu.c8
-rw-r--r--apps/menu.c6
-rw-r--r--apps/playlist_viewer.c4
-rw-r--r--apps/plugin.c37
-rw-r--r--apps/plugin.h42
-rw-r--r--apps/plugins/calculator.c58
-rw-r--r--apps/plugins/calendar.c8
-rw-r--r--apps/plugins/chessclock.c6
-rw-r--r--apps/plugins/clock.c173
-rw-r--r--apps/plugins/databox/databox.c7
-rw-r--r--apps/plugins/flipit.c14
-rw-r--r--apps/plugins/minesweeper.c6
-rw-r--r--apps/plugins/mosaique.c17
-rw-r--r--apps/plugins/oscillograph.c9
-rw-r--r--apps/plugins/oscilloscope.c8
-rw-r--r--apps/plugins/pong.c14
-rw-r--r--apps/plugins/rockblox.c18
-rw-r--r--apps/plugins/rockboy/Makefile2
-rw-r--r--apps/plugins/rockboy/menu.c16
-rw-r--r--apps/plugins/rockboy/rockmacros.h12
-rw-r--r--apps/plugins/rockboy/sound.h1
-rw-r--r--apps/plugins/sliding_puzzle.c4
-rw-r--r--apps/plugins/snake.c4
-rw-r--r--apps/plugins/snake2.c14
-rw-r--r--apps/plugins/snow.c6
-rw-r--r--apps/plugins/sokoban.c4
-rw-r--r--apps/plugins/solitaire.c34
-rw-r--r--apps/plugins/splitedit.c54
-rw-r--r--apps/plugins/star.c4
-rw-r--r--apps/plugins/vu_meter.c4
-rw-r--r--apps/plugins/wormlet.c41
-rw-r--r--apps/recorder/keyboard.c6
-rw-r--r--apps/recorder/peakmeter.c19
-rw-r--r--apps/recorder/widgets.c24
-rw-r--r--apps/screens.c20
-rw-r--r--apps/sound_menu.c11
-rw-r--r--apps/status.c12
38 files changed, 494 insertions, 240 deletions
diff --git a/apps/credits.c b/apps/credits.c
index 72a33cf3c5..9acc90da19 100644
--- a/apps/credits.c
+++ b/apps/credits.c
@@ -98,7 +98,7 @@ void roll_credits(void)
98 98
99 int height; 99 int height;
100 int width; 100 int width;
101 101
102 lcd_setfont(FONT_UI); 102 lcd_setfont(FONT_UI);
103 103
104 lcd_getstringsize("A", &width, &height); 104 lcd_getstringsize("A", &width, &height);
@@ -109,7 +109,9 @@ void roll_credits(void)
109 lcd_putsxy(0, i*height+y, line+i<numnames?credits[line+i]:""); 109 lcd_putsxy(0, i*height+y, line+i<numnames?credits[line+i]:"");
110 snprintf(buffer, sizeof(buffer), " [Credits] %2d/%2d ", 110 snprintf(buffer, sizeof(buffer), " [Credits] %2d/%2d ",
111 line+1, numnames); 111 line+1, numnames);
112 lcd_clearrect(0, 0, LCD_WIDTH, height); 112 lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
113 lcd_fillrect(0, 0, LCD_WIDTH, height);
114 lcd_set_drawmode(DRMODE_SOLID);
113 lcd_putsxy(0, 0, buffer); 115 lcd_putsxy(0, 0, buffer);
114 lcd_update(); 116 lcd_update();
115 117
@@ -126,6 +128,5 @@ void roll_credits(void)
126 } 128 }
127 129
128 } 130 }
129 return;
130} 131}
131#endif 132#endif
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index 588daec96b..a1097ba925 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -264,7 +264,7 @@ bool dbg_audio_thread(void)
264 lcd_puts(0, line++, buf); 264 lcd_puts(0, line++, buf);
265 265
266 /* Playable space left */ 266 /* Playable space left */
267 scrollbar(0, line*8, LCD_WIDTH, 6, codecbuflen, 0, 267 scrollbar(0, line*8, LCD_WIDTH, 6, codecbuflen, 0,
268 codecbufused, HORIZONTAL); 268 codecbufused, HORIZONTAL);
269 line++; 269 line++;
270 270
@@ -1142,8 +1142,10 @@ bool view_battery(void)
1142 x = 0; 1142 x = 0;
1143 for (i = BAT_LAST_VAL - 1; i >= 0; i--) { 1143 for (i = BAT_LAST_VAL - 1; i >= 0; i--) {
1144 y = (power_history[i] - minv) * BAT_YSPACE / (maxv - minv); 1144 y = (power_history[i] - minv) * BAT_YSPACE / (maxv - minv);
1145 lcd_clearline(x, LCD_HEIGHT-1, x, 20); 1145 lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1146 lcd_drawline(x, LCD_HEIGHT-1, x, 1146 lcd_drawline(x, LCD_HEIGHT-1, x, 20);
1147 lcd_set_drawmode(DRMODE_SOLID);
1148 lcd_drawline(x, LCD_HEIGHT-1, x,
1147 MIN(MAX(LCD_HEIGHT-1 - y, 20), LCD_HEIGHT-1)); 1149 MIN(MAX(LCD_HEIGHT-1 - y, 20), LCD_HEIGHT-1));
1148 x++; 1150 x++;
1149 } 1151 }
diff --git a/apps/menu.c b/apps/menu.c
index 60cc4b7682..d431097553 100644
--- a/apps/menu.c
+++ b/apps/menu.c
@@ -116,7 +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],
120 xpos, ypos, 4, 8, true); 120 xpos, ypos, 4, 8, true);
121#else 121#else
122 lcd_putc(x, y, CURSOR_CHAR); 122 lcd_putc(x, y, CURSOR_CHAR);
@@ -125,7 +125,9 @@ void put_cursorxy(int x, int y, bool on)
125 else { 125 else {
126#if defined(HAVE_LCD_BITMAP) 126#if defined(HAVE_LCD_BITMAP)
127 /* I use xy here since it needs to disregard the margins */ 127 /* I use xy here since it needs to disregard the margins */
128 lcd_clearrect (xpos, ypos, 4, 8); 128 lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
129 lcd_fillrect (xpos, ypos, 4, 8);
130 lcd_set_drawmode(DRMODE_SOLID);
129#else 131#else
130 lcd_putc(x, y, ' '); 132 lcd_putc(x, y, ' ');
131#endif 133#endif
diff --git a/apps/playlist_viewer.c b/apps/playlist_viewer.c
index d851470392..1d82c2e7e0 100644
--- a/apps/playlist_viewer.c
+++ b/apps/playlist_viewer.c
@@ -854,9 +854,11 @@ bool playlist_viewer_ex(char* filename)
854#ifdef HAVE_LCD_BITMAP 854#ifdef HAVE_LCD_BITMAP
855 if (global_settings.invert_cursor) 855 if (global_settings.invert_cursor)
856 { 856 {
857 lcd_invertrect( 857 lcd_set_drawmode(DRMODE_COMPLEMENT);
858 lcd_fillrect(
858 MARGIN_X, MARGIN_Y+(viewer.cursor_pos*viewer.line_height), 859 MARGIN_X, MARGIN_Y+(viewer.cursor_pos*viewer.line_height),
859 LCD_WIDTH, viewer.line_height); 860 LCD_WIDTH, viewer.line_height);
861 lcd_set_drawmode(DRMODE_SOLID);
860 lcd_invertscroll(LINE_X, viewer.cursor_pos); 862 lcd_invertscroll(LINE_X, viewer.cursor_pos);
861 } 863 }
862 else 864 else
diff --git a/apps/plugin.c b/apps/plugin.c
index 7ea443f30e..fb9da5bd5d 100644
--- a/apps/plugin.c
+++ b/apps/plugin.c
@@ -87,11 +87,11 @@ static const struct plugin_api rockbox_api = {
87 plugin_test, 87 plugin_test,
88 88
89 /* lcd */ 89 /* lcd */
90 lcd_set_contrast,
90 lcd_clear_display, 91 lcd_clear_display,
91 lcd_puts, 92 lcd_puts,
92 lcd_puts_scroll, 93 lcd_puts_scroll,
93 lcd_stop_scroll, 94 lcd_stop_scroll,
94 lcd_set_contrast,
95#ifdef HAVE_LCD_CHARCELLS 95#ifdef HAVE_LCD_CHARCELLS
96 lcd_define_pattern, 96 lcd_define_pattern,
97 lcd_get_locked_pattern, 97 lcd_get_locked_pattern,
@@ -101,30 +101,28 @@ static const struct plugin_api rockbox_api = {
101 lcd_remove_cursor, 101 lcd_remove_cursor,
102 PREFIX(lcd_icon), 102 PREFIX(lcd_icon),
103#else 103#else
104#ifndef SIMULATOR
105 lcd_roll,
106#endif
107 lcd_set_drawmode,
108 lcd_get_drawmode,
109 lcd_setfont,
110 lcd_getstringsize,
111 lcd_drawpixel,
112 lcd_drawline,
113 lcd_drawrect,
114 lcd_fillrect,
115 lcd_bitmap,
104 lcd_putsxy, 116 lcd_putsxy,
105 lcd_puts_style, 117 lcd_puts_style,
106 lcd_puts_scroll_style, 118 lcd_puts_scroll_style,
107 lcd_bitmap, 119 &lcd_framebuffer[0][0],
108 lcd_drawline, 120 lcd_blit,
109 lcd_clearline,
110 lcd_drawpixel,
111 lcd_clearpixel,
112 lcd_setfont,
113 font_get,
114 lcd_clearrect,
115 lcd_fillrect,
116 lcd_drawrect,
117 lcd_invertrect,
118 lcd_getstringsize,
119 lcd_update, 121 lcd_update,
120 lcd_update_rect, 122 lcd_update_rect,
121 scrollbar, 123 scrollbar,
122 checkbox, 124 checkbox,
123 &lcd_framebuffer[0][0], 125 font_get,
124 lcd_blit,
125#ifndef SIMULATOR
126 lcd_roll,
127#endif
128#endif 126#endif
129 backlight_on, 127 backlight_on,
130 backlight_off, 128 backlight_off,
@@ -395,6 +393,9 @@ int plugin_load(const char* plugin, void* parameter)
395 /* explicitly casting the pointer here to avoid touching every plugin. */ 393 /* explicitly casting the pointer here to avoid touching every plugin. */
396 394
397 button_clear_queue(); 395 button_clear_queue();
396#ifdef HAVE_LCD_BITMAP
397 lcd_set_drawmode(DRMODE_SOLID);
398#endif
398 399
399 plugin_loaded = false; 400 plugin_loaded = false;
400 401
diff --git a/apps/plugin.h b/apps/plugin.h
index 68916b8001..6d2b6e5bf0 100644
--- a/apps/plugin.h
+++ b/apps/plugin.h
@@ -94,12 +94,12 @@
94#endif 94#endif
95 95
96/* increase this every time the api struct changes */ 96/* increase this every time the api struct changes */
97#define PLUGIN_API_VERSION 40 97#define PLUGIN_API_VERSION 41
98 98
99/* update this to latest version if a change to the api struct breaks 99/* update this to latest version if a change to the api struct breaks
100 backwards compatibility (and please take the opportunity to sort in any 100 backwards compatibility (and please take the opportunity to sort in any
101 new function which are "waiting" at the end of the function table) */ 101 new function which are "waiting" at the end of the function table) */
102#define PLUGIN_MIN_API_VERSION 40 102#define PLUGIN_MIN_API_VERSION 41
103 103
104/* plugin return codes */ 104/* plugin return codes */
105enum plugin_status { 105enum plugin_status {
@@ -144,11 +144,11 @@ struct plugin_api {
144 int (*plugin_test)(int api_version, int model, int memsize); 144 int (*plugin_test)(int api_version, int model, int memsize);
145 145
146 /* lcd */ 146 /* lcd */
147 void (*lcd_set_contrast)(int x);
147 void (*lcd_clear_display)(void); 148 void (*lcd_clear_display)(void);
148 void (*lcd_puts)(int x, int y, const unsigned char *string); 149 void (*lcd_puts)(int x, int y, const unsigned char *string);
149 void (*lcd_puts_scroll)(int x, int y, const unsigned char* string); 150 void (*lcd_puts_scroll)(int x, int y, const unsigned char* string);
150 void (*lcd_stop_scroll)(void); 151 void (*lcd_stop_scroll)(void);
151 void (*lcd_set_contrast)(int x);
152#ifdef HAVE_LCD_CHARCELLS 152#ifdef HAVE_LCD_CHARCELLS
153 void (*lcd_define_pattern)(int which,const char *pattern); 153 void (*lcd_define_pattern)(int which,const char *pattern);
154 unsigned char (*lcd_get_locked_pattern)(void); 154 unsigned char (*lcd_get_locked_pattern)(void);
@@ -158,34 +158,32 @@ struct plugin_api {
158 void (*lcd_remove_cursor)(void); 158 void (*lcd_remove_cursor)(void);
159 void (*PREFIX(lcd_icon))(int icon, bool enable); 159 void (*PREFIX(lcd_icon))(int icon, bool enable);
160#else 160#else
161#ifndef SIMULATOR
162 void (*lcd_roll)(int pixels);
163#endif
164 void (*lcd_set_drawmode)(int mode);
165 int (*lcd_get_drawmode)(void);
166 void (*lcd_setfont)(int font);
167 int (*lcd_getstringsize)(const unsigned char *str, int *w, int *h);
168 void (*lcd_drawpixel)(int x, int y);
169 void (*lcd_drawline)(int x1, int y1, int x2, int y2);
170 void (*lcd_drawrect)(int x, int y, int nx, int ny);
171 void (*lcd_fillrect)(int x, int y, int nx, int ny);
172 void (*lcd_bitmap)(const unsigned char *src, int x, int y,
173 int nx, int ny, bool clear);
161 void (*lcd_putsxy)(int x, int y, const unsigned char *string); 174 void (*lcd_putsxy)(int x, int y, const unsigned char *string);
162 void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style); 175 void (*lcd_puts_style)(int x, int y, const unsigned char *str, int style);
163 void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string, 176 void (*lcd_puts_scroll_style)(int x, int y, const unsigned char* string,
164 int style); 177 int style);
165 void (*lcd_bitmap)(const unsigned char *src, int x, int y, 178 unsigned char* lcd_framebuffer;
166 int nx, int ny, bool clear); 179 void (*lcd_blit) (const unsigned char* p_data, int x, int y, int width,
167 void (*lcd_drawline)(int x1, int y1, int x2, int y2); 180 int height, int stride);
168 void (*lcd_clearline)(int x1, int y1, int x2, int y2);
169 void (*lcd_drawpixel)(int x, int y);
170 void (*lcd_clearpixel)(int x, int y);
171 void (*lcd_setfont)(int font);
172 struct font* (*font_get)(int font);
173 void (*lcd_clearrect)(int x, int y, int nx, int ny);
174 void (*lcd_fillrect)(int x, int y, int nx, int ny);
175 void (*lcd_drawrect)(int x, int y, int nx, int ny);
176 void (*lcd_invertrect)(int x, int y, int nx, int ny);
177 int (*lcd_getstringsize)(const unsigned char *str, int *w, int *h);
178 void (*lcd_update)(void); 181 void (*lcd_update)(void);
179 void (*lcd_update_rect)(int x, int y, int width, int height); 182 void (*lcd_update_rect)(int x, int y, int width, int height);
180 void (*scrollbar)(int x, int y, int width, int height, int items, 183 void (*scrollbar)(int x, int y, int width, int height, int items,
181 int min_shown, int max_shown, int orientation); 184 int min_shown, int max_shown, int orientation);
182 void (*checkbox)(int x, int y, int width, int height, bool checked); 185 void (*checkbox)(int x, int y, int width, int height, bool checked);
183 unsigned char* lcd_framebuffer; 186 struct font* (*font_get)(int font);
184 void (*lcd_blit) (const unsigned char* p_data, int x, int y, int width,
185 int height, int stride);
186#ifndef SIMULATOR
187 void (*lcd_roll)(int pixels);
188#endif
189#endif 187#endif
190 void (*backlight_on)(void); 188 void (*backlight_on)(void);
191 void (*backlight_off)(void); 189 void (*backlight_off)(void);
diff --git a/apps/plugins/calculator.c b/apps/plugins/calculator.c
index 5263ab3bd7..9d5ae205b9 100644
--- a/apps/plugins/calculator.c
+++ b/apps/plugins/calculator.c
@@ -394,9 +394,11 @@ void cal_initial (void)
394 n = 1; 394 n = 1;
395 prev_m = m; 395 prev_m = m;
396 prev_n = n; 396 prev_n = n;
397 rb->lcd_invertrect( X_0_POS + n*REC_WIDTH + 1, 397 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
398 Y_1_POS + m*REC_HEIGHT + 1, 398 rb->lcd_fillrect( X_0_POS + n*REC_WIDTH + 1,
399 REC_WIDTH - 1, REC_HEIGHT - 1); 399 Y_1_POS + m*REC_HEIGHT + 1,
400 REC_WIDTH - 1, REC_HEIGHT - 1);
401 rb->lcd_set_drawmode(DRMODE_SOLID);
400 rb->lcd_update(); 402 rb->lcd_update();
401 403
402 /* initial mem and output display*/ 404 /* initial mem and output display*/
@@ -689,13 +691,15 @@ void moveButton(void){
689 break; 691 break;
690 } 692 }
691 693
692 rb->lcd_invertrect( X_0_POS + prev_n*REC_WIDTH + 1, 694 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
693 Y_1_POS + prev_m*REC_HEIGHT + 1, 695 rb->lcd_fillrect( X_0_POS + prev_n*REC_WIDTH + 1,
694 REC_WIDTH - 1, REC_HEIGHT - 1); 696 Y_1_POS + prev_m*REC_HEIGHT + 1,
697 REC_WIDTH - 1, REC_HEIGHT - 1);
695 698
696 rb->lcd_invertrect( X_0_POS + n*REC_WIDTH + 1, 699 rb->lcd_fillrect( X_0_POS + n*REC_WIDTH + 1,
697 Y_1_POS + m*REC_HEIGHT + 1, 700 Y_1_POS + m*REC_HEIGHT + 1,
698 REC_WIDTH - 1, REC_HEIGHT - 1); 701 REC_WIDTH - 1, REC_HEIGHT - 1);
702 rb->lcd_set_drawmode(DRMODE_SOLID);
699 703
700 rb->lcd_update_rect( X_0_POS + prev_n*REC_WIDTH + 1, 704 rb->lcd_update_rect( X_0_POS + prev_n*REC_WIDTH + 1,
701 Y_1_POS + prev_m*REC_HEIGHT + 1, 705 Y_1_POS + prev_m*REC_HEIGHT + 1,
@@ -718,9 +722,11 @@ void printButtonGroups(int group)
718 for (i = 0; i < 5; i++){ 722 for (i = 0; i < 5; i++){
719 for (j = 3; j <= 4; j++){ 723 for (j = 3; j <= 4; j++){
720 rb->lcd_getstringsize( buttonChar[group][i][j],&w,&h); 724 rb->lcd_getstringsize( buttonChar[group][i][j],&w,&h);
721 rb->lcd_clearrect( X_0_POS + j*REC_WIDTH + 1, 725 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
722 Y_1_POS + i*REC_HEIGHT + 1, 726 rb->lcd_fillrect( X_0_POS + j*REC_WIDTH + 1,
723 REC_WIDTH - 1, REC_HEIGHT - 1); 727 Y_1_POS + i*REC_HEIGHT + 1,
728 REC_WIDTH - 1, REC_HEIGHT - 1);
729 rb->lcd_set_drawmode(DRMODE_SOLID);
724 rb->lcd_putsxy( X_0_POS + j*REC_WIDTH + (REC_WIDTH - w)/2, 730 rb->lcd_putsxy( X_0_POS + j*REC_WIDTH + (REC_WIDTH - w)/2,
725 TEXT_2_POS + i*REC_HEIGHT, 731 TEXT_2_POS + i*REC_HEIGHT,
726 buttonChar[group][i][j] ); 732 buttonChar[group][i][j] );
@@ -729,17 +735,21 @@ void printButtonGroups(int group)
729 for (i = 0; i <= 0; i++){ 735 for (i = 0; i <= 0; i++){
730 for (j = 0; j <= 2; j++){ 736 for (j = 0; j <= 2; j++){
731 rb->lcd_getstringsize( buttonChar[group][i][j],&w,&h); 737 rb->lcd_getstringsize( buttonChar[group][i][j],&w,&h);
732 rb->lcd_clearrect( X_0_POS + j*REC_WIDTH + 1, 738 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
733 Y_1_POS + i*REC_HEIGHT + 1, 739 rb->lcd_fillrect( X_0_POS + j*REC_WIDTH + 1,
734 REC_WIDTH - 1, REC_HEIGHT - 1); 740 Y_1_POS + i*REC_HEIGHT + 1,
741 REC_WIDTH - 1, REC_HEIGHT - 1);
742 rb->lcd_set_drawmode(DRMODE_SOLID);
735 rb->lcd_putsxy( X_0_POS + j*REC_WIDTH + (REC_WIDTH - w)/2, 743 rb->lcd_putsxy( X_0_POS + j*REC_WIDTH + (REC_WIDTH - w)/2,
736 TEXT_2_POS + i*REC_HEIGHT, 744 TEXT_2_POS + i*REC_HEIGHT,
737 buttonChar[group][i][j] ); 745 buttonChar[group][i][j] );
738 } 746 }
739 } 747 }
740 rb->lcd_invertrect( X_0_POS + 2*REC_WIDTH + 1, 748 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
741 Y_1_POS + 0*REC_HEIGHT + 1, 749 rb->lcd_fillrect( X_0_POS + 2*REC_WIDTH + 1,
742 REC_WIDTH - 1, REC_HEIGHT - 1); 750 Y_1_POS + 0*REC_HEIGHT + 1,
751 REC_WIDTH - 1, REC_HEIGHT - 1);
752 rb->lcd_set_drawmode(DRMODE_SOLID);
743 rb->lcd_update_rect( X_0_POS, Y_1_POS, 753 rb->lcd_update_rect( X_0_POS, Y_1_POS,
744 REC_WIDTH*5, REC_HEIGHT*5); 754 REC_WIDTH*5, REC_HEIGHT*5);
745} 755}
@@ -750,10 +760,11 @@ void flashButton(int b)
750{ 760{
751 int i = b/5; int j = b - i*5; 761 int i = b/5; int j = b - i*5;
752 int k; 762 int k;
763 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
753 for (k=1*2;k>0;k--){ 764 for (k=1*2;k>0;k--){
754 rb->lcd_invertrect( X_0_POS + j*REC_WIDTH + 1, 765 rb->lcd_fillrect( X_0_POS + j*REC_WIDTH + 1,
755 Y_1_POS + i*REC_HEIGHT + 1, 766 Y_1_POS + i*REC_HEIGHT + 1,
756 REC_WIDTH - 1, REC_HEIGHT - 1); 767 REC_WIDTH - 1, REC_HEIGHT - 1);
757 rb->lcd_update_rect( X_0_POS + j*REC_WIDTH + 1, 768 rb->lcd_update_rect( X_0_POS + j*REC_WIDTH + 1,
758 Y_1_POS + i*REC_HEIGHT + 1, 769 Y_1_POS + i*REC_HEIGHT + 1,
759 REC_WIDTH - 1, REC_HEIGHT - 1); 770 REC_WIDTH - 1, REC_HEIGHT - 1);
@@ -762,6 +773,7 @@ void flashButton(int b)
762 rb->sleep(HZ/22); 773 rb->sleep(HZ/22);
763 774
764 } 775 }
776 rb->lcd_set_drawmode(DRMODE_SOLID);
765} 777}
766 778
767/* ----------------------------------------------------------------------- 779/* -----------------------------------------------------------------------
@@ -778,7 +790,9 @@ void deleteAnimation(int pos)
778 790
779 for (k=1;k<=4;k++){ 791 for (k=1;k<=4;k++){
780 rb->sleep(HZ/32); 792 rb->sleep(HZ/32);
781 rb->lcd_clearrect(1+pos*6, TEXT_1_POS, 6, 8); 793 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
794 rb->lcd_fillrect(1+pos*6, TEXT_1_POS, 6, 8);
795 rb->lcd_set_drawmode(DRMODE_SOLID);
782 rb->lcd_fillrect(1+pos*6+1+k, TEXT_1_POS+k, 796 rb->lcd_fillrect(1+pos*6+1+k, TEXT_1_POS+k,
783 (5-2*k)>0?(5-2*k):1, (7-2*k)>0?(7-2*k):1 ); 797 (5-2*k)>0?(5-2*k):1, (7-2*k)>0?(7-2*k):1 );
784 rb->lcd_update_rect(1+pos*6, TEXT_1_POS, 6, 8); 798 rb->lcd_update_rect(1+pos*6, TEXT_1_POS, 6, 8);
diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c
index 8627c9a558..df23afd721 100644
--- a/apps/plugins/calendar.c
+++ b/apps/plugins/calendar.c
@@ -154,7 +154,9 @@ static void draw_calendar(struct shown *shown)
154 rb->lcd_putsxy(ws, (row * h) + 5 ,buffer); 154 rb->lcd_putsxy(ws, (row * h) + 5 ,buffer);
155 if (shown->mday == j) 155 if (shown->mday == j)
156 { 156 {
157 rb->lcd_invertrect(ws, row*h+5, space, h); 157 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
158 rb->lcd_fillrect(ws, row*h+5, space, h);
159 rb->lcd_set_drawmode(DRMODE_SOLID);
158 shown->wday = pos; 160 shown->wday = pos;
159 } 161 }
160 ws += space; 162 ws += space;
@@ -520,7 +522,9 @@ static void show_lines(int selected, struct shown *shown)
520 k++; 522 k++;
521 i++; 523 i++;
522 } 524 }
523 rb->lcd_invertrect(0, (pos) * h, LCD_WIDTH, h); 525 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
526 rb->lcd_fillrect(0, (pos) * h, LCD_WIDTH, h);
527 rb->lcd_set_drawmode(DRMODE_SOLID);
524} 528}
525 529
526static void update_memos_shown(struct shown *shown) 530static void update_memos_shown(struct shown *shown)
diff --git a/apps/plugins/chessclock.c b/apps/plugins/chessclock.c
index 766f0223a5..8485d40aae 100644
--- a/apps/plugins/chessclock.c
+++ b/apps/plugins/chessclock.c
@@ -216,7 +216,11 @@ static void show_pause_mode(bool enabled)
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, true);
218 else 218 else
219 rb->lcd_clearrect(52, 0, 7, 8); 219 {
220 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
221 rb->lcd_fillrect(52, 0, 7, 8);
222 rb->lcd_set_drawmode(DRMODE_SOLID);
223 }
220} 224}
221#endif 225#endif
222 226
diff --git a/apps/plugins/clock.c b/apps/plugins/clock.c
index 03ac0921a1..d58f746158 100644
--- a/apps/plugins/clock.c
+++ b/apps/plugins/clock.c
@@ -476,7 +476,9 @@ void save_settings(bool interface)
476 476
477 if(interface) 477 if(interface)
478 { 478 {
479 rb->lcd_clearrect(0, 56, 112, 8); 479 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
480 rb->lcd_fillrect(0, 56, 112, 8);
481 rb->lcd_set_drawmode(DRMODE_SOLID);
480 rb->snprintf(buf, sizeof(buf), "Saved Settings"); 482 rb->snprintf(buf, sizeof(buf), "Saved Settings");
481 rb->lcd_getstringsize(buf, &buf_w, &buf_h); 483 rb->lcd_getstringsize(buf, &buf_w, &buf_h);
482 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); 484 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf);
@@ -486,7 +488,9 @@ void save_settings(bool interface)
486 { 488 {
487 if(interface) 489 if(interface)
488 { 490 {
489 rb->lcd_clearrect(0, 56, 112, 8); 491 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
492 rb->lcd_fillrect(0, 56, 112, 8);
493 rb->lcd_set_drawmode(DRMODE_SOLID);
490 rb->snprintf(buf, sizeof(buf), "Save Failed"); 494 rb->snprintf(buf, sizeof(buf), "Save Failed");
491 rb->lcd_getstringsize(buf, &buf_w, &buf_h); 495 rb->lcd_getstringsize(buf, &buf_w, &buf_h);
492 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); 496 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf);
@@ -529,14 +533,18 @@ void load_settings(void)
529 rb->read(fd, &settings, sizeof(struct saved_settings)); 533 rb->read(fd, &settings, sizeof(struct saved_settings));
530 rb->close(fd); 534 rb->close(fd);
531 535
532 rb->lcd_clearrect(0, 56, 112, 8); 536 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
537 rb->lcd_fillrect(0, 56, 112, 8);
538 rb->lcd_set_drawmode(DRMODE_SOLID);
533 rb->snprintf(buf, sizeof(buf), "Loaded Settings"); 539 rb->snprintf(buf, sizeof(buf), "Loaded Settings");
534 rb->lcd_getstringsize(buf, &buf_w, &buf_h); 540 rb->lcd_getstringsize(buf, &buf_w, &buf_h);
535 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); 541 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf);
536 } 542 }
537 else /* bail out */ 543 else /* bail out */
538 { 544 {
539 rb->lcd_clearrect(0, 56, 112, 8); 545 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
546 rb->lcd_fillrect(0, 56, 112, 8);
547 rb->lcd_set_drawmode(DRMODE_SOLID);
540 rb->snprintf(buf, sizeof(buf), "Old Settings File"); 548 rb->snprintf(buf, sizeof(buf), "Old Settings File");
541 rb->lcd_getstringsize(buf, &buf_w, &buf_h); 549 rb->lcd_getstringsize(buf, &buf_w, &buf_h);
542 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); 550 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf);
@@ -545,7 +553,9 @@ void load_settings(void)
545 } 553 }
546 else /* bail out */ 554 else /* bail out */
547 { 555 {
548 rb->lcd_clearrect(0, 56, 112, 8); 556 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
557 rb->lcd_fillrect(0, 56, 112, 8);
558 rb->lcd_set_drawmode(DRMODE_SOLID);
549 rb->snprintf(buf, sizeof(buf), "No Settings File"); 559 rb->snprintf(buf, sizeof(buf), "No Settings File");
550 rb->lcd_getstringsize(buf, &buf_w, &buf_h); 560 rb->lcd_getstringsize(buf, &buf_w, &buf_h);
551 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf); 561 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 56, buf);
@@ -1014,8 +1024,7 @@ void show_logo(bool animate, bool show_clock_text)
1014{ 1024{
1015 int y_position; 1025 int y_position;
1016 1026
1017 unsigned char *clogo = 0; 1027 unsigned char *clogo = (unsigned char *)clocklogo;
1018 clogo = (unsigned char *)clocklogo;
1019 1028
1020 rb->snprintf(buf, sizeof(buf), "Clock %s", CLOCK_VERSION); 1029 rb->snprintf(buf, sizeof(buf), "Clock %s", CLOCK_VERSION);
1021 rb->lcd_getstringsize(buf, &buf_w, &buf_h); 1030 rb->lcd_getstringsize(buf, &buf_w, &buf_h);
@@ -1026,8 +1035,10 @@ void show_logo(bool animate, bool show_clock_text)
1026 /* move down the screen */ 1035 /* move down the screen */
1027 for(y_position = 0; y_position <= 26; y_position++) 1036 for(y_position = 0; y_position <= 26; y_position++)
1028 { 1037 {
1029 rb->lcd_clearline(0, y_position/2-1, 111, y_position/2-1); 1038 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1030 rb->lcd_clearline(0, y_position/2+38, 111, y_position/2+38); 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);
1041 rb->lcd_set_drawmode(DRMODE_SOLID);
1031 rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37, true); 1042 rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37, true);
1032 if(show_clock_text) 1043 if(show_clock_text)
1033 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf); 1044 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf);
@@ -1036,8 +1047,10 @@ void show_logo(bool animate, bool show_clock_text)
1036 /* bounce back up a little */ 1047 /* bounce back up a little */
1037 for(y_position = 26; y_position >= 16; y_position--) 1048 for(y_position = 26; y_position >= 16; y_position--)
1038 { 1049 {
1039 rb->lcd_clearline(0, y_position/2-1, 111, y_position/2-1); 1050 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1040 rb->lcd_clearline(0, y_position/2+38, 111, y_position/2+38); 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);
1053 rb->lcd_set_drawmode(DRMODE_SOLID);
1041 rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37, true); 1054 rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37, true);
1042 if(show_clock_text) 1055 if(show_clock_text)
1043 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf); 1056 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf);
@@ -1046,8 +1059,10 @@ void show_logo(bool animate, bool show_clock_text)
1046 /* and go back down again */ 1059 /* and go back down again */
1047 for(y_position = 16; y_position <= 20; y_position++) 1060 for(y_position = 16; y_position <= 20; y_position++)
1048 { 1061 {
1049 rb->lcd_clearline(0, y_position/2-1, 111, y_position/2-1); 1062 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1050 rb->lcd_clearline(0, y_position/2+38, 111, y_position/2+38); 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);
1065 rb->lcd_set_drawmode(DRMODE_SOLID);
1051 rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37, true); 1066 rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37, true);
1052 if(show_clock_text) 1067 if(show_clock_text)
1053 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf); 1068 rb->lcd_putsxy(LCD_WIDTH/2-buf_w/2, 48, buf);
@@ -1076,7 +1091,9 @@ void exit_logo(void)
1076 /* fly downwards */ 1091 /* fly downwards */
1077 for(y_position = 20; y_position <= 128; y_position++) 1092 for(y_position = 20; y_position <= 128; y_position++)
1078 { 1093 {
1079 rb->lcd_clearline(0, y_position/2-1, 111, y_position/2-1); 1094 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1095 rb->lcd_drawline(0, y_position/2-1, 111, y_position/2-1);
1096 rb->lcd_set_drawmode(DRMODE_SOLID);
1080 rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37, true); 1097 rb->lcd_bitmap(clogo, 0, y_position/2, 112, 37, true);
1081 rb->lcd_update(); 1098 rb->lcd_update();
1082 } 1099 }
@@ -1112,7 +1129,9 @@ bool roll_credits(void)
1112 /* fly in text from the left */ 1129 /* fly in text from the left */
1113 for(credits_pos = 0 - credits_w; credits_pos <= (LCD_WIDTH/2)-(credits_w/2); credits_pos++) 1130 for(credits_pos = 0 - credits_w; credits_pos <= (LCD_WIDTH/2)-(credits_w/2); credits_pos++)
1114 { 1131 {
1115 rb->lcd_clearline(credits_pos-1, 0, credits_pos-1, 8); 1132 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1133 rb->lcd_drawline(credits_pos-1, 0, credits_pos-1, 8);
1134 rb->lcd_set_drawmode(DRMODE_SOLID);
1116 rb->lcd_putsxy(credits_pos, 0, elapsednames); 1135 rb->lcd_putsxy(credits_pos, 0, elapsednames);
1117 rb->lcd_update(); /* update the whole lcd to slow down the loop */ 1136 rb->lcd_update(); /* update the whole lcd to slow down the loop */
1118 } 1137 }
@@ -1121,7 +1140,9 @@ bool roll_credits(void)
1121 for(progress_pos = LCD_WIDTH; progress_pos >= 40; progress_pos--) 1140 for(progress_pos = LCD_WIDTH; progress_pos >= 40; progress_pos--)
1122 { 1141 {
1123 rb->scrollbar(progress_pos, 9, LCD_WIDTH-progress_pos, 7, numnames*4, 0, progress_percent, HORIZONTAL); 1142 rb->scrollbar(progress_pos, 9, LCD_WIDTH-progress_pos, 7, numnames*4, 0, progress_percent, HORIZONTAL);
1124 rb->lcd_clearline(0, 0, 0, 30); 1143 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1144 rb->lcd_drawline(0, 0, 0, 30);
1145 rb->lcd_set_drawmode(DRMODE_SOLID);
1125 rb->lcd_update(); /* update the whole lcd to slow down the loop */ 1146 rb->lcd_update(); /* update the whole lcd to slow down the loop */
1126 } 1147 }
1127 1148
@@ -1146,7 +1167,9 @@ bool roll_credits(void)
1146 /* line 1 flies in */ 1167 /* line 1 flies in */
1147 for (namepos=0-name_w; namepos < (LCD_WIDTH/2)-(name_w/2)-2; namepos++) 1168 for (namepos=0-name_w; namepos < (LCD_WIDTH/2)-(name_w/2)-2; namepos++)
1148 { 1169 {
1149 rb->lcd_clearrect(0, 48, 112, 8); /* clear any trails left behind */ 1170 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1171 rb->lcd_fillrect(0, 48, 112, 8); /* clear any trails left behind */
1172 rb->lcd_set_drawmode(DRMODE_SOLID);
1150 rb->lcd_putsxy(namepos, 48, name); 1173 rb->lcd_putsxy(namepos, 48, name);
1151 rb->lcd_update(); 1174 rb->lcd_update();
1152 1175
@@ -1163,7 +1186,9 @@ bool roll_credits(void)
1163 /* now line 2 flies in */ 1186 /* now line 2 flies in */
1164 for(jobpos=LCD_WIDTH; jobpos > (LCD_WIDTH/2)-(job_w+2)/2; jobpos--) /* we use (job_w+2) to ensure it fits on the LCD */ 1187 for(jobpos=LCD_WIDTH; jobpos > (LCD_WIDTH/2)-(job_w+2)/2; jobpos--) /* we use (job_w+2) to ensure it fits on the LCD */
1165 { 1188 {
1166 rb->lcd_clearrect(0, 56, 112, 8); /* clear trails */ 1189 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1190 rb->lcd_fillrect(0, 56, 112, 8); /* clear trails */
1191 rb->lcd_set_drawmode(DRMODE_SOLID);
1167 rb->lcd_putsxy(jobpos, 56, job); 1192 rb->lcd_putsxy(jobpos, 56, job);
1168 rb->lcd_update(); 1193 rb->lcd_update();
1169 1194
@@ -1185,7 +1210,9 @@ bool roll_credits(void)
1185 namepos++; 1210 namepos++;
1186 jobpos--; 1211 jobpos--;
1187 1212
1188 rb->lcd_clearrect(0, 48, 112, 16); 1213 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1214 rb->lcd_fillrect(0, 48, 112, 16);
1215 rb->lcd_set_drawmode(DRMODE_SOLID);
1189 rb->lcd_putsxy(namepos, 48, name); 1216 rb->lcd_putsxy(namepos, 48, name);
1190 rb->lcd_putsxy(jobpos, 56, job); 1217 rb->lcd_putsxy(jobpos, 56, job);
1191 rb->lcd_update(); 1218 rb->lcd_update();
@@ -1204,7 +1231,9 @@ bool roll_credits(void)
1204 jobpos=((LCD_WIDTH/2)-(job_w+2)/2)-8; 1231 jobpos=((LCD_WIDTH/2)-(job_w+2)/2)-8;
1205 while(namepos<LCD_WIDTH || jobpos > 0-job_w) 1232 while(namepos<LCD_WIDTH || jobpos > 0-job_w)
1206 { 1233 {
1207 rb->lcd_clearrect(0, 48, 112, 16); /* clear trails */ 1234 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1235 rb->lcd_fillrect(0, 48, 112, 16); /* clear trails */
1236 rb->lcd_set_drawmode(DRMODE_SOLID);
1208 rb->lcd_putsxy(namepos, 48, name); 1237 rb->lcd_putsxy(namepos, 48, name);
1209 rb->lcd_putsxy(jobpos, 56, job); 1238 rb->lcd_putsxy(jobpos, 56, job);
1210 rb->lcd_update(); 1239 rb->lcd_update();
@@ -1233,7 +1262,9 @@ bool roll_credits(void)
1233 /* now make the text exit to the right */ 1262 /* now make the text exit to the right */
1234 for(credits_pos = (LCD_WIDTH/2)-(credits_w/2); credits_pos <= 112; credits_pos++) 1263 for(credits_pos = (LCD_WIDTH/2)-(credits_w/2); credits_pos <= 112; credits_pos++)
1235 { 1264 {
1236 rb->lcd_clearline(credits_pos-1, 0, credits_pos-1, 8); 1265 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1266 rb->lcd_drawline(credits_pos-1, 0, credits_pos-1, 8);
1267 rb->lcd_set_drawmode(DRMODE_SOLID);
1237 rb->lcd_putsxy(credits_pos, 0, elapsednames); 1268 rb->lcd_putsxy(credits_pos, 0, elapsednames);
1238 rb->lcd_update(); 1269 rb->lcd_update();
1239 } 1270 }
@@ -1241,7 +1272,9 @@ bool roll_credits(void)
1241 /* fold progressbar in to the right */ 1272 /* fold progressbar in to the right */
1242 for(progress_pos = 42; progress_pos < 112; progress_pos++) 1273 for(progress_pos = 42; progress_pos < 112; progress_pos++)
1243 { 1274 {
1244 rb->lcd_clearline(progress_pos-1, 8, progress_pos-1, 16); 1275 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1276 rb->lcd_drawline(progress_pos-1, 8, progress_pos-1, 16);
1277 rb->lcd_set_drawmode(DRMODE_SOLID);
1245 rb->scrollbar(progress_pos, 9, LCD_WIDTH-progress_pos, 7, numnames*4, 0, progress_percent, HORIZONTAL); 1278 rb->scrollbar(progress_pos, 9, LCD_WIDTH-progress_pos, 7, numnames*4, 0, progress_percent, HORIZONTAL);
1246 rb->lcd_update(); /* update the whole lcd to slow down the loop */ 1279 rb->lcd_update(); /* update the whole lcd to slow down the loop */
1247 } 1280 }
@@ -1292,7 +1325,7 @@ bool show_credits(void)
1292 1325
1293void cleanup(void *parameter) 1326void cleanup(void *parameter)
1294{ 1327{
1295 (void)parameter; /* unused */ 1328 (void)parameter;
1296 1329
1297 if(settings.save_mode == 1) 1330 if(settings.save_mode == 1)
1298 save_settings(true); 1331 save_settings(true);
@@ -1306,12 +1339,16 @@ void cleanup(void *parameter)
1306 *************/ 1339 *************/
1307void cursor(int x, int y, int w, int h) 1340void cursor(int x, int y, int w, int h)
1308{ 1341{
1309 rb->lcd_invertrect(x, y, w, h); 1342 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
1310 1343 rb->lcd_fillrect(x, y, w, h);
1311 rb->lcd_clearpixel(x, y); 1344
1312 rb->lcd_clearpixel(x+w-1, y); 1345 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1313 rb->lcd_clearpixel(x, y+h-1); 1346 rb->lcd_drawpixel(x, y);
1314 rb->lcd_clearpixel(x+w-1, y+h-1); 1347 rb->lcd_drawpixel(x+w-1, y);
1348 rb->lcd_drawpixel(x, y+h-1);
1349 rb->lcd_drawpixel(x+w-1, y+h-1);
1350
1351 rb->lcd_set_drawmode(DRMODE_SOLID);
1315} 1352}
1316 1353
1317/****************** 1354/******************
@@ -1670,7 +1707,9 @@ bool f3_screen(void)
1670 analog_dummy = analog_y; 1707 analog_dummy = analog_y;
1671 for(; analog_y>analog_dummy-8; analog_y--) 1708 for(; analog_y>analog_dummy-8; analog_y--)
1672 { 1709 {
1673 rb->lcd_clearrect(0, 32, 112, 32); 1710 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1711 rb->lcd_fillrect(0, 32, 112, 32);
1712 rb->lcd_set_drawmode(DRMODE_SOLID);
1674 draw_settings(); 1713 draw_settings();
1675 cursor(0, analog_y, 112, 8); 1714 cursor(0, analog_y, 112, 8);
1676 rb->lcd_update(); 1715 rb->lcd_update();
@@ -1686,7 +1725,9 @@ bool f3_screen(void)
1686 analog_dummy = analog_y; 1725 analog_dummy = analog_y;
1687 for(; analog_y<analog_dummy+8; analog_y++) 1726 for(; analog_y<analog_dummy+8; analog_y++)
1688 { 1727 {
1689 rb->lcd_clearrect(0, 32, 112, 32); 1728 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1729 rb->lcd_fillrect(0, 32, 112, 32);
1730 rb->lcd_set_drawmode(DRMODE_SOLID);
1690 draw_settings(); 1731 draw_settings();
1691 cursor(0, analog_y, 112, 8); 1732 cursor(0, analog_y, 112, 8);
1692 rb->lcd_update(); 1733 rb->lcd_update();
@@ -1758,7 +1799,9 @@ bool f3_screen(void)
1758 digital_dummy = digital_y; 1799 digital_dummy = digital_y;
1759 for(; digital_y>digital_dummy-8; digital_y--) 1800 for(; digital_y>digital_dummy-8; digital_y--)
1760 { 1801 {
1761 rb->lcd_clearrect(0, 32, 112, 32); 1802 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1803 rb->lcd_fillrect(0, 32, 112, 32);
1804 rb->lcd_set_drawmode(DRMODE_SOLID);
1762 draw_settings(); 1805 draw_settings();
1763 cursor(0, digital_y, 112, 8); 1806 cursor(0, digital_y, 112, 8);
1764 rb->lcd_update(); 1807 rb->lcd_update();
@@ -1774,7 +1817,9 @@ bool f3_screen(void)
1774 digital_dummy = digital_y; 1817 digital_dummy = digital_y;
1775 for(; digital_y<digital_dummy+8; digital_y++) 1818 for(; digital_y<digital_dummy+8; digital_y++)
1776 { 1819 {
1777 rb->lcd_clearrect(0, 32, 112, 32); 1820 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1821 rb->lcd_fillrect(0, 32, 112, 32);
1822 rb->lcd_set_drawmode(DRMODE_SOLID);
1778 draw_settings(); 1823 draw_settings();
1779 cursor(0, digital_y, 112, 8); 1824 cursor(0, digital_y, 112, 8);
1780 rb->lcd_update(); 1825 rb->lcd_update();
@@ -1846,7 +1891,9 @@ bool f3_screen(void)
1846 lcd_dummy = lcd_y; 1891 lcd_dummy = lcd_y;
1847 for(; lcd_y>lcd_dummy-8; lcd_y--) 1892 for(; lcd_y>lcd_dummy-8; lcd_y--)
1848 { 1893 {
1849 rb->lcd_clearrect(0, 32, 112, 32); 1894 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1895 rb->lcd_fillrect(0, 32, 112, 32);
1896 rb->lcd_set_drawmode(DRMODE_SOLID);
1850 draw_settings(); 1897 draw_settings();
1851 cursor(0, lcd_y, 112, 8); 1898 cursor(0, lcd_y, 112, 8);
1852 rb->lcd_update(); 1899 rb->lcd_update();
@@ -1862,7 +1909,9 @@ bool f3_screen(void)
1862 lcd_dummy = lcd_y; 1909 lcd_dummy = lcd_y;
1863 for(; lcd_y<lcd_dummy+8; lcd_y++) 1910 for(; lcd_y<lcd_dummy+8; lcd_y++)
1864 { 1911 {
1865 rb->lcd_clearrect(0, 32, 112, 32); 1912 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1913 rb->lcd_fillrect(0, 32, 112, 32);
1914 rb->lcd_set_drawmode(DRMODE_SOLID);
1866 draw_settings(); 1915 draw_settings();
1867 cursor(0, lcd_y, 112, 8); 1916 cursor(0, lcd_y, 112, 8);
1868 rb->lcd_update(); 1917 rb->lcd_update();
@@ -1935,7 +1984,9 @@ bool f3_screen(void)
1935 full_dummy = full_y; 1984 full_dummy = full_y;
1936 for(; full_y>full_dummy-8; full_y--) 1985 for(; full_y>full_dummy-8; full_y--)
1937 { 1986 {
1938 rb->lcd_clearrect(0, 32, 112, 32); 1987 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1988 rb->lcd_fillrect(0, 32, 112, 32);
1989 rb->lcd_set_drawmode(DRMODE_SOLID);
1939 draw_settings(); 1990 draw_settings();
1940 cursor(0, full_y, 112, 8); 1991 cursor(0, full_y, 112, 8);
1941 rb->lcd_update(); 1992 rb->lcd_update();
@@ -1951,7 +2002,9 @@ bool f3_screen(void)
1951 full_dummy = full_y; 2002 full_dummy = full_y;
1952 for(; full_y<full_dummy+8; full_y++) 2003 for(; full_y<full_dummy+8; full_y++)
1953 { 2004 {
1954 rb->lcd_clearrect(0, 32, 112, 32); 2005 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
2006 rb->lcd_fillrect(0, 32, 112, 32);
2007 rb->lcd_set_drawmode(DRMODE_SOLID);
1955 draw_settings(); 2008 draw_settings();
1956 cursor(0, full_y, 112, 8); 2009 cursor(0, full_y, 112, 8);
1957 rb->lcd_update(); 2010 rb->lcd_update();
@@ -2115,7 +2168,9 @@ void general_settings(void)
2115 cursor_dummy = cursor_y; 2168 cursor_dummy = cursor_y;
2116 for(; cursor_y>cursor_dummy-8; cursor_y--) 2169 for(; cursor_y>cursor_dummy-8; cursor_y--)
2117 { 2170 {
2118 rb->lcd_clearrect(0, 16, 112, 32); 2171 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
2172 rb->lcd_fillrect(0, 16, 112, 32);
2173 rb->lcd_set_drawmode(DRMODE_SOLID);
2119 2174
2120 rb->lcd_puts(2, 2, "Reset Settings"); 2175 rb->lcd_puts(2, 2, "Reset Settings");
2121 rb->lcd_puts(2, 3, "Save Settings"); 2176 rb->lcd_puts(2, 3, "Save Settings");
@@ -2150,7 +2205,9 @@ void general_settings(void)
2150 cursor_dummy = cursor_y; 2205 cursor_dummy = cursor_y;
2151 for(; cursor_y<cursor_dummy+8; cursor_y++) 2206 for(; cursor_y<cursor_dummy+8; cursor_y++)
2152 { 2207 {
2153 rb->lcd_clearrect(0, 16, 112, 32); 2208 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
2209 rb->lcd_fillrect(0, 16, 112, 32);
2210 rb->lcd_set_drawmode(DRMODE_SOLID);
2154 2211
2155 rb->lcd_puts(2, 2, "Reset Settings"); 2212 rb->lcd_puts(2, 2, "Reset Settings");
2156 rb->lcd_puts(2, 3, "Save Settings"); 2213 rb->lcd_puts(2, 3, "Save Settings");
@@ -2313,7 +2370,9 @@ void draw_extras(int year, int day, int month, int hour, int minute, int second)
2313 /* Invert the whole LCD as the seconds go */ 2370 /* Invert the whole LCD as the seconds go */
2314 if(settings.digital_seconds == 3) 2371 if(settings.digital_seconds == 3)
2315 { 2372 {
2316 rb->lcd_invertrect(0, 0, fill, 64); 2373 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
2374 rb->lcd_fillrect(0, 0, fill, 64);
2375 rb->lcd_set_drawmode(DRMODE_SOLID);
2317 } 2376 }
2318 } 2377 }
2319 else if(settings.clock == 3) /* LCD mode */ 2378 else if(settings.clock == 3) /* LCD mode */
@@ -2349,7 +2408,9 @@ void draw_extras(int year, int day, int month, int hour, int minute, int second)
2349 /* Invert the whole LCD as the seconds go */ 2408 /* Invert the whole LCD as the seconds go */
2350 if(settings.lcd_seconds == 3) 2409 if(settings.lcd_seconds == 3)
2351 { 2410 {
2352 rb->lcd_invertrect(0, 0, fill, 64); 2411 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
2412 rb->lcd_fillrect(0, 0, fill, 64);
2413 rb->lcd_set_drawmode(DRMODE_SOLID);
2353 } 2414 }
2354 } 2415 }
2355 else if(settings.clock == 4) /* Fullscreen mode */ 2416 else if(settings.clock == 4) /* Fullscreen mode */
@@ -2368,7 +2429,9 @@ void draw_extras(int year, int day, int month, int hour, int minute, int second)
2368 } 2429 }
2369 if(settings.fullscreen_invertseconds) 2430 if(settings.fullscreen_invertseconds)
2370 { 2431 {
2371 rb->lcd_invertrect(0, 0, fill, 64); 2432 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
2433 rb->lcd_fillrect(0, 0, fill, 64);
2434 rb->lcd_set_drawmode(DRMODE_SOLID);
2372 } 2435 }
2373 } 2436 }
2374} 2437}
@@ -2424,7 +2487,9 @@ void select_mode(void)
2424 cursor_dummy = cursor_y; 2487 cursor_dummy = cursor_y;
2425 for(; cursor_y>cursor_dummy-8; cursor_y--) 2488 for(; cursor_y>cursor_dummy-8; cursor_y--)
2426 { 2489 {
2427 rb->lcd_clearrect(0, 8, 112, 40); 2490 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
2491 rb->lcd_fillrect(0, 8, 112, 40);
2492 rb->lcd_set_drawmode(DRMODE_SOLID);
2428 2493
2429 rb->lcd_puts(0, 0, "MODE SELECTOR"); 2494 rb->lcd_puts(0, 0, "MODE SELECTOR");
2430 rb->lcd_puts(2, 1, "Analog"); 2495 rb->lcd_puts(2, 1, "Analog");
@@ -2456,7 +2521,9 @@ void select_mode(void)
2456 cursor_dummy = cursor_y; 2521 cursor_dummy = cursor_y;
2457 for(; cursor_y<cursor_dummy+8; cursor_y++) 2522 for(; cursor_y<cursor_dummy+8; cursor_y++)
2458 { 2523 {
2459 rb->lcd_clearrect(0, 8, 112, 40); 2524 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
2525 rb->lcd_fillrect(0, 8, 112, 40);
2526 rb->lcd_set_drawmode(DRMODE_SOLID);
2460 2527
2461 rb->lcd_puts(0, 0, "MODE SELECTOR"); 2528 rb->lcd_puts(0, 0, "MODE SELECTOR");
2462 rb->lcd_puts(2, 1, "Analog"); 2529 rb->lcd_puts(2, 1, "Analog");
@@ -2516,7 +2583,9 @@ void counter_finished(void)
2516 rb->lcd_bitmap(times_up, 0, xpos, 112, 50, true); 2583 rb->lcd_bitmap(times_up, 0, xpos, 112, 50, true);
2517 2584
2518 /* invert lcd */ 2585 /* invert lcd */
2519 rb->lcd_invertrect(0, 0, 112, 64); 2586 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
2587 rb->lcd_fillrect(0, 0, 112, 64);
2588 rb->lcd_set_drawmode(DRMODE_SOLID);
2520 2589
2521 rb->lcd_update(); 2590 rb->lcd_update();
2522 2591
@@ -2667,14 +2736,16 @@ void counter_options(void)
2667 rb->checkbox(1, 25, 8, 6, !counting_up); 2736 rb->checkbox(1, 25, 8, 6, !counting_up);
2668 2737
2669 /* draw a cursor */ 2738 /* draw a cursor */
2739 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
2670 switch(cursorpos) 2740 switch(cursorpos)
2671 { 2741 {
2672 case 1: rb->lcd_invertrect(0, 16, 112, 8); break; 2742 case 1: rb->lcd_fillrect(0, 16, 112, 8); break;
2673 case 2: rb->lcd_invertrect(0, 24, 112, 8); break; 2743 case 2: rb->lcd_fillrect(0, 24, 112, 8); break;
2674 case 3: rb->lcd_invertrect(24, 40, 06, 8); break; 2744 case 3: rb->lcd_fillrect(24, 40, 06, 8); break;
2675 case 4: rb->lcd_invertrect(36, 40, 12, 8); break; 2745 case 4: rb->lcd_fillrect(36, 40, 12, 8); break;
2676 case 5: rb->lcd_invertrect(54, 40, 12, 8); break; 2746 case 5: rb->lcd_fillrect(54, 40, 12, 8); break;
2677 } 2747 }
2748 rb->lcd_set_drawmode(DRMODE_SOLID);
2678 2749
2679 if(cursorpos > 2) 2750 if(cursorpos > 2)
2680 editing_target = true; 2751 editing_target = true;
@@ -2807,7 +2878,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
2807 TEST_PLUGIN_API(api); 2878 TEST_PLUGIN_API(api);
2808 (void)parameter; 2879 (void)parameter;
2809 rb = api; 2880 rb = api;
2810 2881
2811 /* universal font */ 2882 /* universal font */
2812 rb->lcd_setfont(FONT_SYSFIXED); 2883 rb->lcd_setfont(FONT_SYSFIXED);
2813 2884
diff --git a/apps/plugins/databox/databox.c b/apps/plugins/databox/databox.c
index 8fc8c0b499..4e3722b671 100644
--- a/apps/plugins/databox/databox.c
+++ b/apps/plugins/databox/databox.c
@@ -73,8 +73,11 @@ void print(char *word, int invert) {
73 if (printing.font_h*printing.line >= LCD_HEIGHT) 73 if (printing.font_h*printing.line >= LCD_HEIGHT)
74 return; 74 return;
75 rb->lcd_putsxy(printing.font_w*printing.position,printing.font_h*printing.line,word); 75 rb->lcd_putsxy(printing.font_w*printing.position,printing.font_h*printing.line,word);
76 if(invert) 76 if(invert) {
77 rb->lcd_invertrect(printing.font_w*printing.position,printing.font_h*printing.line,printing.font_w*strlen,printing.font_h); 77 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
78 rb->lcd_fillrect(printing.font_w*printing.position,printing.font_h*printing.line,printing.font_w*strlen,printing.font_h);
79 rb->lcd_set_drawmode(DRMODE_SOLID);
80 }
78 rb->lcd_update_rect(printing.font_w*printing.position,printing.font_h*printing.line,printing.font_w*strlen,printing.font_h); 81 rb->lcd_update_rect(printing.font_w*printing.position,printing.font_h*printing.line,printing.font_w*strlen,printing.font_h);
79 printing.position=newpos; 82 printing.position=newpos;
80} 83}
diff --git a/apps/plugins/flipit.c b/apps/plugins/flipit.c
index 7238fa3f75..57cbad213d 100644
--- a/apps/plugins/flipit.c
+++ b/apps/plugins/flipit.c
@@ -92,10 +92,12 @@ static void clear_cursor(void) {
92 int i,j; 92 int i,j;
93 i = (cursor_pos%5)*16; 93 i = (cursor_pos%5)*16;
94 j = (cursor_pos/5)*16; 94 j = (cursor_pos/5)*16;
95 rb->lcd_clearline(i, j, i+15, j); 95 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
96 rb->lcd_clearline(i, j+15, i+15, j+15); 96 rb->lcd_drawline(i, j, i+15, j);
97 rb->lcd_clearline(i, j, i, j+15); 97 rb->lcd_drawline(i, j+15, i+15, j+15);
98 rb->lcd_clearline(i+15, j, i+15, j+15); 98 rb->lcd_drawline(i, j, i, j+15);
99 rb->lcd_drawline(i+15, j, i+15, j+15);
100 rb->lcd_set_drawmode(DRMODE_SOLID);
99} 101}
100 102
101/* check if the puzzle is finished */ 103/* check if the puzzle is finished */
@@ -167,7 +169,9 @@ static void flipit_init(void) {
167 cursor_pos = 0; 169 cursor_pos = 0;
168 draw_cursor(); 170 draw_cursor();
169 moves = 0; 171 moves = 0;
170 rb->lcd_clearrect(80, 0, 32, 64); 172 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
173 rb->lcd_fillrect(80, 0, 32, 64);
174 rb->lcd_set_drawmode(DRMODE_SOLID);
171 rb->lcd_drawrect(80, 0, 32, 64); 175 rb->lcd_drawrect(80, 0, 32, 64);
172 rb->lcd_putsxy(81, 10, "Flips"); 176 rb->lcd_putsxy(81, 10, "Flips");
173 rb->snprintf(s, sizeof(s), "%d", moves); 177 rb->snprintf(s, sizeof(s), "%d", moves);
diff --git a/apps/plugins/minesweeper.c b/apps/plugins/minesweeper.c
index c8d2c01a0d..bf71436464 100644
--- a/apps/plugins/minesweeper.c
+++ b/apps/plugins/minesweeper.c
@@ -383,8 +383,10 @@ int minesweeper(void)
383 } 383 }
384 384
385 /* display the cursor */ 385 /* display the cursor */
386 rb->lcd_invertrect(x*8,y*8,8,8); 386 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
387 387 rb->lcd_fillrect(x*8,y*8,8,8);
388 rb->lcd_set_drawmode(DRMODE_SOLID);
389
388 /* update the screen */ 390 /* update the screen */
389 rb->lcd_update(); 391 rb->lcd_update();
390 392
diff --git a/apps/plugins/mosaique.c b/apps/plugins/mosaique.c
index af5f4d1c01..3d0bfb816a 100644
--- a/apps/plugins/mosaique.c
+++ b/apps/plugins/mosaique.c
@@ -63,6 +63,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
63 63
64#ifdef HAVE_LCD_BITMAP 64#ifdef HAVE_LCD_BITMAP
65 rb->lcd_clear_display(); 65 rb->lcd_clear_display();
66 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
66#else 67#else
67 if (!pgfx_init(rb, 4, 2)) 68 if (!pgfx_init(rb, 4, 2))
68 { 69 {
@@ -101,10 +102,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
101 } 102 }
102 103
103#ifdef HAVE_LCD_BITMAP 104#ifdef HAVE_LCD_BITMAP
104 rb->lcd_invertrect(LARGE-x, HAUT-y, 2*x+1, 1); 105 rb->lcd_fillrect(LARGE-x, HAUT-y, 2*x+1, 1);
105 rb->lcd_invertrect(LARGE-x, HAUT+y, 2*x+1, 1); 106 rb->lcd_fillrect(LARGE-x, HAUT+y, 2*x+1, 1);
106 rb->lcd_invertrect(LARGE-x, HAUT-y+1, 1, 2*y-1); 107 rb->lcd_fillrect(LARGE-x, HAUT-y+1, 1, 2*y-1);
107 rb->lcd_invertrect(LARGE+x, HAUT-y+1, 1, 2*y-1); 108 rb->lcd_fillrect(LARGE+x, HAUT-y+1, 1, 2*y-1);
108 rb->lcd_update(); 109 rb->lcd_update();
109#else 110#else
110 pgfx_invertrect(LARGE-x, HAUT-y, 2*x+1, 1); 111 pgfx_invertrect(LARGE-x, HAUT-y, 2*x+1, 1);
@@ -120,7 +121,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
120 switch (button) 121 switch (button)
121 { 122 {
122 case MOSAIQUE_QUIT: 123 case MOSAIQUE_QUIT:
123#ifdef HAVE_LCD_CHARCELLS 124#ifdef HAVE_LCD_BITMAP
125 rb->lcd_set_drawmode(DRMODE_SOLID);
126#else
124 pgfx_release(); 127 pgfx_release();
125#endif 128#endif
126 return PLUGIN_OK; 129 return PLUGIN_OK;
@@ -148,7 +151,9 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
148 default: 151 default:
149 if (rb->default_event_handler(button) == SYS_USB_CONNECTED) 152 if (rb->default_event_handler(button) == SYS_USB_CONNECTED)
150 { 153 {
151#ifdef HAVE_LCD_CHARCELLS 154#ifdef HAVE_LCD_BITMAP
155 rb->lcd_set_drawmode(DRMODE_SOLID);
156#else
152 pgfx_release(); 157 pgfx_release();
153#endif 158#endif
154 return PLUGIN_USB_CONNECTED; 159 return PLUGIN_USB_CONNECTED;
diff --git a/apps/plugins/oscillograph.c b/apps/plugins/oscillograph.c
index 50e18e5a9f..1512e11389 100644
--- a/apps/plugins/oscillograph.c
+++ b/apps/plugins/oscillograph.c
@@ -65,7 +65,6 @@ static int drawMode = DRAW_MODE_FILLED;
65void cleanup(void *parameter) 65void cleanup(void *parameter)
66{ 66{
67 (void)parameter; 67 (void)parameter;
68
69 /* restore to default roll position. 68 /* restore to default roll position.
70 Looks funny if you forget to do this... */ 69 Looks funny if you forget to do this... */
71 rb->lcd_roll(0); 70 rb->lcd_roll(0);
@@ -91,13 +90,13 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
91 int lastLeft = 0; 90 int lastLeft = 0;
92 int lastRight = 0; 91 int lastRight = 0;
93 int lasty = 0; 92 int lasty = 0;
94 93
95 bool exit = false; 94 bool exit = false;
96 95
97 TEST_PLUGIN_API(api); 96 TEST_PLUGIN_API(api);
98 (void)parameter; 97 (void)parameter;
99 rb = api; 98 rb = api;
100 99
101 /* the main loop */ 100 /* the main loop */
102 while (!exit) { 101 while (!exit) {
103 102
@@ -106,8 +105,10 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
106 right = rb->mas_codec_readreg(0xD) / (MAX_PEAK / (LCD_WIDTH / 2 - 2)); 105 right = rb->mas_codec_readreg(0xD) / (MAX_PEAK / (LCD_WIDTH / 2 - 2));
107 106
108 /* delete current line */ 107 /* delete current line */
109 rb->lcd_clearline(0, y, LCD_WIDTH-1, y); 108 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
109 rb->lcd_drawline(0, y, LCD_WIDTH-1, y);
110 110
111 rb->lcd_set_drawmode(DRMODE_SOLID);
111 switch (drawMode) { 112 switch (drawMode) {
112 case DRAW_MODE_FILLED: 113 case DRAW_MODE_FILLED:
113 rb->lcd_drawline(LCD_WIDTH / 2 + 1 , y, 114 rb->lcd_drawline(LCD_WIDTH / 2 + 1 , y,
diff --git a/apps/plugins/oscilloscope.c b/apps/plugins/oscilloscope.c
index 868a20547c..ae77f33369 100644
--- a/apps/plugins/oscilloscope.c
+++ b/apps/plugins/oscilloscope.c
@@ -146,7 +146,9 @@ void timer_isr(void)
146 x = 0; 146 x = 0;
147 } 147 }
148 148
149 rb->lcd_clearline(x, 0, x, LCD_HEIGHT-1); 149 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
150 rb->lcd_drawline(x, 0, x, LCD_HEIGHT-1);
151 rb->lcd_set_drawmode(DRMODE_SOLID);
150 152
151 switch (draw_mode) 153 switch (draw_mode)
152 { 154 {
@@ -189,7 +191,7 @@ void timer_isr(void)
189void cleanup(void *parameter) 191void cleanup(void *parameter)
190{ 192{
191 (void)parameter; 193 (void)parameter;
192 194
193 rb->plugin_unregister_timer(); 195 rb->plugin_unregister_timer();
194} 196}
195 197
@@ -202,7 +204,7 @@ enum plugin_status plugin_start(struct plugin_api* api, void* parameter)
202 TEST_PLUGIN_API(api); 204 TEST_PLUGIN_API(api);
203 (void)parameter; 205 (void)parameter;
204 rb = api; 206 rb = api;
205 207
206 rb->plugin_register_timer(FREQ / 67, 1, timer_isr); 208 rb->plugin_register_timer(FREQ / 67, 1, timer_isr);
207 209
208 while (!exit) 210 while (!exit)
diff --git a/apps/plugins/pong.c b/apps/plugins/pong.c
index 2fec2e3a44..438bfbbc4e 100644
--- a/apps/plugins/pong.c
+++ b/apps/plugins/pong.c
@@ -72,10 +72,14 @@ struct pong {
72 72
73void singlepad(int x, int y, int set) 73void singlepad(int x, int y, int set)
74{ 74{
75 if(set) 75 if(set) {
76 rb->lcd_fillrect(x, y, PAD_WIDTH, PAD_HEIGHT); 76 rb->lcd_fillrect(x, y, PAD_WIDTH, PAD_HEIGHT);
77 else 77 }
78 rb->lcd_clearrect(x, y, PAD_WIDTH, PAD_HEIGHT); 78 else {
79 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
80 rb->lcd_fillrect(x, y, PAD_WIDTH, PAD_HEIGHT);
81 rb->lcd_set_drawmode(DRMODE_SOLID);
82 }
79} 83}
80 84
81void pad(struct pong *p, int pad) 85void pad(struct pong *p, int pad)
@@ -241,7 +245,9 @@ void ball(struct pong *p)
241 score(p, 0); 245 score(p, 0);
242 246
243 /* clear old position */ 247 /* clear old position */
244 rb->lcd_clearrect(x, y, BALL_WIDTH, BALL_HEIGTH); 248 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
249 rb->lcd_fillrect(x, y, BALL_WIDTH, BALL_HEIGTH);
250 rb->lcd_set_drawmode(DRMODE_SOLID);
245 251
246 /* draw the new ball position */ 252 /* draw the new ball position */
247 rb->lcd_fillrect(newx, newy, BALL_WIDTH, BALL_HEIGTH); 253 rb->lcd_fillrect(newx, newy, BALL_WIDTH, BALL_HEIGTH);
diff --git a/apps/plugins/rockblox.c b/apps/plugins/rockblox.c
index eac6563601..a0623da314 100644
--- a/apps/plugins/rockblox.c
+++ b/apps/plugins/rockblox.c
@@ -110,13 +110,16 @@ static void draw_frame(int fstart_x,int fstop_x,int fstart_y,int fstop_y)
110static void draw_block(int x, int y, int block, int frame, bool clear) 110static void draw_block(int x, int y, int block, int frame, bool clear)
111{ 111{
112 int i, a, b; 112 int i, a, b;
113
113 for(i=0;i < 4;i++) { 114 for(i=0;i < 4;i++) {
114 if (clear) 115 if (clear)
115 { 116 {
117 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
116 for (a = 0; a < 3; a++) 118 for (a = 0; a < 3; a++)
117 for (b = 0; b < 4; b++) 119 for (b = 0; b < 4; b++)
118 rb->lcd_clearpixel(start_x + x + block_data[block][frame][1][i] * 4 - b, 120 rb->lcd_drawpixel(start_x + x + block_data[block][frame][1][i] * 4 - b,
119 start_y + y + block_data[block][frame][0][i] * 3 + a); 121 start_y + y + block_data[block][frame][0][i] * 3 + a);
122 rb->lcd_set_drawmode(DRMODE_SOLID);
120 } 123 }
121 else 124 else
122 { 125 {
@@ -196,12 +199,19 @@ static bool valid_position(int x, int y, int block, int frame)
196static void from_virtual(void) 199static void from_virtual(void)
197{ 200{
198 int x,y; 201 int x,y;
202
199 for(y = 0; y < max_y; y++) 203 for(y = 0; y < max_y; y++)
200 for(x = 1; x < max_x - 1; x++) 204 for(x = 1; x < max_x - 1; x++)
201 if(*(virtual + (y * max_x) + x) != 0) 205 if(*(virtual + (y * max_x) + x) != 0)
206 {
202 rb->lcd_drawpixel(start_x + x, start_y + y); 207 rb->lcd_drawpixel(start_x + x, start_y + y);
208 }
203 else 209 else
204 rb->lcd_clearpixel(start_x + x, start_y + y); 210 {
211 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
212 rb->lcd_drawpixel(start_x + x, start_y + y);
213 rb->lcd_set_drawmode(DRMODE_SOLID);
214 }
205} 215}
206 216
207static void move_block(int x,int y,int f) 217static void move_block(int x,int y,int f)
@@ -362,7 +372,9 @@ static int game_loop(void)
362 372
363 if(gameover()) 373 if(gameover())
364 { 374 {
365 rb->lcd_clearrect(0, 52, LCD_WIDTH, LCD_HEIGHT - 52); 375 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
376 rb->lcd_fillrect(0, 52, LCD_WIDTH, LCD_HEIGHT - 52);
377 rb->lcd_set_drawmode(DRMODE_SOLID);
366 rb->lcd_putsxy(2, 52, "You lose!"); 378 rb->lcd_putsxy(2, 52, "You lose!");
367 rb->lcd_update(); 379 rb->lcd_update();
368 rb->sleep(HZ * 3); 380 rb->sleep(HZ * 3);
diff --git a/apps/plugins/rockboy/Makefile b/apps/plugins/rockboy/Makefile
index 727daa7186..1d32e0a84c 100644
--- a/apps/plugins/rockboy/Makefile
+++ b/apps/plugins/rockboy/Makefile
@@ -8,7 +8,7 @@
8# 8#
9 9
10INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \ 10INCLUDES = -I$(APPSDIR) -I.. -I. -I$(FIRMDIR)/include -I$(FIRMDIR)/export \
11 -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(BUILDDIR) 11 -I$(FIRMDIR)/common -I$(FIRMDIR)/drivers -I$(OUTDIR) -I$(BUILDDIR)
12CFLAGS = $(GCCOPTS) -O3 $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \ 12CFLAGS = $(GCCOPTS) -O3 $(INCLUDES) $(TARGET) $(EXTRA_DEFINES) \
13 -DMEM=${MEMORYSIZE} -DPLUGIN 13 -DMEM=${MEMORYSIZE} -DPLUGIN
14 14
diff --git a/apps/plugins/rockboy/menu.c b/apps/plugins/rockboy/menu.c
index 2334f0d17e..50f86c3408 100644
--- a/apps/plugins/rockboy/menu.c
+++ b/apps/plugins/rockboy/menu.c
@@ -356,12 +356,13 @@ static void select_item(char *title, int curr_item, size_t item_i) {
356 x = MENU_X + MENU_ITEM_PAD; 356 x = MENU_X + MENU_ITEM_PAD;
357 w = MENU_WIDTH - 2 * MENU_ITEM_PAD; 357 w = MENU_WIDTH - 2 * MENU_ITEM_PAD;
358 358
359 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
359 /* if there is a current item, then deselect it */ 360 /* if there is a current item, then deselect it */
360 if (curr_item >= 0) { 361 if (curr_item >= 0) {
361 /* deselect old item */ 362 /* deselect old item */
362 y = MENU_Y + h + MENU_ITEM_PAD * 2; /* account for title */ 363 y = MENU_Y + h + MENU_ITEM_PAD * 2; /* account for title */
363 y += h * curr_item; 364 y += h * curr_item;
364 rb->lcd_invertrect(x, y, w, h); 365 rb->lcd_fillrect(x, y, w, h);
365 } 366 }
366 367
367 /* select new item */ 368 /* select new item */
@@ -370,7 +371,8 @@ static void select_item(char *title, int curr_item, size_t item_i) {
370 /* select new item */ 371 /* select new item */
371 y = MENU_Y + h + MENU_ITEM_PAD * 2; /* account for title */ 372 y = MENU_Y + h + MENU_ITEM_PAD * 2; /* account for title */
372 y += h * curr_item; 373 y += h * curr_item;
373 rb->lcd_invertrect(x, y, w, h); 374 rb->lcd_fillrect(x, y, w, h);
375 rb->lcd_set_drawmode(DRMODE_SOLID);
374 376
375 /* update the menu window */ 377 /* update the menu window */
376 rb->lcd_update_rect(MENU_RECT); 378 rb->lcd_update_rect(MENU_RECT);
@@ -392,7 +394,9 @@ static void draw_menu(char *title, char **items, size_t num_items) {
392 394
393 /* draw the outline */ 395 /* draw the outline */
394 rb->lcd_fillrect(SHADOW_RECT); 396 rb->lcd_fillrect(SHADOW_RECT);
395 rb->lcd_clearrect(MENU_RECT); 397 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
398 rb->lcd_fillrect(MENU_RECT);
399 rb->lcd_set_drawmode(DRMODE_SOLID);
396 rb->lcd_drawrect(MENU_RECT); 400 rb->lcd_drawrect(MENU_RECT);
397 401
398 /* calculate x/y */ 402 /* calculate x/y */
@@ -406,8 +410,10 @@ static void draw_menu(char *title, char **items, size_t num_items) {
406 rb->lcd_drawline(MENU_X, i, MENU_X + MENU_WIDTH, i); 410 rb->lcd_drawline(MENU_X, i, MENU_X + MENU_WIDTH, i);
407 411
408 /* clear title rect */ 412 /* clear title rect */
409 rb->lcd_clearrect((LCD_WIDTH - w) / 2 - 2, y - 2, w + 4, h); 413 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
410 414 rb->lcd_fillrect((LCD_WIDTH - w) / 2 - 2, y - 2, w + 4, h);
415 rb->lcd_set_drawmode(DRMODE_SOLID);
416
411 /* draw centered title on screen */ 417 /* draw centered title on screen */
412 rb->lcd_putsxy((LCD_WIDTH - w)/2, y, title); 418 rb->lcd_putsxy((LCD_WIDTH - w)/2, y, title);
413 419
diff --git a/apps/plugins/rockboy/rockmacros.h b/apps/plugins/rockboy/rockmacros.h
index 03a6810a55..e246086f05 100644
--- a/apps/plugins/rockboy/rockmacros.h
+++ b/apps/plugins/rockboy/rockmacros.h
@@ -17,7 +17,7 @@
17 * 17 *
18 ****************************************************************************/ 18 ****************************************************************************/
19 19
20#include <plugin.h> 20#include "plugin.h"
21 21
22#include "autoconf.h" 22#include "autoconf.h"
23 23
@@ -51,6 +51,16 @@ void savestate(int fd);
51#define isalpha(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && ((c) <= 'Z'))) 51#define isalpha(c) (((c) >= 'a' && (c) <= 'z') || ((c) >= 'A' && ((c) <= 'Z')))
52#define isalnum(c) (isdigit(c) || (isalpha(c))) 52#define isalnum(c) (isdigit(c) || (isalpha(c)))
53 53
54/* FIXME: This is a q&d fix for these #defines not being available from
55 * rockbox' lcd.h because rockboy has its own lcd.h. Renaming the file and
56 * adapting the other files produced weird errors I couldn't figure out
57 * -- amiconn 20050624 -- */
58#define DRMODE_COMPLEMENT 0
59#define DRMODE_BG 1
60#define DRMODE_FG 2
61#define DRMODE_SOLID 3
62#define DRMODE_INVERSEVID 4 /* used as bit modifier for basic modes */
63
54#ifdef SIMULATOR 64#ifdef SIMULATOR
55#undef opendir 65#undef opendir
56#define opendir(a) rb->sim_opendir((a)) 66#define opendir(a) rb->sim_opendir((a))
diff --git a/apps/plugins/rockboy/sound.h b/apps/plugins/rockboy/sound.h
index 1a24ee600f..f4791127a8 100644
--- a/apps/plugins/rockboy/sound.h
+++ b/apps/plugins/rockboy/sound.h
@@ -3,6 +3,7 @@
3#ifndef __SOUND_H__ 3#ifndef __SOUND_H__
4#define __SOUND_H__ 4#define __SOUND_H__
5 5
6#include "defs.h"
6 7
7struct sndchan 8struct sndchan
8{ 9{
diff --git a/apps/plugins/sliding_puzzle.c b/apps/plugins/sliding_puzzle.c
index d6cbe48525..83f92b241b 100644
--- a/apps/plugins/sliding_puzzle.c
+++ b/apps/plugins/sliding_puzzle.c
@@ -151,7 +151,9 @@ static void draw_spot(int p, int x, int y)
151 rb->lcd_bitmap (picture[p-1], x, y, 16, 16, true); 151 rb->lcd_bitmap (picture[p-1], x, y, 16, 16, true);
152 } else { 152 } else {
153 rb->lcd_drawrect(x, y, 16, 16); 153 rb->lcd_drawrect(x, y, 16, 16);
154 rb->lcd_clearrect(x+1, y+1, 14, 14); 154 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
155 rb->lcd_fillrect(x+1, y+1, 14, 14);
156 rb->lcd_set_drawmode(DRMODE_SOLID);
155 rb->snprintf(s, sizeof(s), "%d", p); 157 rb->snprintf(s, sizeof(s), "%d", p);
156 rb->lcd_putsxy(x+2, y+4, s); 158 rb->lcd_putsxy(x+2, y+4, s);
157 } 159 }
diff --git a/apps/plugins/snake.c b/apps/plugins/snake.c
index 5d1e02044b..e13fdf560b 100644
--- a/apps/plugins/snake.c
+++ b/apps/plugins/snake.c
@@ -142,7 +142,9 @@ void frame (void)
142 default: 142 default:
143 if (board[x][y]==snakelength) { 143 if (board[x][y]==snakelength) {
144 board[x][y]=0; 144 board[x][y]=0;
145 rb->lcd_clearrect(x*4,y*4,4,4); 145 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
146 rb->lcd_fillrect(x*4,y*4,4,4);
147 rb->lcd_set_drawmode(DRMODE_SOLID);
146 } 148 }
147 else 149 else
148 board[x][y]++; 150 board[x][y]++;
diff --git a/apps/plugins/snake2.c b/apps/plugins/snake2.c
index 0b0419bcf0..bd9792a23d 100644
--- a/apps/plugins/snake2.c
+++ b/apps/plugins/snake2.c
@@ -620,7 +620,9 @@ void draw_apple( void )
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_bitmap(snakebmp,0,0,BMPWIDTH_snakebmp,BMPHEIGHT_snakebmp,false);
623 rb->lcd_clearrect(0,0,BMPWIDTH_snakeupbmp,BMPHEIGHT_snakeupbmp); 623 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
624 rb->lcd_fillrect(0,0,BMPWIDTH_snakeupbmp,BMPHEIGHT_snakeupbmp);
625 rb->lcd_set_drawmode(DRMODE_SOLID);
624 rb->lcd_bitmap(snakeupbmp,0,0,BMPWIDTH_snakeupbmp,BMPHEIGHT_snakeupbmp,false); 626 rb->lcd_bitmap(snakeupbmp,0,0,BMPWIDTH_snakeupbmp,BMPHEIGHT_snakeupbmp,false);
625 627
626 rb->snprintf(counter,sizeof(counter),"%d",applecount); 628 rb->snprintf(counter,sizeof(counter),"%d",applecount);
@@ -838,7 +840,9 @@ void redraw (void)
838*/ 840*/
839void draw_snake_bit(int currentbit, int previousbit, int x, int y) 841void draw_snake_bit(int currentbit, int previousbit, int x, int y)
840{ 842{
841 rb->lcd_clearrect(CENTER_X+x*MULTIPLIER,CENTER_Y+y*MULTIPLIER,MODIFIER_1,MODIFIER_1); 843 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
844 rb->lcd_fillrect(CENTER_X+x*MULTIPLIER,CENTER_Y+y*MULTIPLIER,MODIFIER_1,MODIFIER_1);
845 rb->lcd_set_drawmode(DRMODE_SOLID);
842 846
843 switch(currentbit) 847 switch(currentbit)
844 { 848 {
@@ -1065,8 +1069,10 @@ void move( void )
1065 /*clear tail*/ 1069 /*clear tail*/
1066 if(applecountdown <= 0) 1070 if(applecountdown <= 0)
1067 { 1071 {
1068 rb->lcd_clearrect(CENTER_X+tailx*MULTIPLIER,CENTER_Y+taily*MULTIPLIER,MODIFIER_1,MODIFIER_1); 1072 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1069 1073 rb->lcd_fillrect(CENTER_X+tailx*MULTIPLIER,CENTER_Y+taily*MULTIPLIER,MODIFIER_1,MODIFIER_1);
1074 rb->lcd_set_drawmode(DRMODE_SOLID);
1075
1070 taildir = board[tailx][taily]; 1076 taildir = board[tailx][taily];
1071 board[tailx][taily] = 0; 1077 board[tailx][taily] = 0;
1072 1078
diff --git a/apps/plugins/snow.c b/apps/plugins/snow.c
index 0fc01eef6e..dd97abc4fb 100644
--- a/apps/plugins/snow.c
+++ b/apps/plugins/snow.c
@@ -82,8 +82,10 @@ static void snow_move(void)
82 for (i=0; i<NUM_PARTICLES; i++) { 82 for (i=0; i<NUM_PARTICLES; i++) {
83 if (particle_exists(i)) { 83 if (particle_exists(i)) {
84#ifdef HAVE_LCD_BITMAP 84#ifdef HAVE_LCD_BITMAP
85 rb->lcd_clearrect(particles[i][0],particles[i][1], 85 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
86 FLAKE_WIDTH,FLAKE_WIDTH); 86 rb->lcd_fillrect(particles[i][0],particles[i][1],
87 FLAKE_WIDTH,FLAKE_WIDTH);
88 rb->lcd_set_drawmode(DRMODE_SOLID);
87#else 89#else
88 pgfx_clearpixel(particles[i][0],particles[i][1]); 90 pgfx_clearpixel(particles[i][0],particles[i][1]);
89#endif 91#endif
diff --git a/apps/plugins/sokoban.c b/apps/plugins/sokoban.c
index 0e81f0f2d3..f7dc165a13 100644
--- a/apps/plugins/sokoban.c
+++ b/apps/plugins/sokoban.c
@@ -825,14 +825,16 @@ static bool sokoban_loop(void)
825 if (current_info.level.level > current_info.max_level) { 825 if (current_info.level.level > current_info.max_level) {
826 rb->lcd_putsxy(10, 20, "You WIN!!"); 826 rb->lcd_putsxy(10, 20, "You WIN!!");
827 827
828 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
828 for (i = 0; i < 30000 ; i++) { 829 for (i = 0; i < 30000 ; i++) {
829 rb->lcd_invertrect(0, 0, 111, 63); 830 rb->lcd_fillrect(0, 0, 111, 63);
830 rb->lcd_update(); 831 rb->lcd_update();
831 832
832 button = rb->button_get(false); 833 button = rb->button_get(false);
833 if (button && ((button & BUTTON_REL) != BUTTON_REL)) 834 if (button && ((button & BUTTON_REL) != BUTTON_REL))
834 break; 835 break;
835 } 836 }
837 rb->lcd_set_drawmode(DRMODE_SOLID);
836 838
837 return PLUGIN_OK; 839 return PLUGIN_OK;
838 } 840 }
diff --git a/apps/plugins/solitaire.c b/apps/plugins/solitaire.c
index 9fc0062454..066af9da73 100644
--- a/apps/plugins/solitaire.c
+++ b/apps/plugins/solitaire.c
@@ -518,8 +518,11 @@ int solitaire_menu(unsigned char when)
518 518
519 for(i = 0; i<MENU_LENGTH; i++){ 519 for(i = 0; i<MENU_LENGTH; i++){
520 rb->lcd_putsxy(1, 17+fh*i, menu[when][i]); 520 rb->lcd_putsxy(1, 17+fh*i, menu[when][i]);
521 if(cursor == i) 521 if(cursor == i) {
522 rb->lcd_invertrect(0,17+fh*i, LCD_WIDTH, fh); 522 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
523 rb->lcd_fillrect(0,17+fh*i, LCD_WIDTH, fh);
524 rb->lcd_set_drawmode(DRMODE_SOLID);
525 }
523 } 526 }
524 527
525 rb->lcd_update(); 528 rb->lcd_update();
@@ -877,12 +880,15 @@ int solitaire(void){
877 if(c==NOT_A_CARD) { 880 if(c==NOT_A_CARD) {
878 /* draw the cursor on empty columns */ 881 /* draw the cursor on empty columns */
879 if(cur_col == i){ 882 if(cur_col == i){
880 rb->lcd_invertrect(i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+2, 2, CARD_WIDTH-3, CARD_HEIGHT-1); 883 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
884 rb->lcd_fillrect(i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+2, 2, CARD_WIDTH-3, CARD_HEIGHT-1);
881 } 885 }
882 break; 886 break;
883 } 887 }
884 /* clear the card's spot */ 888 /* clear the card's spot */
885 rb->lcd_clearrect(i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM, j+1, CARD_WIDTH, CARD_HEIGHT-1); 889 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
890 rb->lcd_fillrect(i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM, j+1, CARD_WIDTH, CARD_HEIGHT-1);
891 rb->lcd_set_drawmode(DRMODE_SOLID);
886 /* known card */ 892 /* known card */
887 if(deck[c].known){ 893 if(deck[c].known){
888 rb->lcd_bitmap(numbers[deck[c].num], i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+1, j, 8, 8, true); 894 rb->lcd_bitmap(numbers[deck[c].num], i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+1, j, 8, 8, true);
@@ -896,7 +902,9 @@ int solitaire(void){
896 } 902 }
897 /* cursor (or not) */ 903 /* cursor (or not) */
898 if(c == cur_card){ 904 if(c == cur_card){
899 rb->lcd_invertrect(i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+1, j+1, CARD_WIDTH-1, CARD_HEIGHT-1); 905 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
906 rb->lcd_fillrect(i*(LCD_WIDTH - CARD_WIDTH)/COL_NUM+1, j+1, CARD_WIDTH-1, CARD_HEIGHT-1);
907 rb->lcd_set_drawmode(DRMODE_SOLID);
900 /* go to the next card */ 908 /* go to the next card */
901 c = deck[c].next; 909 c = deck[c].next;
902 if(c == NOT_A_CARD) break; 910 if(c == NOT_A_CARD) break;
@@ -941,7 +949,9 @@ int solitaire(void){
941 rb->lcd_drawline(LCD_WIDTH - CARD_WIDTH+1,(i+1)*CARD_HEIGHT,LCD_WIDTH - 1,(i+1)*CARD_HEIGHT); 949 rb->lcd_drawline(LCD_WIDTH - CARD_WIDTH+1,(i+1)*CARD_HEIGHT,LCD_WIDTH - 1,(i+1)*CARD_HEIGHT);
942 /* draw the cursor on one of the stacks */ 950 /* draw the cursor on one of the stacks */
943 if(cur_col == STACKS_COL + i){ 951 if(cur_col == STACKS_COL + i){
944 rb->lcd_invertrect(LCD_WIDTH - CARD_WIDTH+1, i*CARD_HEIGHT + 1, CARD_WIDTH-1, CARD_HEIGHT-1); 952 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
953 rb->lcd_fillrect(LCD_WIDTH - CARD_WIDTH+1, i*CARD_HEIGHT + 1, CARD_WIDTH-1, CARD_HEIGHT-1);
954 rb->lcd_set_drawmode(DRMODE_SOLID);
945 } 955 }
946 } 956 }
947 957
@@ -952,16 +962,18 @@ int solitaire(void){
952 rb->lcd_drawline(LCD_WIDTH - CARD_WIDTH+1,LCD_HEIGHT-1,LCD_WIDTH - 1,LCD_HEIGHT-1); 962 rb->lcd_drawline(LCD_WIDTH - CARD_WIDTH+1,LCD_HEIGHT-1,LCD_WIDTH - 1,LCD_HEIGHT-1);
953 if(cur_rem != NOT_A_CARD){ 963 if(cur_rem != NOT_A_CARD){
954 rb->lcd_bitmap(numbers[deck[cur_rem].num], LCD_WIDTH - CARD_WIDTH+1, LCD_HEIGHT-CARD_HEIGHT, 8, 8, true); 964 rb->lcd_bitmap(numbers[deck[cur_rem].num], LCD_WIDTH - CARD_WIDTH+1, LCD_HEIGHT-CARD_HEIGHT, 8, 8, true);
955 rb->lcd_bitmap(colors[deck[cur_rem].color], LCD_WIDTH - CARD_WIDTH+7, LCD_HEIGHT-CARD_HEIGHT, 8, 8, true); 965 rb->lcd_bitmap(colors[deck[cur_rem].color], LCD_WIDTH - CARD_WIDTH+7, LCD_HEIGHT-CARD_HEIGHT, 8, 8, true);
956 /* draw a selected card */ 966 /* draw a selected card */
957 if(sel_card == cur_rem){ 967 if(sel_card == cur_rem){
958 rb->lcd_drawrect(LCD_WIDTH - CARD_WIDTH+1, LCD_HEIGHT-CARD_HEIGHT,CARD_WIDTH-1, CARD_HEIGHT-1); 968 rb->lcd_drawrect(LCD_WIDTH - CARD_WIDTH+1, LCD_HEIGHT-CARD_HEIGHT,CARD_WIDTH-1, CARD_HEIGHT-1);
959 } 969 }
960 } 970 }
961 } 971 }
962 /* draw the cursor */ 972 /* draw the cursor */
963 if(cur_col == REM_COL){ 973 if(cur_col == REM_COL){
964 rb->lcd_invertrect(LCD_WIDTH - CARD_WIDTH+1, LCD_HEIGHT-CARD_HEIGHT,CARD_WIDTH-1, CARD_HEIGHT-1); 974 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
975 rb->lcd_fillrect(LCD_WIDTH - CARD_WIDTH+1, LCD_HEIGHT-CARD_HEIGHT,CARD_WIDTH-1, CARD_HEIGHT-1);
976 rb->lcd_set_drawmode(DRMODE_SOLID);
965 } 977 }
966 978
967 979
diff --git a/apps/plugins/splitedit.c b/apps/plugins/splitedit.c
index e52ce244f1..20a9922a29 100644
--- a/apps/plugins/splitedit.c
+++ b/apps/plugins/splitedit.c
@@ -210,7 +210,9 @@ static void update_data(void)
210 210
211 rb->lcd_getstringsize(buf, &w, &h); 211 rb->lcd_getstringsize(buf, &w, &h);
212 212
213 rb->lcd_clearrect(0, 0, LCD_WIDTH, h); 213 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
214 rb->lcd_fillrect(0, 0, LCD_WIDTH, h);
215 rb->lcd_set_drawmode(DRMODE_SOLID);
214 rb->lcd_puts(0, 0, buf); 216 rb->lcd_puts(0, 0, buf);
215 rb->lcd_update_rect(0, 0, LCD_WIDTH, h); 217 rb->lcd_update_rect(0, 0, LCD_WIDTH, h);
216} 218}
@@ -253,7 +255,9 @@ int splitedit_get_loop_mode(void)
253 */ 255 */
254static void update_icons(void) 256static void update_icons(void)
255{ 257{
256 rb->lcd_clearrect(0, LCD_HEIGHT - BMPHEIGHT, LCD_WIDTH, BMPHEIGHT); 258 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
259 rb->lcd_fillrect(0, LCD_HEIGHT - BMPHEIGHT, LCD_WIDTH, BMPHEIGHT);
260 rb->lcd_set_drawmode(DRMODE_SOLID);
257 261
258 /* The CUT icon */ 262 /* The CUT icon */
259 rb->lcd_bitmap(CUT_BMP, 263 rb->lcd_bitmap(CUT_BMP,
@@ -380,9 +384,11 @@ void splitedit_set_split_x(int newx)
380 /* remove old split point from screen, only if moved */ 384 /* remove old split point from screen, only if moved */
381 if (split_x != newx) 385 if (split_x != newx)
382 { 386 {
383 rb->lcd_invertrect (minx, OSCI_Y, 5, 1); 387 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
384 rb->lcd_invertrect (split_x-1 > 0 ? split_x - 1: 0, OSCI_Y + 1, 3, 1); 388 rb->lcd_fillrect(minx, OSCI_Y, 5, 1);
385 rb->lcd_invertrect (split_x, OSCI_Y + 2, 1, OSCI_HEIGHT - 2); 389 rb->lcd_fillrect(split_x-1 > 0 ? split_x - 1: 0, OSCI_Y + 1, 3, 1);
390 rb->lcd_fillrect(split_x, OSCI_Y + 2, 1, OSCI_HEIGHT - 2);
391 rb->lcd_set_drawmode(DRMODE_SOLID);
386 rb->lcd_update_rect(minx, OSCI_Y, 5, OSCI_HEIGHT); 392 rb->lcd_update_rect(minx, OSCI_Y, 5, OSCI_HEIGHT);
387 } 393 }
388 394
@@ -398,9 +404,11 @@ void splitedit_set_split_x(int newx)
398 404
399 /* display new split point */ 405 /* display new split point */
400 minx = split_x - 2 > 0 ? split_x - 2: 0; 406 minx = split_x - 2 > 0 ? split_x - 2: 0;
401 rb->lcd_invertrect (minx, OSCI_Y, 5, 1); 407 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
402 rb->lcd_invertrect (split_x - 1 > 0 ? split_x - 1: 0, OSCI_Y + 1, 3, 1); 408 rb->lcd_fillrect(minx, OSCI_Y, 5, 1);
403 rb->lcd_invertrect (split_x, OSCI_Y + 2, 1, OSCI_HEIGHT - 2); 409 rb->lcd_fillrect(split_x - 1 > 0 ? split_x - 1: 0, OSCI_Y + 1, 3, 1);
410 rb->lcd_fillrect(split_x, OSCI_Y + 2, 1, OSCI_HEIGHT - 2);
411 rb->lcd_set_drawmode(DRMODE_SOLID);
404 rb->lcd_update_rect(minx, OSCI_Y, 5, OSCI_HEIGHT); 412 rb->lcd_update_rect(minx, OSCI_Y, 5, OSCI_HEIGHT);
405} 413}
406 414
@@ -417,7 +425,9 @@ int splitedit_get_split_x(void)
417 */ 425 */
418static void update_osci(void) 426static void update_osci(void)
419{ 427{
420 rb->lcd_clearrect(OSCI_X, OSCI_Y, OSCI_WIDTH, OSCI_HEIGHT); 428 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
429 rb->lcd_fillrect(OSCI_X, OSCI_Y, OSCI_WIDTH, OSCI_HEIGHT);
430 rb->lcd_set_drawmode(DRMODE_SOLID);
421 redraw_osci(); 431 redraw_osci();
422 splitedit_set_split_x(splitedit_get_split_x()); 432 splitedit_set_split_x(splitedit_get_split_x());
423 rb->lcd_update_rect(OSCI_X, OSCI_Y, OSCI_WIDTH, OSCI_HEIGHT); 433 rb->lcd_update_rect(OSCI_X, OSCI_Y, OSCI_WIDTH, OSCI_HEIGHT);
@@ -485,7 +495,9 @@ static void scroll(struct mp3entry *mp3)
485 */ 495 */
486void splitedit_zoom_in(struct mp3entry *mp3) 496void splitedit_zoom_in(struct mp3entry *mp3)
487{ 497{
488 rb->lcd_clearrect(OSCI_X, OSCI_Y, OSCI_WIDTH, OSCI_HEIGHT); 498 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
499 rb->lcd_fillrect(OSCI_X, OSCI_Y, OSCI_WIDTH, OSCI_HEIGHT);
500 rb->lcd_set_drawmode(DRMODE_SOLID);
489 zoom(mp3, 3, 4); 501 zoom(mp3, 3, 4);
490 rb->lcd_update_rect(OSCI_X, OSCI_Y, LCD_WIDTH, OSCI_HEIGHT); 502 rb->lcd_update_rect(OSCI_X, OSCI_Y, LCD_WIDTH, OSCI_HEIGHT);
491 update_osci(); 503 update_osci();
@@ -497,7 +509,9 @@ void splitedit_zoom_in(struct mp3entry *mp3)
497 */ 509 */
498void splitedit_zoom_out(struct mp3entry *mp3) 510void splitedit_zoom_out(struct mp3entry *mp3)
499{ 511{
500 rb->lcd_clearrect(OSCI_X, OSCI_Y, LCD_WIDTH, OSCI_HEIGHT); 512 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
513 rb->lcd_fillrect(OSCI_X, OSCI_Y, LCD_WIDTH, OSCI_HEIGHT);
514 rb->lcd_set_drawmode(DRMODE_SOLID);
501 zoom(mp3, 4, 3); 515 zoom(mp3, 4, 3);
502 rb->lcd_update_rect(OSCI_X, OSCI_Y, LCD_WIDTH, OSCI_HEIGHT); 516 rb->lcd_update_rect(OSCI_X, OSCI_Y, LCD_WIDTH, OSCI_HEIGHT);
503 update_osci(); 517 update_osci();
@@ -823,7 +837,9 @@ static void save_editor(struct mp3entry *mp3, int splittime)
823 837
824 case SE_SAVE: 838 case SE_SAVE:
825 rb->lcd_stop_scroll(); 839 rb->lcd_stop_scroll();
826 rb->lcd_clearrect(0, 6*8, LCD_WIDTH, LCD_HEIGHT); 840 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
841 rb->lcd_fillrect(0, 6*8, LCD_WIDTH, LCD_HEIGHT);
842 rb->lcd_set_drawmode(DRMODE_SOLID);
827 saved = save 843 saved = save
828 ( 844 (
829 mp3, 845 mp3,
@@ -919,7 +935,9 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
919 } 935 }
920 936
921 /* make room */ 937 /* make room */
922 rb->lcd_clearrect(lastx + 1, OSCI_Y, x - lastx, OSCI_HEIGHT); 938 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
939 rb->lcd_fillrect(lastx + 1, OSCI_Y, x - lastx, OSCI_HEIGHT);
940 rb->lcd_set_drawmode(DRMODE_SOLID);
923 /* draw a value */ 941 /* draw a value */
924 if (osci_buffer[x - OSCI_X] > 0) 942 if (osci_buffer[x - OSCI_X] > 0)
925 { 943 {
@@ -937,8 +955,10 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
937 /* mark the current position */ 955 /* mark the current position */
938 if (lastx != x) 956 if (lastx != x)
939 { 957 {
940 rb->lcd_invertrect(lastx, OSCI_Y, 1, OSCI_HEIGHT); 958 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
941 rb->lcd_invertrect(x, OSCI_Y, 1, OSCI_HEIGHT); 959 rb->lcd_fillrect(lastx, OSCI_Y, 1, OSCI_HEIGHT);
960 rb->lcd_fillrect(x, OSCI_Y, 1, OSCI_HEIGHT);
961 rb->lcd_set_drawmode(DRMODE_SOLID);
942 } 962 }
943 963
944 /* mark the split point */ 964 /* mark the split point */
@@ -946,11 +966,13 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split,
946 { 966 {
947 if ((lastx < split_x) && (x >= split_x)) 967 if ((lastx < split_x) && (x >= split_x))
948 { 968 {
949 rb->lcd_invertrect 969 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
970 rb->lcd_fillrect
950 ( 971 (
951 split_x, OSCI_Y + 2, 972 split_x, OSCI_Y + 2,
952 1, OSCI_HEIGHT - 2 973 1, OSCI_HEIGHT - 2
953 ); 974 );
975 rb->lcd_set_drawmode(DRMODE_SOLID);
954 } 976 }
955 rb->lcd_drawline(split_x -2, OSCI_Y, split_x + 2, OSCI_Y); 977 rb->lcd_drawline(split_x -2, OSCI_Y, split_x + 2, OSCI_Y);
956 rb->lcd_drawline(split_x-1, OSCI_Y+1, split_x +1,OSCI_Y+1); 978 rb->lcd_drawline(split_x-1, OSCI_Y+1, split_x +1,OSCI_Y+1);
diff --git a/apps/plugins/star.c b/apps/plugins/star.c
index 79f93ccba2..fbaf8aeed6 100644
--- a/apps/plugins/star.c
+++ b/apps/plugins/star.c
@@ -838,7 +838,9 @@ static int star_menu(void)
838 838
839 for (i = 0 ; i < char_height ; i++) 839 for (i = 0 ; i < char_height ; i++)
840 { 840 {
841 rb->lcd_clearrect (2, 30, 7, 4 * 8); 841 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
842 rb->lcd_fillrect (2, 30, 7, 4 * 8);
843 rb->lcd_set_drawmode(DRMODE_SOLID);
842 rb->lcd_bitmap(arrow_bmp[anim_arrow[(anim_state & 0x38) >> 3]], 844 rb->lcd_bitmap(arrow_bmp[anim_arrow[(anim_state & 0x38) >> 3]],
843 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,
844 false); 846 false);
diff --git a/apps/plugins/vu_meter.c b/apps/plugins/vu_meter.c
index afeaa83d90..1a6f723292 100644
--- a/apps/plugins/vu_meter.c
+++ b/apps/plugins/vu_meter.c
@@ -213,7 +213,9 @@ void change_settings(void)
213 } 213 }
214 } 214 }
215 215
216 rb->lcd_invertrect(0, selected_setting*8+8,111,8); 216 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
217 rb->lcd_fillrect(0, selected_setting*8+8,111,8);
218 rb->lcd_set_drawmode(DRMODE_SOLID);
217 rb->lcd_update(); 219 rb->lcd_update();
218 220
219 switch(rb->button_get_w_tmo(1)) 221 switch(rb->button_get_w_tmo(1))
diff --git a/apps/plugins/wormlet.c b/apps/plugins/wormlet.c
index 4c7d7ee950..e0e33b6801 100644
--- a/apps/plugins/wormlet.c
+++ b/apps/plugins/wormlet.c
@@ -535,9 +535,11 @@ static int make_food(int index) {
535static void clear_food(int index) 535static void clear_food(int index)
536{ 536{
537 /* remove the old food from the screen */ 537 /* remove the old food from the screen */
538 rb->lcd_clearrect(foodx[index] + FIELD_RECT_X, 538 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
539 foody[index] + FIELD_RECT_Y, 539 rb->lcd_fillrect(foodx[index] + FIELD_RECT_X,
540 FOOD_SIZE, FOOD_SIZE); 540 foody[index] + FIELD_RECT_Y,
541 FOOD_SIZE, FOOD_SIZE);
542 rb->lcd_set_drawmode(DRMODE_SOLID);
541} 543}
542 544
543/** 545/**
@@ -550,11 +552,13 @@ static void draw_food(int index)
550{ 552{
551 /* draw the food object */ 553 /* draw the food object */
552 rb->lcd_fillrect(foodx[index] + FIELD_RECT_X, 554 rb->lcd_fillrect(foodx[index] + FIELD_RECT_X,
553 foody[index] + FIELD_RECT_Y, 555 foody[index] + FIELD_RECT_Y,
554 FOOD_SIZE, FOOD_SIZE); 556 FOOD_SIZE, FOOD_SIZE);
555 rb->lcd_clearrect(foodx[index] + FIELD_RECT_X + 1, 557 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
556 foody[index] + FIELD_RECT_Y + 1, 558 rb->lcd_fillrect(foodx[index] + FIELD_RECT_X + 1,
557 FOOD_SIZE - 2, FOOD_SIZE - 2); 559 foody[index] + FIELD_RECT_Y + 1,
560 FOOD_SIZE - 2, FOOD_SIZE - 2);
561 rb->lcd_set_drawmode(DRMODE_SOLID);
558} 562}
559 563
560/** 564/**
@@ -742,8 +746,10 @@ static void init_wormlet(void)
742 } 746 }
743 747
744 /* draw the game field */ 748 /* draw the game field */
745 rb->lcd_invertrect(0, 0, FIELD_RECT_WIDTH + 2, FIELD_RECT_HEIGHT + 2); 749 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
746 rb->lcd_invertrect(1, 1, FIELD_RECT_WIDTH, FIELD_RECT_HEIGHT); 750 rb->lcd_fillrect(0, 0, FIELD_RECT_WIDTH + 2, FIELD_RECT_HEIGHT + 2);
751 rb->lcd_fillrect(1, 1, FIELD_RECT_WIDTH, FIELD_RECT_HEIGHT);
752 rb->lcd_set_drawmode(DRMODE_SOLID);
747 753
748 /* make everything visible */ 754 /* make everything visible */
749 rb->lcd_update(); 755 rb->lcd_update();
@@ -841,12 +847,15 @@ static void draw_worm(struct worm *w)
841 rb->lcd_drawpixel(x + FIELD_RECT_X, y + FIELD_RECT_Y); 847 rb->lcd_drawpixel(x + FIELD_RECT_X, y + FIELD_RECT_Y);
842 } 848 }
843 849
850 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
851
844 /* clear the space behind the worm */ 852 /* clear the space behind the worm */
845 x = w->x[w->tail] ; 853 x = w->x[w->tail] ;
846 y = w->y[w->tail] ; 854 y = w->y[w->tail] ;
847 if (x >= 0 && x < FIELD_RECT_WIDTH && y >= 0 && y < FIELD_RECT_HEIGHT) { 855 if (x >= 0 && x < FIELD_RECT_WIDTH && y >= 0 && y < FIELD_RECT_HEIGHT) {
848 rb->lcd_clearpixel(x + FIELD_RECT_X, y + FIELD_RECT_Y); 856 rb->lcd_drawpixel(x + FIELD_RECT_X, y + FIELD_RECT_Y);
849 } 857 }
858 rb->lcd_set_drawmode(DRMODE_SOLID);
850} 859}
851 860
852/** 861/**
@@ -1155,7 +1164,9 @@ static void score_board(void)
1155 char* buf2 = NULL; 1164 char* buf2 = NULL;
1156 int i; 1165 int i;
1157 int y = 0; 1166 int y = 0;
1158 rb->lcd_clearrect(FIELD_RECT_WIDTH + 2, 0, LCD_WIDTH - FIELD_RECT_WIDTH - 2, LCD_HEIGHT); 1167 rb->lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1168 rb->lcd_fillrect(FIELD_RECT_WIDTH + 2, 0, LCD_WIDTH - FIELD_RECT_WIDTH - 2, LCD_HEIGHT);
1169 rb->lcd_set_drawmode(DRMODE_SOLID);
1159 for (i = 0; i < worm_count; i++) { 1170 for (i = 0; i < worm_count; i++) {
1160 int score = get_score(&worms[i]); 1171 int score = get_score(&worms[i]);
1161 1172
@@ -1202,8 +1213,10 @@ static void score_board(void)
1202 rb->lcd_putsxy(FIELD_RECT_WIDTH + 3, y+8, buf2); 1213 rb->lcd_putsxy(FIELD_RECT_WIDTH + 3, y+8, buf2);
1203 1214
1204 if (!worms[i].alive){ 1215 if (!worms[i].alive){
1205 rb->lcd_invertrect(FIELD_RECT_WIDTH + 2, y, 1216 rb->lcd_set_drawmode(DRMODE_COMPLEMENT);
1206 LCD_WIDTH - FIELD_RECT_WIDTH - 2, 17); 1217 rb->lcd_fillrect(FIELD_RECT_WIDTH + 2, y,
1218 LCD_WIDTH - FIELD_RECT_WIDTH - 2, 17);
1219 rb->lcd_set_drawmode(DRMODE_SOLID);
1207 } 1220 }
1208 y += 19; 1221 y += 19;
1209 } 1222 }
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c
index d974752b84..cfaf03c94a 100644
--- a/apps/recorder/keyboard.c
+++ b/apps/recorder/keyboard.c
@@ -195,8 +195,12 @@ int kbd_input(char* text, int buflen)
195#ifdef KBD_MODES 195#ifdef KBD_MODES
196 if (!line_edit) 196 if (!line_edit)
197#endif 197#endif
198 {
198 /* highlight the key that has focus */ 199 /* highlight the key that has focus */
199 lcd_invertrect(font_w * x, 8 + font_h * y, font_w, font_h); 200 lcd_set_drawmode(DRMODE_COMPLEMENT);
201 lcd_fillrect(font_w * x, 8 + font_h * y, font_w, font_h);
202 lcd_set_drawmode(DRMODE_SOLID);
203 }
200 204
201 status_draw(true); 205 status_draw(true);
202 206
diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c
index 9baa9fdb35..8fffc9500d 100644
--- a/apps/recorder/peakmeter.c
+++ b/apps/recorder/peakmeter.c
@@ -835,7 +835,8 @@ unsigned short peak_meter_scale_value(unsigned short val, int meterwidth){
835 * width > 3 835 * width > 3
836 * @param int height - The height of the peak meter. height > 3 836 * @param int height - The height of the peak meter. height > 3
837 */ 837 */
838void peak_meter_draw(int x, int y, int width, int height) { 838void peak_meter_draw(int x, int y, int width, int height)
839{
839 int left = 0, right = 0; 840 int left = 0, right = 0;
840 static int last_left = 0, last_right = 0; 841 static int last_left = 0, last_right = 0;
841 int meterwidth = width - 3; 842 int meterwidth = width - 3;
@@ -930,7 +931,9 @@ void peak_meter_draw(int x, int y, int width, int height) {
930 } 931 }
931 932
932 /* draw the peak meter */ 933 /* draw the peak meter */
933 lcd_clearrect(x, y, width, height); 934 lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
935 lcd_fillrect(x, y, width, height);
936 lcd_set_drawmode(DRMODE_SOLID);
934 937
935 /* draw left */ 938 /* draw left */
936 lcd_fillrect (x, y, left, height / 2 - 2 ); 939 lcd_fillrect (x, y, left, height / 2 - 2 );
@@ -956,17 +959,20 @@ void peak_meter_draw(int x, int y, int width, int height) {
956 lcd_drawline(x + meterwidth, y, 959 lcd_drawline(x + meterwidth, y,
957 x + meterwidth, y + height - 2); 960 x + meterwidth, y + height - 2);
958 961
962 lcd_set_drawmode(DRMODE_COMPLEMENT);
959 /* draw dots for scale marks */ 963 /* draw dots for scale marks */
960 for (i = 0; i < db_scale_count; i++) { 964 for (i = 0; i < db_scale_count; i++) {
961 /* The x-coordinates of interesting scale mark points 965 /* The x-coordinates of interesting scale mark points
962 have been calculated before */ 966 have been calculated before */
963 lcd_invertpixel(db_scale_lcd_coord[i], y + height / 2 - 1); 967 lcd_drawpixel(db_scale_lcd_coord[i], y + height / 2 - 1);
964 } 968 }
965 969
970
966#ifdef HAVE_RECORDING 971#ifdef HAVE_RECORDING
967 if (trig_status != TRIG_OFF) { 972 if (trig_status != TRIG_OFF) {
968 int start_trigx, stop_trigx, ycenter; 973 int start_trigx, stop_trigx, ycenter;
969 974
975 lcd_set_drawmode(DRMODE_SOLID);
970 ycenter = y + height / 2; 976 ycenter = y + height / 2;
971 /* display threshold value */ 977 /* display threshold value */
972 start_trigx = x+peak_meter_scale_value(trig_strt_threshold,meterwidth); 978 start_trigx = x+peak_meter_scale_value(trig_strt_threshold,meterwidth);
@@ -983,7 +989,8 @@ void peak_meter_draw(int x, int y, int width, int height) {
983#ifdef PM_DEBUG 989#ifdef PM_DEBUG
984 /* display a bar to show how many calls to peak_meter_peek 990 /* display a bar to show how many calls to peak_meter_peek
985 have ocurred since the last display */ 991 have ocurred since the last display */
986 lcd_invertrect(x, y, tmp, 3); 992 lcd_set_drawmode(DRMODE_COMPLEMENT);
993 lcd_fillrect(x, y, tmp, 3);
987 994
988 if (tmp < PEEKS_PER_DRAW_SIZE) { 995 if (tmp < PEEKS_PER_DRAW_SIZE) {
989 peeks_per_redraw[tmp]++; 996 peeks_per_redraw[tmp]++;
@@ -996,12 +1003,14 @@ void peak_meter_draw(int x, int y, int width, int height) {
996 1003
997 /* display a bar to show how many ticks have passed since 1004 /* display a bar to show how many ticks have passed since
998 the last redraw */ 1005 the last redraw */
999 lcd_invertrect(x, y + height / 2, current_tick - pm_tick, 2); 1006 lcd_fillrect(x, y + height / 2, current_tick - pm_tick, 2);
1000 pm_tick = current_tick; 1007 pm_tick = current_tick;
1001#endif 1008#endif
1002 1009
1003 last_left = left; 1010 last_left = left;
1004 last_right = right; 1011 last_right = right;
1012
1013 lcd_set_drawmode(DRMODE_SOLID);
1005} 1014}
1006 1015
1007#ifdef HAVE_RECORDING 1016#ifdef HAVE_RECORDING
diff --git a/apps/recorder/widgets.c b/apps/recorder/widgets.c
index 5c608bcb6b..09daf87fd3 100644
--- a/apps/recorder/widgets.c
+++ b/apps/recorder/widgets.c
@@ -54,14 +54,16 @@ void scrollbar(int x, int y, int width, int height, int items, int min_shown,
54 /* draw box */ 54 /* draw box */
55 lcd_drawrect(x, y, width, height); 55 lcd_drawrect(x, y, width, height);
56 56
57 lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
58
57 /* clear edge pixels */ 59 /* clear edge pixels */
58 lcd_clearpixel(x, y); 60 lcd_drawpixel(x, y);
59 lcd_clearpixel((x + width - 1), y); 61 lcd_drawpixel((x + width - 1), y);
60 lcd_clearpixel(x, (y + height - 1)); 62 lcd_drawpixel(x, (y + height - 1));
61 lcd_clearpixel((x + width - 1), (y + height - 1)); 63 lcd_drawpixel((x + width - 1), (y + height - 1));
62 64
63 /* clear pixels in progress bar */ 65 /* clear pixels in progress bar */
64 lcd_clearrect(x + 1, y + 1, width - 2, height - 2); 66 lcd_fillrect(x + 1, y + 1, width - 2, height - 2);
65 67
66 /* min should be min */ 68 /* min should be min */
67 if(min_shown < max_shown) { 69 if(min_shown < max_shown) {
@@ -111,6 +113,8 @@ void scrollbar(int x, int y, int width, int height, int items, int min_shown,
111 size = 1; 113 size = 1;
112 } 114 }
113 115
116 lcd_set_drawmode(DRMODE_SOLID);
117
114 if(orientation == VERTICAL) 118 if(orientation == VERTICAL)
115 lcd_fillrect(x + 1, y + start + 1, width - 2, size); 119 lcd_fillrect(x + 1, y + start + 1, width - 2, size);
116 else 120 else
@@ -133,11 +137,13 @@ void checkbox(int x, int y, int width, int height, bool checked)
133 lcd_drawrect(x, y, width, height); 137 lcd_drawrect(x, y, width, height);
134 138
135 if (checked){ 139 if (checked){
136 lcd_drawline(x + 2, y + 2, x + width - 2 - 1 , y + height - 2 - 1); 140 lcd_drawline(x + 2, y + 2, x + width - 2 - 1 , y + height - 2 - 1);
137 lcd_drawline(x + 2, y + height - 2 - 1, x + width - 2 - 1, y + 2); 141 lcd_drawline(x + 2, y + height - 2 - 1, x + width - 2 - 1, y + 2);
138 } else { 142 } else {
139 /* be sure to clear box */ 143 /* be sure to clear box */
140 lcd_clearrect(x + 1, y + 1, width - 2, height - 2); 144 lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
145 lcd_fillrect(x + 1, y + 1, width - 2, height - 2);
146 lcd_set_drawmode(DRMODE_SOLID);
141 } 147 }
142} 148}
143 149
diff --git a/apps/screens.c b/apps/screens.c
index 257093856f..c35d20c37e 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -845,11 +845,15 @@ void splash(int ticks, /* how long the splash is displayed */
845 if(center && (y > 2)) { 845 if(center && (y > 2)) {
846 if(maxw < (LCD_WIDTH -4)) { 846 if(maxw < (LCD_WIDTH -4)) {
847 int xx = (LCD_WIDTH-maxw)/2 - 2; 847 int xx = (LCD_WIDTH-maxw)/2 - 2;
848 lcd_clearrect(xx, y-2, maxw+4, LCD_HEIGHT-y*2+4); 848 lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
849 lcd_fillrect(xx, y-2, maxw+4, LCD_HEIGHT-y*2+4);
850 lcd_set_drawmode(DRMODE_SOLID);
849 lcd_drawrect(xx, y-2, maxw+4, LCD_HEIGHT-y*2+4); 851 lcd_drawrect(xx, y-2, maxw+4, LCD_HEIGHT-y*2+4);
850 } 852 }
851 else { 853 else {
852 lcd_clearrect(0, y-2, LCD_WIDTH, LCD_HEIGHT-y*2+4); 854 lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
855 lcd_fillrect(0, y-2, LCD_WIDTH, LCD_HEIGHT-y*2+4);
856 lcd_set_drawmode(DRMODE_SOLID);
853 lcd_drawline(0, y-2, LCD_WIDTH-1, y-2); 857 lcd_drawline(0, y-2, LCD_WIDTH-1, y-2);
854 lcd_drawline(0, LCD_HEIGHT-y+2, LCD_WIDTH-1, LCD_HEIGHT-y+2); 858 lcd_drawline(0, LCD_HEIGHT-y+2, LCD_WIDTH-1, LCD_HEIGHT-y+2);
855 } 859 }
@@ -965,6 +969,7 @@ bool set_time_screen(const char* string, struct tm *tm)
965 unsigned int width, height; 969 unsigned int width, height;
966 unsigned int separator_width, weekday_width; 970 unsigned int separator_width, weekday_width;
967 unsigned int line_height, prev_line_height; 971 unsigned int line_height, prev_line_height;
972 int lastmode = lcd_get_drawmode();
968 973
969 static const int dayname[] = { 974 static const int dayname[] = {
970 LANG_WEEKDAY_SUNDAY, 975 LANG_WEEKDAY_SUNDAY,
@@ -1108,10 +1113,12 @@ bool set_time_screen(const char* string, struct tm *tm)
1108 cursor[5][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height; 1113 cursor[5][INDEX_Y] = cursor[0][INDEX_Y] + prev_line_height;
1109 cursor[5][INDEX_WIDTH] = width; 1114 cursor[5][INDEX_WIDTH] = width;
1110 1115
1111 lcd_invertrect(cursor[cursorpos][INDEX_X], 1116 lcd_set_drawmode(DRMODE_COMPLEMENT);
1112 cursor[cursorpos][INDEX_Y] + lcd_getymargin(), 1117 lcd_fillrect(cursor[cursorpos][INDEX_X],
1113 cursor[cursorpos][INDEX_WIDTH], 1118 cursor[cursorpos][INDEX_Y] + lcd_getymargin(),
1114 line_height); 1119 cursor[cursorpos][INDEX_WIDTH],
1120 line_height);
1121 lcd_set_drawmode(DRMODE_SOLID);
1115 1122
1116 lcd_puts(0, 4, str(LANG_TIME_SET)); 1123 lcd_puts(0, 4, str(LANG_TIME_SET));
1117 lcd_puts(0, 5, str(LANG_TIME_REVERT)); 1124 lcd_puts(0, 5, str(LANG_TIME_REVERT));
@@ -1203,6 +1210,7 @@ bool set_time_screen(const char* string, struct tm *tm)
1203 } 1210 }
1204 } 1211 }
1205 1212
1213 lcd_set_drawmode(lastmode);
1206 return false; 1214 return false;
1207} 1215}
1208#endif /* defined(HAVE_LCD_BITMAP) && defined (HAVE_RTC) */ 1216#endif /* defined(HAVE_LCD_BITMAP) && defined (HAVE_RTC) */
diff --git a/apps/sound_menu.c b/apps/sound_menu.c
index fe3b9202b2..9a67033b54 100644
--- a/apps/sound_menu.c
+++ b/apps/sound_menu.c
@@ -633,7 +633,9 @@ bool rectrigger(void)
633 "%s", 633 "%s",
634 trig_durations[global_settings.rec_stop_gap]); 634 trig_durations[global_settings.rec_stop_gap]);
635 635
636 lcd_clearrect(0, stat_height, LCD_WIDTH, LCD_HEIGHT - stat_height); 636 lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
637 lcd_fillrect(0, stat_height, LCD_WIDTH, LCD_HEIGHT - stat_height);
638 lcd_set_drawmode(DRMODE_SOLID);
637 status_draw(true); 639 status_draw(true);
638 640
639 /* reselect FONT_SYSFONT as status_draw has changed the font */ 641 /* reselect FONT_SYSFONT as status_draw has changed the font */
@@ -650,8 +652,11 @@ bool rectrigger(void)
650 y = stat_height + i * h; 652 y = stat_height + i * h;
651 x = LCD_WIDTH - w; 653 x = LCD_WIDTH - w;
652 lcd_putsxy(x, y, str); 654 lcd_putsxy(x, y, str);
653 if ((int)selected == (i + offset)) 655 if ((int)selected == (i + offset)) {
654 lcd_invertrect(x, y, w, h); 656 lcd_set_drawmode(DRMODE_COMPLEMENT);
657 lcd_fillrect(x, y, w, h);
658 lcd_set_drawmode(DRMODE_SOLID);
659 }
655 } 660 }
656 661
657 scrollbar(0, stat_height, 662 scrollbar(0, stat_height,
diff --git a/apps/status.c b/apps/status.c
index 2218768451..ac11c17e1b 100644
--- a/apps/status.c
+++ b/apps/status.c
@@ -187,7 +187,9 @@ void status_draw(bool force_redraw)
187 info.redraw_volume || 187 info.redraw_volume ||
188 memcmp(&info, &lastinfo, sizeof(struct status_info))) 188 memcmp(&info, &lastinfo, sizeof(struct status_info)))
189 { 189 {
190 lcd_clearrect(0,0,LCD_WIDTH,8); 190 lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
191 lcd_fillrect(0,0,LCD_WIDTH,8);
192 lcd_set_drawmode(DRMODE_SOLID);
191#else 193#else
192 /* players always "redraw" */ 194 /* players always "redraw" */
193 { 195 {
@@ -326,7 +328,9 @@ static void draw_buttonbar_btn(int num, const char* caption)
326 lcd_putsxy(xpos + (button_width - text_width)/2, ypos, caption); 328 lcd_putsxy(xpos + (button_width - text_width)/2, ypos, caption);
327 } 329 }
328 330
329 lcd_invertrect(xpos, ypos, button_width - 1, fh); 331 lcd_set_drawmode(DRMODE_COMPLEMENT);
332 lcd_fillrect(xpos, ypos, button_width - 1, fh);
333 lcd_set_drawmode(DRMODE_SOLID);
330} 334}
331 335
332static char stored_caption1[8]; 336static char stored_caption1[8];
@@ -363,7 +367,9 @@ void buttonbar_unset(void)
363 367
364void buttonbar_draw(void) 368void buttonbar_draw(void)
365{ 369{
366 lcd_clearrect(0, LCD_HEIGHT-8, LCD_WIDTH, 8); 370 lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
371 lcd_fillrect(0, LCD_HEIGHT-8, LCD_WIDTH, 8);
372 lcd_set_drawmode(DRMODE_SOLID);
367 draw_buttonbar_btn(0, stored_caption1); 373 draw_buttonbar_btn(0, stored_caption1);
368 draw_buttonbar_btn(1, stored_caption2); 374 draw_buttonbar_btn(1, stored_caption2);
369 draw_buttonbar_btn(2, stored_caption3); 375 draw_buttonbar_btn(2, stored_caption3);