From 50b6358272eaf1f255bcb430766e6fc9e26810d3 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Tue, 13 Jan 2004 14:59:51 +0000 Subject: 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 --- firmware/drivers/lcd-recorder.c | 35 +++++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 10 deletions(-) (limited to 'firmware/drivers/lcd-recorder.c') 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<starty == y) { + scrolling_lines &= ~(1<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); -- cgit v1.2.3