summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJens Arnold <amiconn@rockbox.org>2005-06-25 00:28:09 +0000
committerJens Arnold <amiconn@rockbox.org>2005-06-25 00:28:09 +0000
commit934941294b27b3e9a9012be1abe86f4e05db2204 (patch)
treeb704b66f0c8936ba78bdc6a69c2126cf0dba3314
parent24a1f94cd7cc50fbda6689d33c5d2dbcf123dab5 (diff)
downloadrockbox-934941294b27b3e9a9012be1abe86f4e05db2204.tar.gz
rockbox-934941294b27b3e9a9012be1abe86f4e05db2204.zip
Core functions taking advantage of the new, optimised lcd_hline() and lcd_vline() functions. Some cleanup.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6859 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/debug_menu.c6
-rw-r--r--apps/recorder/keyboard.c4
-rw-r--r--apps/recorder/peakmeter.c19
-rw-r--r--apps/screens.c4
-rw-r--r--firmware/drivers/lcd-h100.c9
-rw-r--r--firmware/drivers/lcd-recorder.c9
-rw-r--r--firmware/export/lcd.h4
-rw-r--r--uisimulator/battery.c14
8 files changed, 29 insertions, 40 deletions
diff --git a/apps/debug_menu.c b/apps/debug_menu.c
index a1097ba925..805c8db2ba 100644
--- a/apps/debug_menu.c
+++ b/apps/debug_menu.c
@@ -1143,10 +1143,10 @@ bool view_battery(void)
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_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); 1145 lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
1146 lcd_drawline(x, LCD_HEIGHT-1, x, 20); 1146 lcd_vline(x, LCD_HEIGHT-1, 20);
1147 lcd_set_drawmode(DRMODE_SOLID); 1147 lcd_set_drawmode(DRMODE_SOLID);
1148 lcd_drawline(x, LCD_HEIGHT-1, x, 1148 lcd_vline(x, LCD_HEIGHT-1,
1149 MIN(MAX(LCD_HEIGHT-1 - y, 20), LCD_HEIGHT-1)); 1149 MIN(MAX(LCD_HEIGHT-1 - y, 20), LCD_HEIGHT-1));
1150 x++; 1150 x++;
1151 } 1151 }
1152 1152
diff --git a/apps/recorder/keyboard.c b/apps/recorder/keyboard.c
index cfaf03c94a..bbca117bdb 100644
--- a/apps/recorder/keyboard.c
+++ b/apps/recorder/keyboard.c
@@ -167,7 +167,7 @@ int kbd_input(char* text, int buflen)
167 lcd_putsxy(0, 8+i * font_h, line[i]); 167 lcd_putsxy(0, 8+i * font_h, line[i]);
168 168
169 /* separator */ 169 /* separator */
170 lcd_drawline(0, main_y - margin, LCD_WIDTH - 1, main_y - margin); 170 lcd_hline(0, LCD_WIDTH - 1, main_y - margin);
171 171
172 /* write out the text */ 172 /* write out the text */
173 curpos = MIN(editpos, max_chars - MIN(len - editpos, 2)); 173 curpos = MIN(editpos, max_chars - MIN(len - editpos, 2));
@@ -184,7 +184,7 @@ int kbd_input(char* text, int buflen)
184 184
185 /* cursor */ 185 /* cursor */
186 i = (curpos + 1) * font_w; 186 i = (curpos + 1) * font_w;
187 lcd_drawline(i, main_y, i, main_y + font_h); 187 lcd_vline(i, main_y, main_y + font_h);
188 188
189#if CONFIG_KEYPAD == RECORDER_PAD 189#if CONFIG_KEYPAD == RECORDER_PAD
190 /* draw the status bar */ 190 /* draw the status bar */
diff --git a/apps/recorder/peakmeter.c b/apps/recorder/peakmeter.c
index 8fffc9500d..779200cb85 100644
--- a/apps/recorder/peakmeter.c
+++ b/apps/recorder/peakmeter.c
@@ -938,8 +938,7 @@ void peak_meter_draw(int x, int y, int width, int height)
938 /* draw left */ 938 /* draw left */
939 lcd_fillrect (x, y, left, height / 2 - 2 ); 939 lcd_fillrect (x, y, left, height / 2 - 2 );
940 if (peak_meter_max_l > 0) { 940 if (peak_meter_max_l > 0) {
941 lcd_drawline(x + peak_meter_max_l, y, 941 lcd_vline(x + peak_meter_max_l, y, y + height / 2 - 2 );
942 x + peak_meter_max_l, y + height / 2 - 2 );
943 } 942 }
944 if (peak_meter_l_clip) { 943 if (peak_meter_l_clip) {
945 lcd_fillrect(x + meterwidth, y, 3, height / 2 - 1); 944 lcd_fillrect(x + meterwidth, y, 3, height / 2 - 1);
@@ -948,17 +947,15 @@ void peak_meter_draw(int x, int y, int width, int height)
948 /* draw right */ 947 /* draw right */
949 lcd_fillrect(x, y + height / 2 + 1, right, height / 2 - 2); 948 lcd_fillrect(x, y + height / 2 + 1, right, height / 2 - 2);
950 if (peak_meter_max_r > 0) { 949 if (peak_meter_max_r > 0) {
951 lcd_drawline( x + peak_meter_max_r, y + height / 2, 950 lcd_vline( x + peak_meter_max_r, y + height / 2, y + height - 2);
952 x + peak_meter_max_r, y + height - 2);
953 } 951 }
954 if (peak_meter_r_clip) { 952 if (peak_meter_r_clip) {
955 lcd_fillrect(x + meterwidth, y + height / 2, 3, height / 2 - 1); 953 lcd_fillrect(x + meterwidth, y + height / 2, 3, height / 2 - 1);
956 } 954 }
957 955
958 /* draw scale end */ 956 /* draw scale end */
959 lcd_drawline(x + meterwidth, y, 957 lcd_vline(x + meterwidth, y, y + height - 2);
960 x + meterwidth, y + height - 2); 958
961
962 lcd_set_drawmode(DRMODE_COMPLEMENT); 959 lcd_set_drawmode(DRMODE_COMPLEMENT);
963 /* draw dots for scale marks */ 960 /* draw dots for scale marks */
964 for (i = 0; i < db_scale_count; i++) { 961 for (i = 0; i < db_scale_count; i++) {
@@ -976,12 +973,12 @@ void peak_meter_draw(int x, int y, int width, int height)
976 ycenter = y + height / 2; 973 ycenter = y + height / 2;
977 /* display threshold value */ 974 /* display threshold value */
978 start_trigx = x+peak_meter_scale_value(trig_strt_threshold,meterwidth); 975 start_trigx = x+peak_meter_scale_value(trig_strt_threshold,meterwidth);
979 lcd_drawline(start_trigx, ycenter - 2, start_trigx, ycenter); 976 lcd_vline(start_trigx, ycenter - 2, ycenter);
980 start_trigx ++; 977 start_trigx ++;
981 if (start_trigx < LCD_WIDTH) lcd_drawpixel(start_trigx, ycenter - 1); 978 if (start_trigx < LCD_WIDTH) lcd_drawpixel(start_trigx, ycenter - 1);
982 979
983 stop_trigx = x + peak_meter_scale_value(trig_stp_threshold,meterwidth); 980 stop_trigx = x + peak_meter_scale_value(trig_stp_threshold,meterwidth);
984 lcd_drawline(stop_trigx, ycenter - 2, stop_trigx, ycenter); 981 lcd_vline(stop_trigx, ycenter - 2, ycenter);
985 if (stop_trigx > 0) lcd_drawpixel(stop_trigx - 1, ycenter - 1); 982 if (stop_trigx > 0) lcd_drawpixel(stop_trigx - 1, ycenter - 1);
986 } 983 }
987#endif 984#endif
@@ -1196,7 +1193,7 @@ bool peak_meter_histogram(void) {
1196 1193
1197 for (i = 0; i < PEEKS_PER_DRAW_SIZE; i++) { 1194 for (i = 0; i < PEEKS_PER_DRAW_SIZE; i++) {
1198 x = peeks_per_redraw[i] * (LCD_WIDTH - 1)/ max; 1195 x = peeks_per_redraw[i] * (LCD_WIDTH - 1)/ max;
1199 lcd_drawline(0, y + i, x, y + i); 1196 lcd_hline(0, x, y + i);
1200 } 1197 }
1201 1198
1202 y = PEEKS_PER_DRAW_SIZE + 1; 1199 y = PEEKS_PER_DRAW_SIZE + 1;
@@ -1208,7 +1205,7 @@ bool peak_meter_histogram(void) {
1208 1205
1209 for (i = 0; i < TICKS_PER_DRAW_SIZE; i++) { 1206 for (i = 0; i < TICKS_PER_DRAW_SIZE; i++) {
1210 x = ticks_per_redraw[i] * (LCD_WIDTH - 1)/ max; 1207 x = ticks_per_redraw[i] * (LCD_WIDTH - 1)/ max;
1211 lcd_drawline(0, y + i, x, y + i); 1208 lcd_hline(0, x, y + i);
1212 } 1209 }
1213 lcd_update(); 1210 lcd_update();
1214 1211
diff --git a/apps/screens.c b/apps/screens.c
index c35d20c37e..1ae7030822 100644
--- a/apps/screens.c
+++ b/apps/screens.c
@@ -854,8 +854,8 @@ void splash(int ticks, /* how long the splash is displayed */
854 lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); 854 lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
855 lcd_fillrect(0, y-2, LCD_WIDTH, LCD_HEIGHT-y*2+4); 855 lcd_fillrect(0, y-2, LCD_WIDTH, LCD_HEIGHT-y*2+4);
856 lcd_set_drawmode(DRMODE_SOLID); 856 lcd_set_drawmode(DRMODE_SOLID);
857 lcd_drawline(0, y-2, LCD_WIDTH-1, y-2); 857 lcd_hline(0, LCD_WIDTH-1, y-2);
858 lcd_drawline(0, LCD_HEIGHT-y+2, LCD_WIDTH-1, LCD_HEIGHT-y+2); 858 lcd_hline(0, LCD_WIDTH-1, LCD_HEIGHT-y+2);
859 } 859 }
860 } 860 }
861 else 861 else
diff --git a/firmware/drivers/lcd-h100.c b/firmware/drivers/lcd-h100.c
index db2aba8673..666949ff72 100644
--- a/firmware/drivers/lcd-h100.c
+++ b/firmware/drivers/lcd-h100.c
@@ -332,7 +332,7 @@ static void nopixel(int x, int y)
332} 332}
333 333
334lcd_pixelfunc_type* pixelfunc[8] = {flippixel, nopixel, setpixel, setpixel, 334lcd_pixelfunc_type* pixelfunc[8] = {flippixel, nopixel, setpixel, setpixel,
335 nopixel, clearpixel, nopixel, clearpixel}; 335 nopixel, clearpixel, nopixel, clearpixel};
336 336
337static void flipblock(unsigned char *address, unsigned mask, unsigned bits) 337static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
338{ 338{
@@ -361,10 +361,9 @@ lcd_blockfunc_type* blockfunc[4] = {flipblock, bgblock, fgblock, solidblock};
361/* Clear the whole display */ 361/* Clear the whole display */
362void lcd_clear_display(void) 362void lcd_clear_display(void)
363{ 363{
364 if (drawmode & DRMODE_INVERSEVID) 364 unsigned bits = (drawmode & DRMODE_INVERSEVID) ? 0xFFu : 0;
365 memset (lcd_framebuffer, 0xFF, sizeof lcd_framebuffer); 365
366 else 366 memset(lcd_framebuffer, bits, sizeof lcd_framebuffer);
367 memset (lcd_framebuffer, 0, sizeof lcd_framebuffer);
368 scrolling_lines = 0; 367 scrolling_lines = 0;
369} 368}
370 369
diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c
index a83f58e35d..1255516b51 100644
--- a/firmware/drivers/lcd-recorder.c
+++ b/firmware/drivers/lcd-recorder.c
@@ -391,7 +391,7 @@ static void nopixel(int x, int y)
391} 391}
392 392
393lcd_pixelfunc_type* pixelfunc[8] = {flippixel, nopixel, setpixel, setpixel, 393lcd_pixelfunc_type* pixelfunc[8] = {flippixel, nopixel, setpixel, setpixel,
394 nopixel, clearpixel, nopixel, clearpixel}; 394 nopixel, clearpixel, nopixel, clearpixel};
395 395
396static void flipblock(unsigned char *address, unsigned mask, unsigned bits) 396static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
397{ 397{
@@ -420,10 +420,9 @@ lcd_blockfunc_type* blockfunc[4] = {flipblock, bgblock, fgblock, solidblock};
420/* Clear the whole display */ 420/* Clear the whole display */
421void lcd_clear_display(void) 421void lcd_clear_display(void)
422{ 422{
423 if (drawmode & DRMODE_INVERSEVID) 423 unsigned bits = (drawmode & DRMODE_INVERSEVID) ? 0xFFu : 0;
424 memset (lcd_framebuffer, 0xFF, sizeof lcd_framebuffer); 424
425 else 425 memset(lcd_framebuffer, bits, sizeof lcd_framebuffer);
426 memset (lcd_framebuffer, 0, sizeof lcd_framebuffer);
427 scrolling_lines = 0; 426 scrolling_lines = 0;
428} 427}
429 428
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index c6e0fe0f0e..3824096aba 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -122,10 +122,6 @@ extern void lcd_jump_scroll_delay(int ms);
122#define DRMODE_SOLID 3 122#define DRMODE_SOLID 3
123#define DRMODE_INVERSEVID 4 /* used as bit modifier for basic modes */ 123#define DRMODE_INVERSEVID 4 /* used as bit modifier for basic modes */
124 124
125#define DRAW_PIXEL(x,y) lcd_framebuffer[(y)/8][(x)] |= (1<<((y)&7))
126#define CLEAR_PIXEL(x,y) lcd_framebuffer[(y)/8][(x)] &= ~(1<<((y)&7))
127#define INVERT_PIXEL(x,y) lcd_framebuffer[(y)/8][(x)] ^= (1<<((y)&7))
128
129typedef void lcd_pixelfunc_type(int x, int y); /* for b&w */ 125typedef void lcd_pixelfunc_type(int x, int y); /* for b&w */
130typedef void lcd_blockfunc_type(unsigned char *address, unsigned mask, unsigned bits); 126typedef void lcd_blockfunc_type(unsigned char *address, unsigned mask, unsigned bits);
131 127
diff --git a/uisimulator/battery.c b/uisimulator/battery.c
index d8580b42d1..acb0835e9f 100644
--- a/uisimulator/battery.c
+++ b/uisimulator/battery.c
@@ -62,18 +62,16 @@ void draw_battery(int xbase, int ybase, int len, int wid, int percent)
62 } 62 }
63 63
64 /* top batt. edge */ 64 /* top batt. edge */
65 lcd_drawline(xbase, ybase, xbase+len-2, ybase); 65 lcd_hline(xbase, xbase+len-2, ybase);
66 66
67 /* bot batt. edge */ 67 /* bot batt. edge */
68 lcd_drawline(xbase, ybase+wid, 68 lcd_hine(xbase, xbase+len-2, ybase+wid);
69 xbase+len-2, ybase+wid);
70 69
71 /* left batt. edge */ 70 /* left batt. edge */
72 lcd_drawline(xbase, ybase, xbase, ybase+wid); 71 lcd_vline(xbase, ybase, ybase+wid);
73 72
74 /* right batt. edge */ 73 /* right batt. edge */
75 lcd_drawline(xbase+len, ybase+1, 74 lcd_vline(xbase+len, ybase+1, ybase+wid-1);
76 xbase+len, ybase+wid-1);
77 75
78 /* 2 dots that account for the nub on the right side of the battery */ 76 /* 2 dots that account for the nub on the right side of the battery */
79 lcd_drawpixel(xbase+len-1, ybase+1); 77 lcd_drawpixel(xbase+len-1, ybase+1);
@@ -85,8 +83,8 @@ void draw_battery(int xbase, int ybase, int len, int wid, int percent)
85 bar_len = capacity; 83 bar_len = capacity;
86 84
87 for(i = 0; i < bar_wid+1; i++) { 85 for(i = 0; i < bar_wid+1; i++) {
88 lcd_drawline(xbase+bar_xoffset, ybase+bar_yoffset+i, 86 lcd_hline(xbase+bar_xoffset,
89 xbase+bar_xoffset+bar_len, ybase+bar_yoffset+i); 87 xbase+bar_xoffset+bar_len, ybase+bar_yoffset+i);
90 } 88 }
91 } 89 }
92 lcd_update(); 90 lcd_update();