diff options
author | Jens Arnold <amiconn@rockbox.org> | 2008-04-12 08:57:28 +0000 |
---|---|---|
committer | Jens Arnold <amiconn@rockbox.org> | 2008-04-12 08:57:28 +0000 |
commit | b6213bbf9889134c17065dc257c3cc08c7478490 (patch) | |
tree | ca4b855be72c91f803bb31f1fd1c4f2f80ad9278 | |
parent | 00ac809cc71e3747c81bf01be95d5cf21d93d9a0 (diff) |
Optimise line drawing calls.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@17082 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/plugins/maze.c | 16 | ||||
-rw-r--r-- | apps/plugins/mazezam.c | 39 | ||||
-rw-r--r-- | apps/plugins/spacerocks.c | 8 |
3 files changed, 28 insertions, 35 deletions
diff --git a/apps/plugins/maze.c b/apps/plugins/maze.c index 8967f59132..c9fe174717 100644 --- a/apps/plugins/maze.c +++ b/apps/plugins/maze.c @@ -202,22 +202,22 @@ void maze_draw(struct maze* maze, struct screen* display) /* draw walls */ if(cell & WALL_N) - display->drawline(x*wx, y*wy, x*wx+wx, y*wy); + display->hline(x*wx, x*wx+wx, y*wy); if(cell & WALL_E) - display->drawline(x*wx+wx, y*wy, x*wx+wx, y*wy+wy); + display->vline(x*wx+wx, y*wy, y*wy+wy); if(cell & WALL_S) - display->drawline(x*wx, y*wy+wy, x*wx+wx, y*wy+wy); + display->hline(x*wx, x*wx+wx, y*wy+wy); if(cell & WALL_W) - display->drawline(x*wx, y*wy, x*wx, y*wy+wy); + display->vline(x*wx, y*wy, y*wy+wy); if(cell & BORDER_N) - display->drawline(x*wx, y*wy, x*wx+wx, y*wy); + display->hline(x*wx, x*wx+wx, y*wy); if(cell & BORDER_E) - display->drawline(x*wx+wx, y*wy, x*wx+wx, y*wy+wy); + display->vline(x*wx+wx, y*wy, y*wy+wy); if(cell & BORDER_S) - display->drawline(x*wx, y*wy+wy, x*wx+wx, y*wy+wy); + display->hline(x*wx, x*wx+wx, y*wy+wy); if(cell & BORDER_W) - display->drawline(x*wx, y*wy, x*wx, y*wy+wy); + display->vline(x*wx, y*wy, y*wy+wy); } } if(maze->solved){ diff --git a/apps/plugins/mazezam.c b/apps/plugins/mazezam.c index 43d6cd7e3d..f898fc6031 100644 --- a/apps/plugins/mazezam.c +++ b/apps/plugins/mazezam.c @@ -397,24 +397,21 @@ static void draw_row( /* draw shade */ rb->lcd_set_foreground(chunk_gray_shade[(i+width) % MAZEZAM_NUM_CHUNK_GRAYS]); - rb->lcd_drawline(xOff+size*shift[i]+size*cd->c_inset[i][j]+1, - yOff+size*i+size-2, - xOff+size*shift[i]+size*cd->c_inset[i][j]+ + rb->lcd_hline(xOff+size*shift[i]+size*cd->c_inset[i][j]+1, + xOff+size*shift[i]+size*cd->c_inset[i][j]+ cd->c_width[i][j]*size-3, - yOff+size*i+size-2); - rb->lcd_drawline(xOff+size*shift[i]+size*cd->c_inset[i][j]+ + yOff+size*i+size-2); + rb->lcd_vline(xOff+size*shift[i]+size*cd->c_inset[i][j]+ cd->c_width[i][j]*size-2, - yOff+size*i, - xOff+size*shift[i]+size*cd->c_inset[i][j]+ - cd->c_width[i][j]*size-2, - yOff+size*i+size-2); + yOff+size*i, + yOff+size*i+size-2); /* draw fill */ rb->lcd_set_foreground(chunk_gray[(i+width) % MAZEZAM_NUM_CHUNK_GRAYS]); for (k = yOff+size*i+2; k < yOff+size*i+size-2; k += 2) - rb->lcd_drawline(xOff+size*shift[i]+size*cd->c_inset[i][j]+2,k, - xOff+size*shift[i]+size*cd->c_inset[i][j]+ + rb->lcd_hline(xOff+size*shift[i]+size*cd->c_inset[i][j]+2, + xOff+size*shift[i]+size*cd->c_inset[i][j]+ cd->c_width[i][j]*size-3,k); #else rb->lcd_drawrect(xOff+size*shift[i]+size*cd->c_inset[i][j], @@ -450,10 +447,8 @@ static void draw_player( #elif LCD_DEPTH > 1 rb->lcd_set_foreground(MAZEZAM_PLAYER_GRAY); #endif - rb->lcd_drawline(xOff+size*x, yOff+size*y+middle, - xOff+size*x+max, yOff+size*y+middle); - rb->lcd_drawline(xOff+size*x+middle, yOff+size*y, - xOff+size*x+middle, yOff+size*y+max-ldelta); + rb->lcd_hline(xOff+size*x, xOff+size*x+max, yOff+size*y+middle); + rb->lcd_vline(xOff+size*x+middle, yOff+size*y, yOff+size*y+max-ldelta); rb->lcd_drawline(xOff+size*x+middle, yOff+size*y+max-ldelta, xOff+size*x+middle-ldelta, yOff+size*y+max); rb->lcd_drawline(xOff+size*x+middle, yOff+size*y+max-ldelta, @@ -476,14 +471,12 @@ static void draw_gate( #elif LCD_DEPTH > 1 rb->lcd_set_foreground(MAZEZAM_GATE_GRAY); #endif - rb->lcd_drawline(xOff-size,yOff+entrance*size+third, - xOff-1,yOff+entrance*size+third); - rb->lcd_drawline(xOff-size,yOff+entrance*size+twothirds, - xOff-1,yOff+entrance*size+twothirds); - rb->lcd_drawline(xOff-size+third,yOff+entrance*size, - xOff-size+third,yOff+entrance*size+size-1); - rb->lcd_drawline(xOff-size+twothirds,yOff+entrance*size, - xOff-size+twothirds,yOff+entrance*size+size-1); + rb->lcd_hline(xOff-size,xOff-1,yOff+entrance*size+third); + rb->lcd_hline(xOff-size,xOff-1,yOff+entrance*size+twothirds); + rb->lcd_vline(xOff-size+third,yOff+entrance*size, + yOff+entrance*size+size-1); + rb->lcd_vline(xOff-size+twothirds,yOff+entrance*size, + yOff+entrance*size+size-1); } /***************************************************************************** diff --git a/apps/plugins/spacerocks.c b/apps/plugins/spacerocks.c index 5c01c1680f..b47aba329a 100644 --- a/apps/plugins/spacerocks.c +++ b/apps/plugins/spacerocks.c @@ -760,10 +760,10 @@ bool is_point_within_rectangle(struct Point* rect, struct Point* p, int size) int aTLy = rect->y - size; int aBRx = rect->x + size; int aBRy = rect->y + size; - rb->lcd_drawline( aTLx/SCALE, aTLy/SCALE, aBRx/SCALE, aTLy/SCALE); - rb->lcd_drawline( aTLx/SCALE, aTLy/SCALE, aTLx/SCALE, aBRy/SCALE); - rb->lcd_drawline( aTLx/SCALE, aBRy/SCALE, aBRx/SCALE, aBRy/SCALE); - rb->lcd_drawline( aBRx/SCALE, aBRy/SCALE, aBRx/SCALE, aTLy/SCALE); + rb->lcd_hline( aTLx/SCALE, aBRx/SCALE, aTLy/SCALE); + rb->lcd_vline( aTLx/SCALE, aTLy/SCALE, aBRy/SCALE); + rb->lcd_hline( aTLx/SCALE, aBRx/SCALE, aBRy/SCALE); + rb->lcd_vline( aBRx/SCALE, aBRy/SCALE, aTLy/SCALE); return (p->x > aTLx && p->x < aBRx && p->y > aTLy && p->y < aBRy); #else return (p->x > rect->x - size && p->x < rect->x + size && |