From bfe740712a3513dbb4143336cbc5e9aaab09d732 Mon Sep 17 00:00:00 2001 From: Tomas Salfischberger Date: Sun, 22 Jan 2006 02:14:37 +0000 Subject: Horizontal scrolling patch by Shachar Liberman - Part 2 :) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8413 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/lcd-16bit.c | 43 +++++++++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 10 deletions(-) (limited to 'firmware/drivers') diff --git a/firmware/drivers/lcd-16bit.c b/firmware/drivers/lcd-16bit.c index 6337fa1ea7..b13e4cee90 100644 --- a/firmware/drivers/lcd-16bit.c +++ b/firmware/drivers/lcd-16bit.c @@ -585,7 +585,25 @@ void lcd_putsxy(int x, int y, const unsigned char *str) /*** line oriented text output ***/ +/* put a string at a given char position */ +void lcd_puts(int x, int y, const unsigned char *str) +{ + lcd_puts_style_offset(x, y, str, STYLE_DEFAULT, 0); +} + void lcd_puts_style(int x, int y, const unsigned char *str, int style) +{ + lcd_puts_style_offset(x, y, str, style, 0); +} + +void lcd_puts_offset(int x, int y, const unsigned char *str, int offset) +{ + lcd_puts_style_offset(x, y, str, STYLE_DEFAULT, offset); +} + +/* put a string at a given char position, style, and pixel position, + * skipping first offset pixel columns */ +void lcd_puts_style_offset(int x, int y, const unsigned char *str, int style, int offset) { int xpos,ypos,w,h; int lastmode = drawmode; @@ -599,7 +617,7 @@ void lcd_puts_style(int x, int y, const unsigned char *str, int style) lcd_getstringsize(str, &w, &h); xpos = xmargin + x*w / utf8length(str); ypos = ymargin + y*h; - lcd_putsxy(xpos, ypos, str); + lcd_putsxyofs(xpos, ypos, offset, str); drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); (void)style; lcd_fillrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); @@ -611,12 +629,6 @@ void lcd_puts_style(int x, int y, const unsigned char *str, int style) drawmode = lastmode; } -/* put a string at a given char position */ -void lcd_puts(int x, int y, const unsigned char *str) -{ - lcd_puts_style(x, y, str, STYLE_DEFAULT); -} - /*** scrolling ***/ /* Reverse the invert setting of the scrolling line (if any) at given char @@ -662,6 +674,17 @@ void lcd_puts_scroll(int x, int y, const unsigned char *string) } void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) +{ + lcd_puts_scroll_style_offset(x, y, string, style, 0); +} + +void lcd_puts_scroll_offset(int x, int y, const unsigned char *string, int offset) +{ + lcd_puts_scroll_style_offset(x, y, string, STYLE_DEFAULT, offset); +} + +void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string, + int style, int offset) { struct scrollinfo* s; int w, h; @@ -672,10 +695,10 @@ void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) s->invert = false; if (style & STYLE_INVERT) { s->invert = true; - lcd_puts_style(x,y,string,STYLE_INVERT); + lcd_puts_style_offset(x,y,string,STYLE_INVERT,offset); } else - lcd_puts(x,y,string); + lcd_puts_offset(x,y,string,offset); lcd_getstringsize(string, &w, &h); @@ -708,7 +731,7 @@ void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) strncpy(end, string, LCD_WIDTH/2); s->len = utf8length(string); - s->offset = 0; + s->offset = offset; s->startx = x; s->backward = false; scrolling_lines |= (1<