From 7c931a12ec3747f7822dcd5ff1dd3255344a46f6 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Fri, 9 Jul 2004 11:21:13 +0000 Subject: Simplified the recorder scrolling code a little git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4860 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/lcd-recorder.c | 65 +++++++---------------------------------- 1 file changed, 10 insertions(+), 55 deletions(-) diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c index 598571d63f..8c3f573039 100644 --- a/firmware/drivers/lcd-recorder.c +++ b/firmware/drivers/lcd-recorder.c @@ -75,7 +75,7 @@ #define SCROLL_SPACING 3 -#define SCROLLABLE_LINES 10 +#define SCROLLABLE_LINES 13 struct scrollinfo { char line[MAX_PATH + LCD_WIDTH/2 + SCROLL_SPACING + 2]; @@ -83,7 +83,6 @@ struct scrollinfo { int width; /* length of line in pixels */ int offset; int startx; - int starty; bool backward; /* scroll presently forward or backward? */ bool bidir; bool invert; /* invert the scrolled text */ @@ -337,8 +336,6 @@ void lcd_puts(int x, int y, unsigned char *str) void lcd_puts_style(int x, int y, unsigned char *str, int style) { int xpos,ypos,w,h; - struct scrollinfo* s; - int index; #if defined(SIMULATOR) && defined(HAVE_LCD_CHARCELLS) /* We make the simulator truncate the string if it reaches the right edge, @@ -355,17 +352,7 @@ void lcd_puts_style(int x, int y, unsigned char *str, int style) #endif /* make sure scrolling is turned off on the line we are updating */ - if (scrolling_lines) { - for (index = 0; index < SCROLLABLE_LINES; index++) { - if (scrolling_lines&(1<starty == y) { - scrolling_lines &= ~(1<startx == x && s->starty == y) - { - /* Found the line */ - s->invert = !s->invert; - break; - } - } + s = &scroll[y]; + s->invert = !s->invert; } void lcd_drawline( int x1, int y1, int x2, int y2 ) @@ -816,29 +792,9 @@ void lcd_puts_scroll_style(int x, int y, unsigned char *string, int style) { struct scrollinfo* s; int w, h; - int index; - int free_index=0; - DEBUGF("puts_scroll_style: %s\n", string); - - for (index = 0; index < SCROLLABLE_LINES; index++) { - s = &scroll[index]; - - if (scrolling_lines&(1<starty == y) { - /* we prefer to re-use an existing index with the - same y-position */ - free_index=index; - break; - } - } - else { - /* remember the last unused one */ - free_index=index; - } - } - index=free_index; - s = &scroll[index]; /* get the proper 's' */ + s = &scroll[y]; + s->start_tick = current_tick + scroll_delay; s->invert = false; if (style & STYLE_INVERT) { @@ -881,13 +837,12 @@ void lcd_puts_scroll_style(int x, int y, unsigned char *string, int style) s->len = strlen(string); s->offset = 0; s->startx = x; - s->starty = y; s->backward = false; - scrolling_lines |= (1<startx * s->width / s->len; - ypos = ymargin + s->starty * pf->height; + ypos = ymargin + index * pf->height; if (s->bidir) { /* scroll bidirectional */ if (s->offset <= 0) { -- cgit v1.2.3