From fef82552e19efd2f2a7c5918c650bbf39bfd454d Mon Sep 17 00:00:00 2001 From: Jens Arnold Date: Sat, 12 Apr 2008 09:51:16 +0000 Subject: [PATCH] Optimise some more line drawing calls. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17083 a1c6a512-1295-4272-9138-f99709370657 --- apps/plugins/calculator.c | 8 +++---- apps/plugins/calendar.c | 6 +++--- apps/plugins/clock/clock_draw_analog.c | 23 ++++++++------------ apps/plugins/metronome.c | 2 +- apps/plugins/pegbox.c | 2 +- apps/plugins/rockpaint.c | 8 +++---- apps/plugins/splitedit.c | 12 +++++------ apps/plugins/superdom.c | 16 ++++++-------- apps/plugins/vu_meter.c | 14 ++++++------ apps/plugins/wavview.c | 30 +++++++++++--------------- 10 files changed, 53 insertions(+), 68 deletions(-) diff --git a/apps/plugins/calculator.c b/apps/plugins/calculator.c index 1cb1ee915d..979705fbe1 100644 --- a/apps/plugins/calculator.c +++ b/apps/plugins/calculator.c @@ -502,13 +502,11 @@ void cal_initial (void) /* draw lines */ rb->lcd_drawrect(X_0_POS, Y_0_POS, LCD_WIDTH-1, LCD_HEIGHT); - rb->lcd_drawline(X_0_POS, Y_1_POS-1, X_5_POS, Y_1_POS-1); + rb->lcd_hline(X_0_POS, X_5_POS, Y_1_POS-1); for (i = 0; i < 5 ; i++) - rb->lcd_drawline(X_0_POS, Y_1_POS+i*REC_HEIGHT, - X_5_POS, Y_1_POS+i*REC_HEIGHT); + rb->lcd_hline(X_0_POS, X_5_POS, Y_1_POS+i*REC_HEIGHT); for (i = 0; i < 4 ; i++) - rb->lcd_drawline(X_1_POS+i*REC_WIDTH, Y_1_POS, - X_1_POS+i*REC_WIDTH, Y_6_POS); + rb->lcd_vline(X_1_POS+i*REC_WIDTH, Y_1_POS, Y_6_POS); #ifdef CALCULATOR_OPERATORS /* basic operators are available through separate button */ diff --git a/apps/plugins/calendar.c b/apps/plugins/calendar.c index 8ed6122c3f..8798406b2e 100644 --- a/apps/plugins/calendar.c +++ b/apps/plugins/calendar.c @@ -114,7 +114,7 @@ static void draw_headers(void) rb->lcd_putsxy(ws, 0 , Dayname[i++]); ws += space; } - rb->lcd_drawline(0 ,h ,LCD_WIDTH-1 ,h); + rb->lcd_hline(0, LCD_WIDTH-1 ,h); } static bool day_has_memo[31]; @@ -170,8 +170,8 @@ static void draw_calendar(struct shown *shown) ws = 2; } } - rb->lcd_drawline(60,LCD_HEIGHT-h-3,60,LCD_HEIGHT-1); - rb->lcd_drawline(60,LCD_HEIGHT-h-3,LCD_WIDTH-1,LCD_HEIGHT-h-3); + rb->lcd_vline(60,LCD_HEIGHT-h-3,LCD_HEIGHT-1); + rb->lcd_hline(60,LCD_WIDTH-1,LCD_HEIGHT-h-3); rb->snprintf(buffer,9,"%s %04d",Monthname[shown->mon-1],shown->year); rb->lcd_putsxy(62,(LCD_HEIGHT-h-1),buffer); shown->lastday = pos; diff --git a/apps/plugins/clock/clock_draw_analog.c b/apps/plugins/clock/clock_draw_analog.c index 0ab058e3fa..c4d12a83a2 100644 --- a/apps/plugins/clock/clock_draw_analog.c +++ b/apps/plugins/clock/clock_draw_analog.c @@ -220,20 +220,15 @@ void draw_hour(struct screen* display, struct time* time, void draw_center_cover(struct screen* display) { - display->drawline((display->width/2)-1, (display->height/2)+3, - (display->width/2)+1, (display->height/2)+3); - display->drawline((display->width/2)-3, (display->height/2)+2, - (display->width/2)+3, (display->height/2)+2); - display->drawline((display->width/2)-4, (display->height/2)+1, - (display->width/2)+4, (display->height/2)+1); - display->drawline((display->width/2)-4, display->height/2, - (display->width/2)+4, display->height/2); - display->drawline((display->width/2)-4, (display->height/2)-1, - (display->width/2)+4, (display->height/2)-1); - display->drawline((display->width/2)-3, (display->height/2)-2, - (display->width/2)+3, (display->height/2)-2); - display->drawline((display->width/2)-1, (display->height/2)-3, - (display->width/2)+1, (display->height/2)-3); + display->hline((display->width/2)-1, + (display->width/2)+1, (display->height/2)+3); + display->hline((display->width/2)-3, + (display->width/2)+3, (display->height/2)+2); + display->fillrect((display->width/2)-4, (display->height/2)-1, 9, 3); + display->hline((display->width/2)-3, + (display->width/2)+3, (display->height/2)-2); + display->hline((display->width/2)-1, + (display->width/2)+1, (display->height/2)-3); } void analog_clock_draw(struct screen* display, struct time* time, diff --git a/apps/plugins/metronome.c b/apps/plugins/metronome.c index d05e881f4f..a778429195 100644 --- a/apps/plugins/metronome.c +++ b/apps/plugins/metronome.c @@ -188,7 +188,7 @@ void metronome_draw(struct screen* display) #endif /* HAVE_LCD_BITMAP */ #ifdef HAVE_LCD_BITMAP - display->drawline(0, 12, 111, 12); + display->hline(0, 111, 12); if(sound_paused) display->puts(0,2,METRONOME_MSG_START); else diff --git a/apps/plugins/pegbox.c b/apps/plugins/pegbox.c index 23fabf11c7..45c830a5a0 100644 --- a/apps/plugins/pegbox.c +++ b/apps/plugins/pegbox.c @@ -1000,7 +1000,7 @@ static unsigned int pegbox_menu(struct game_context* pb) { rb->lcd_putsxy((LCD_WIDTH)/4, 40, "Quit"); if(!can_resume) - rb->lcd_drawline((LCD_WIDTH)/4, 28, (LCD_WIDTH)/4+30, 28); + rb->lcd_hline((LCD_WIDTH)/4, (LCD_WIDTH)/4+30, 28); rb->lcd_putsxy((LCD_WIDTH)/4-8, loc*8+16, "*"); diff --git a/apps/plugins/rockpaint.c b/apps/plugins/rockpaint.c index 7d5b5cbaa8..7e4aefddf2 100644 --- a/apps/plugins/rockpaint.c +++ b/apps/plugins/rockpaint.c @@ -2461,10 +2461,10 @@ static void inv_cursor(bool update) rb->lcd_set_foreground(COLOR_BLACK); rb->lcd_set_drawmode(DRMODE_COMPLEMENT); /* cross painting */ - rb->lcd_drawline(x-4,y,x-1,y); - rb->lcd_drawline(x+1,y,x+4,y); - rb->lcd_drawline(x,y-4,x,y-1); - rb->lcd_drawline(x,y+1,x,y+4); + rb->lcd_hline(x-4,x-1,y); + rb->lcd_hline(x+1,x+4,y); + rb->lcd_vline(x,y-4,y-1); + rb->lcd_vline(x,y+1,y+4); rb->lcd_set_foreground(rp_colors[drawcolor]); rb->lcd_set_drawmode(DRMODE_SOLID); diff --git a/apps/plugins/splitedit.c b/apps/plugins/splitedit.c index 7dd6be0408..ab4ce415b7 100644 --- a/apps/plugins/splitedit.c +++ b/apps/plugins/splitedit.c @@ -338,10 +338,10 @@ static void redraw_osci(void) { if (osci_buffer[x] > 0) { - rb->lcd_drawline + rb->lcd_vline ( OSCI_X + x, OSCI_Y + OSCI_HEIGHT - 1, - OSCI_X + x, OSCI_Y + OSCI_HEIGHT - osci_buffer[x] - 1 + OSCI_Y + OSCI_HEIGHT - osci_buffer[x] - 1 ); } } @@ -977,10 +977,10 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split, int i; for (i = lastx +1; i <= x; i++) { - rb->lcd_drawline + rb->lcd_vline ( i, OSCI_Y + OSCI_HEIGHT - 1, - i, OSCI_Y + OSCI_HEIGHT - osci_buffer[i - OSCI_X]-1 + OSCI_Y + OSCI_HEIGHT - osci_buffer[i - OSCI_X]-1 ); } } @@ -1007,8 +1007,8 @@ unsigned long splitedit_editor(struct mp3entry * mp3_to_split, ); rb->lcd_set_drawmode(DRMODE_SOLID); } - rb->lcd_drawline(split_x -2, OSCI_Y, split_x + 2, OSCI_Y); - rb->lcd_drawline(split_x-1, OSCI_Y+1, split_x +1,OSCI_Y+1); + rb->lcd_hline(split_x -2, split_x + 2, OSCI_Y); + rb->lcd_hline(split_x-1, split_x +1,OSCI_Y+1); } /* make visible */ diff --git a/apps/plugins/superdom.c b/apps/plugins/superdom.c index c047ed454a..fff141236e 100644 --- a/apps/plugins/superdom.c +++ b/apps/plugins/superdom.c @@ -355,12 +355,10 @@ void draw_board(void) { } rb->lcd_set_foreground(LCD_BLACK); for(i=0;i<=10;i++) { /* Draw Horizontal lines */ - rb->lcd_drawline(MARGIN, MARGIN+(BOX_HEIGHT*i), MARGIN+(BOX_WIDTH*10), - MARGIN+(BOX_HEIGHT*i)); + rb->lcd_hline(MARGIN, MARGIN+(BOX_WIDTH*10), MARGIN+(BOX_HEIGHT*i)); } for(i=0;i<=10;i++) { /* Draw Vertical lines */ - rb->lcd_drawline(MARGIN+(BOX_WIDTH*i),MARGIN, MARGIN+(BOX_WIDTH*i), - MARGIN+(BOX_HEIGHT*10)); + rb->lcd_vline(MARGIN+(BOX_WIDTH*i), MARGIN, MARGIN+(BOX_HEIGHT*10)); } rb->lcd_update(); } @@ -688,14 +686,12 @@ int get_number(char* param, int* value) { /* Draw a 3x4 grid */ int i,j,x=0,y=0; for(i=0;i<=3;i++) { /* Vertical lines */ - rb->lcd_drawline(NUM_MARGIN_X+(NUM_BOX_WIDTH*i), NUM_MARGIN_Y, - NUM_MARGIN_X+(NUM_BOX_WIDTH*i), - NUM_MARGIN_Y+(4*NUM_BOX_HEIGHT)); + rb->lcd_vline(NUM_MARGIN_X+(NUM_BOX_WIDTH*i), NUM_MARGIN_Y, + NUM_MARGIN_Y+(4*NUM_BOX_HEIGHT)); } for(i=0;i<=4;i++) { /* Horizontal lines */ - rb->lcd_drawline(NUM_MARGIN_X, NUM_MARGIN_Y+(i*NUM_BOX_HEIGHT), - NUM_MARGIN_X+(3*NUM_BOX_WIDTH), - NUM_MARGIN_Y+(NUM_BOX_HEIGHT*i)); + rb->lcd_hline(NUM_MARGIN_X, NUM_MARGIN_X+(3*NUM_BOX_WIDTH), + NUM_MARGIN_Y+(NUM_BOX_HEIGHT*i)); } int temp = 1; for(i=0;i<3;i++) { diff --git a/apps/plugins/vu_meter.c b/apps/plugins/vu_meter.c index f71118268e..5a893d7407 100644 --- a/apps/plugins/vu_meter.c +++ b/apps/plugins/vu_meter.c @@ -561,8 +561,8 @@ void analog_meter(void) { rb->lcd_putsxy(half_width+quarter_width-12, 12, "Right"); /* Line above/below the Left/Right text */ - rb->lcd_drawline(0,9,LCD_WIDTH-1,9); - rb->lcd_drawline(0,21,LCD_WIDTH-1,21); + rb->lcd_hline(0,LCD_WIDTH-1,9); + rb->lcd_hline(0,LCD_WIDTH-1,21); for(i=0; ilcd_drawpixel(i, (y_values[i])-2); @@ -613,18 +613,18 @@ void digital_meter(void) { draw_digital_minimeters(); /* Lines above/below where the LEDS are */ - rb->lcd_drawline(0,12,LCD_WIDTH-1,12); - rb->lcd_drawline(0,half_height-12,LCD_WIDTH-1,half_height-12); + rb->lcd_hline(0,LCD_WIDTH-1,12); + rb->lcd_hline(0,LCD_WIDTH-1,half_height-12); - rb->lcd_drawline(0,half_height+18,LCD_WIDTH-1,half_height+18); - rb->lcd_drawline(0,LCD_HEIGHT-6,LCD_WIDTH-1,LCD_HEIGHT-6); + rb->lcd_hline(0,LCD_WIDTH-1,half_height+18); + rb->lcd_hline(0,LCD_WIDTH-1,LCD_HEIGHT-6); /* Show Left/Right */ rb->lcd_putsxy(2, half_height-8, "Left"); rb->lcd_putsxy(2, half_height+8, "Right"); /* Line in the middle */ - rb->lcd_drawline(0,half_height+3,LCD_WIDTH-1,half_height+3); + rb->lcd_hline(0,LCD_WIDTH-1,half_height+3); } enum plugin_status plugin_start(struct plugin_api* api, void* parameter) { diff --git a/apps/plugins/wavview.c b/apps/plugins/wavview.c index fbf2e4383d..9ce873476f 100644 --- a/apps/plugins/wavview.c +++ b/apps/plugins/wavview.c @@ -289,26 +289,22 @@ int displaypeaks(void) rb->lcd_clear_display(); - rb->lcd_drawline(0, LEFTZERO - (0x8000 / YSCALE), LCD_WIDTH-1, - LEFTZERO - (0x8000 / YSCALE)); - rb->lcd_drawline(0, LEFTZERO, LCD_WIDTH-1, LEFTZERO); - rb->lcd_drawline(0, LEFTZERO + (0x8000 / YSCALE), LCD_WIDTH-1, - LEFTZERO + (0x8000 / YSCALE)); - rb->lcd_drawline(0, RIGHTZERO - (0x8000 / YSCALE), LCD_WIDTH-1, - RIGHTZERO - (0x8000 / YSCALE)); - rb->lcd_drawline(0, RIGHTZERO, LCD_WIDTH-1, RIGHTZERO); - rb->lcd_drawline(0, RIGHTZERO + (0x8000 / YSCALE), LCD_WIDTH-1, - RIGHTZERO + (0x8000 / YSCALE)); + rb->lcd_hline(0, LCD_WIDTH-1, LEFTZERO - (0x8000 / YSCALE)); + rb->lcd_hline(0, LCD_WIDTH-1, LEFTZERO); + rb->lcd_hline(0, LCD_WIDTH-1, LEFTZERO + (0x8000 / YSCALE)); + rb->lcd_hline(0, LCD_WIDTH-1, RIGHTZERO - (0x8000 / YSCALE)); + rb->lcd_hline(0, LCD_WIDTH-1, RIGHTZERO); + rb->lcd_hline(0, LCD_WIDTH-1, RIGHTZERO + (0x8000 / YSCALE)); #if LCD_DEPTH > 1 rb->lcd_set_foreground(LCD_BLACK); #endif /* draw zoombar */ - rb->lcd_drawline(leftmargin / (mempeakcount / LCD_WIDTH), LCD_HEIGHT / 2, - (leftmargin / (mempeakcount / LCD_WIDTH)) + + rb->lcd_hline(leftmargin / (mempeakcount / LCD_WIDTH), + (leftmargin / (mempeakcount / LCD_WIDTH)) + (LCD_WIDTH / zoomlevel), - LCD_HEIGHT / 2); + LCD_HEIGHT / 2); while((x < LCD_WIDTH) && (peakcount < mempeakcount)) { @@ -324,10 +320,10 @@ int displaypeaks(void) if(0 == (peakcount % ppp)) { /* drawing time */ - rb->lcd_drawline(x, LEFTZERO - (lymax / YSCALE), x, - LEFTZERO - (lymin / YSCALE)); - rb->lcd_drawline(x, RIGHTZERO - (rymax / YSCALE), x, - RIGHTZERO - (rymin / YSCALE)); + rb->lcd_vline(x, LEFTZERO - (lymax / YSCALE), + LEFTZERO - (lymin / YSCALE)); + rb->lcd_vline(x, RIGHTZERO - (rymax / YSCALE), + RIGHTZERO - (rymin / YSCALE)); lymin = INT_MAX; lymax = INT_MIN; rymin = INT_MAX;