diff options
author | Daniel Stenberg <daniel@haxx.se> | 2004-01-13 14:59:51 +0000 |
---|---|---|
committer | Daniel Stenberg <daniel@haxx.se> | 2004-01-13 14:59:51 +0000 |
commit | 50b6358272eaf1f255bcb430766e6fc9e26810d3 (patch) | |
tree | 1a4485f88a963db44217223363713cd087c1c681 | |
parent | 1936c413a8242027a5430d844ddf308e451e8a2c (diff) | |
download | rockbox-50b6358272eaf1f255bcb430766e6fc9e26810d3.tar.gz rockbox-50b6358272eaf1f255bcb430766e6fc9e26810d3.zip |
Craig Sather's patch #849405:
This patch fixes two bugs associated with lcd_puts and scrolling on the
recorder.
1 - Unlike the implementation in the player code, on the recorder a call to
lcd_puts does not stop the scrolling text from a previous lcd_puts_scroll
call, so the new line gets overwritten by the old scrolling text. More
discussion and details can be found at:
http://rockbox.haxx.se/mail/archive/rockbox-archive-2003-11/0531.shtml
2 - When the function lcd_puts_scroll_style is called with an x offset greater
than 0, the scrolling text is placed at an offset of 2x instead of x.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@4226 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | firmware/drivers/lcd-recorder.c | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/firmware/drivers/lcd-recorder.c b/firmware/drivers/lcd-recorder.c index 08c58e0bf9..f7eb529fea 100644 --- a/firmware/drivers/lcd-recorder.c +++ b/firmware/drivers/lcd-recorder.c @@ -337,6 +337,8 @@ 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, @@ -352,6 +354,19 @@ void lcd_puts_style(int x, int y, unsigned char *str, int style) ymargin = 8; #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<<index)) { + s = &scroll[index]; + if (s->starty == y) { + scrolling_lines &= ~(1<<index); + break; + } + } + } + } + if(!str || !str[0]) return; @@ -878,9 +893,9 @@ void lcd_bidir_scroll(int percent) } static void scroll_thread(void) { + struct font* pf; struct scrollinfo* s; int index; - int w, h; int xpos, ypos; /* initialize scroll struct array */ @@ -903,6 +918,10 @@ static void scroll_thread(void) else s->offset += scroll_step; + pf = font_get(curfont); + xpos = xmargin + s->startx * s->width / s->len; + ypos = ymargin + s->starty * pf->height; + if (s->bidir) { /* scroll bidirectional */ if (s->offset <= 0) { /* at beginning of line */ @@ -910,9 +929,9 @@ static void scroll_thread(void) s->backward = false; s->start_tick = current_tick + scroll_delay * 2; } - if (s->offset >= s->width - (LCD_WIDTH - xmargin)) { + if (s->offset >= s->width - (LCD_WIDTH - xpos)) { /* at end of line */ - s->offset = s->width - (LCD_WIDTH - xmargin); + s->offset = s->width - (LCD_WIDTH - xpos); s->backward = true; s->start_tick = current_tick + scroll_delay * 2; } @@ -923,15 +942,11 @@ static void scroll_thread(void) s->offset %= s->width; } - lcd_getstringsize(s->line, &w, &h); - xpos = xmargin + s->startx * w / s->len; - ypos = ymargin + s->starty * h; - - lcd_clearrect(xpos, ypos, LCD_WIDTH - xmargin, h); + lcd_clearrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); lcd_putsxyofs(xpos, ypos, s->offset, s->line); if (s->invert) - lcd_invertrect(xpos, ypos, LCD_WIDTH - xmargin, h); - lcd_update_rect(xpos, ypos, LCD_WIDTH - xmargin, h); + lcd_invertrect(xpos, ypos, LCD_WIDTH - xpos, pf->height); + lcd_update_rect(xpos, ypos, LCD_WIDTH - xpos, pf->height); } sleep(HZ/scroll_speed); |