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
This commit is contained in:
Jens Arnold 2005-06-25 00:28:09 +00:00
parent 24a1f94cd7
commit 934941294b
8 changed files with 29 additions and 40 deletions

View file

@ -1143,10 +1143,10 @@ bool view_battery(void)
for (i = BAT_LAST_VAL - 1; i >= 0; i--) {
y = (power_history[i] - minv) * BAT_YSPACE / (maxv - minv);
lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
lcd_drawline(x, LCD_HEIGHT-1, x, 20);
lcd_vline(x, LCD_HEIGHT-1, 20);
lcd_set_drawmode(DRMODE_SOLID);
lcd_drawline(x, LCD_HEIGHT-1, x,
MIN(MAX(LCD_HEIGHT-1 - y, 20), LCD_HEIGHT-1));
lcd_vline(x, LCD_HEIGHT-1,
MIN(MAX(LCD_HEIGHT-1 - y, 20), LCD_HEIGHT-1));
x++;
}

View file

@ -167,7 +167,7 @@ int kbd_input(char* text, int buflen)
lcd_putsxy(0, 8+i * font_h, line[i]);
/* separator */
lcd_drawline(0, main_y - margin, LCD_WIDTH - 1, main_y - margin);
lcd_hline(0, LCD_WIDTH - 1, main_y - margin);
/* write out the text */
curpos = MIN(editpos, max_chars - MIN(len - editpos, 2));
@ -184,7 +184,7 @@ int kbd_input(char* text, int buflen)
/* cursor */
i = (curpos + 1) * font_w;
lcd_drawline(i, main_y, i, main_y + font_h);
lcd_vline(i, main_y, main_y + font_h);
#if CONFIG_KEYPAD == RECORDER_PAD
/* draw the status bar */

View file

@ -938,8 +938,7 @@ void peak_meter_draw(int x, int y, int width, int height)
/* draw left */
lcd_fillrect (x, y, left, height / 2 - 2 );
if (peak_meter_max_l > 0) {
lcd_drawline(x + peak_meter_max_l, y,
x + peak_meter_max_l, y + height / 2 - 2 );
lcd_vline(x + peak_meter_max_l, y, y + height / 2 - 2 );
}
if (peak_meter_l_clip) {
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)
/* draw right */
lcd_fillrect(x, y + height / 2 + 1, right, height / 2 - 2);
if (peak_meter_max_r > 0) {
lcd_drawline( x + peak_meter_max_r, y + height / 2,
x + peak_meter_max_r, y + height - 2);
lcd_vline( x + peak_meter_max_r, y + height / 2, y + height - 2);
}
if (peak_meter_r_clip) {
lcd_fillrect(x + meterwidth, y + height / 2, 3, height / 2 - 1);
}
/* draw scale end */
lcd_drawline(x + meterwidth, y,
x + meterwidth, y + height - 2);
lcd_vline(x + meterwidth, y, y + height - 2);
lcd_set_drawmode(DRMODE_COMPLEMENT);
/* draw dots for scale marks */
for (i = 0; i < db_scale_count; i++) {
@ -976,12 +973,12 @@ void peak_meter_draw(int x, int y, int width, int height)
ycenter = y + height / 2;
/* display threshold value */
start_trigx = x+peak_meter_scale_value(trig_strt_threshold,meterwidth);
lcd_drawline(start_trigx, ycenter - 2, start_trigx, ycenter);
lcd_vline(start_trigx, ycenter - 2, ycenter);
start_trigx ++;
if (start_trigx < LCD_WIDTH) lcd_drawpixel(start_trigx, ycenter - 1);
stop_trigx = x + peak_meter_scale_value(trig_stp_threshold,meterwidth);
lcd_drawline(stop_trigx, ycenter - 2, stop_trigx, ycenter);
lcd_vline(stop_trigx, ycenter - 2, ycenter);
if (stop_trigx > 0) lcd_drawpixel(stop_trigx - 1, ycenter - 1);
}
#endif
@ -1196,7 +1193,7 @@ bool peak_meter_histogram(void) {
for (i = 0; i < PEEKS_PER_DRAW_SIZE; i++) {
x = peeks_per_redraw[i] * (LCD_WIDTH - 1)/ max;
lcd_drawline(0, y + i, x, y + i);
lcd_hline(0, x, y + i);
}
y = PEEKS_PER_DRAW_SIZE + 1;
@ -1208,7 +1205,7 @@ bool peak_meter_histogram(void) {
for (i = 0; i < TICKS_PER_DRAW_SIZE; i++) {
x = ticks_per_redraw[i] * (LCD_WIDTH - 1)/ max;
lcd_drawline(0, y + i, x, y + i);
lcd_hline(0, x, y + i);
}
lcd_update();

View file

@ -854,8 +854,8 @@ void splash(int ticks, /* how long the splash is displayed */
lcd_set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
lcd_fillrect(0, y-2, LCD_WIDTH, LCD_HEIGHT-y*2+4);
lcd_set_drawmode(DRMODE_SOLID);
lcd_drawline(0, y-2, LCD_WIDTH-1, y-2);
lcd_drawline(0, LCD_HEIGHT-y+2, LCD_WIDTH-1, LCD_HEIGHT-y+2);
lcd_hline(0, LCD_WIDTH-1, y-2);
lcd_hline(0, LCD_WIDTH-1, LCD_HEIGHT-y+2);
}
}
else

View file

@ -332,7 +332,7 @@ static void nopixel(int x, int y)
}
lcd_pixelfunc_type* pixelfunc[8] = {flippixel, nopixel, setpixel, setpixel,
nopixel, clearpixel, nopixel, clearpixel};
nopixel, clearpixel, nopixel, clearpixel};
static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
{
@ -361,10 +361,9 @@ lcd_blockfunc_type* blockfunc[4] = {flipblock, bgblock, fgblock, solidblock};
/* Clear the whole display */
void lcd_clear_display(void)
{
if (drawmode & DRMODE_INVERSEVID)
memset (lcd_framebuffer, 0xFF, sizeof lcd_framebuffer);
else
memset (lcd_framebuffer, 0, sizeof lcd_framebuffer);
unsigned bits = (drawmode & DRMODE_INVERSEVID) ? 0xFFu : 0;
memset(lcd_framebuffer, bits, sizeof lcd_framebuffer);
scrolling_lines = 0;
}

View file

@ -391,7 +391,7 @@ static void nopixel(int x, int y)
}
lcd_pixelfunc_type* pixelfunc[8] = {flippixel, nopixel, setpixel, setpixel,
nopixel, clearpixel, nopixel, clearpixel};
nopixel, clearpixel, nopixel, clearpixel};
static void flipblock(unsigned char *address, unsigned mask, unsigned bits)
{
@ -420,10 +420,9 @@ lcd_blockfunc_type* blockfunc[4] = {flipblock, bgblock, fgblock, solidblock};
/* Clear the whole display */
void lcd_clear_display(void)
{
if (drawmode & DRMODE_INVERSEVID)
memset (lcd_framebuffer, 0xFF, sizeof lcd_framebuffer);
else
memset (lcd_framebuffer, 0, sizeof lcd_framebuffer);
unsigned bits = (drawmode & DRMODE_INVERSEVID) ? 0xFFu : 0;
memset(lcd_framebuffer, bits, sizeof lcd_framebuffer);
scrolling_lines = 0;
}

View file

@ -122,10 +122,6 @@ extern void lcd_jump_scroll_delay(int ms);
#define DRMODE_SOLID 3
#define DRMODE_INVERSEVID 4 /* used as bit modifier for basic modes */
#define DRAW_PIXEL(x,y) lcd_framebuffer[(y)/8][(x)] |= (1<<((y)&7))
#define CLEAR_PIXEL(x,y) lcd_framebuffer[(y)/8][(x)] &= ~(1<<((y)&7))
#define INVERT_PIXEL(x,y) lcd_framebuffer[(y)/8][(x)] ^= (1<<((y)&7))
typedef void lcd_pixelfunc_type(int x, int y); /* for b&w */
typedef void lcd_blockfunc_type(unsigned char *address, unsigned mask, unsigned bits);

View file

@ -62,18 +62,16 @@ void draw_battery(int xbase, int ybase, int len, int wid, int percent)
}
/* top batt. edge */
lcd_drawline(xbase, ybase, xbase+len-2, ybase);
lcd_hline(xbase, xbase+len-2, ybase);
/* bot batt. edge */
lcd_drawline(xbase, ybase+wid,
xbase+len-2, ybase+wid);
lcd_hine(xbase, xbase+len-2, ybase+wid);
/* left batt. edge */
lcd_drawline(xbase, ybase, xbase, ybase+wid);
lcd_vline(xbase, ybase, ybase+wid);
/* right batt. edge */
lcd_drawline(xbase+len, ybase+1,
xbase+len, ybase+wid-1);
lcd_vline(xbase+len, ybase+1, ybase+wid-1);
/* 2 dots that account for the nub on the right side of the battery */
lcd_drawpixel(xbase+len-1, ybase+1);
@ -85,8 +83,8 @@ void draw_battery(int xbase, int ybase, int len, int wid, int percent)
bar_len = capacity;
for(i = 0; i < bar_wid+1; i++) {
lcd_drawline(xbase+bar_xoffset, ybase+bar_yoffset+i,
xbase+bar_xoffset+bar_len, ybase+bar_yoffset+i);
lcd_hline(xbase+bar_xoffset,
xbase+bar_xoffset+bar_len, ybase+bar_yoffset+i);
}
}
lcd_update();