From 2924a48ca55e0207d939998307d82e4b7f4502f8 Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Sun, 5 Feb 2006 18:25:41 +0000 Subject: Create config file for iPod 4G greyscale and various iPod 3G/4G greyscale fixes git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8585 a1c6a512-1295-4272-9138-f99709370657 --- firmware/drivers/lcd-2bit-horz.c | 53 ++++++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 16 deletions(-) (limited to 'firmware/drivers/lcd-2bit-horz.c') diff --git a/firmware/drivers/lcd-2bit-horz.c b/firmware/drivers/lcd-2bit-horz.c index 01f5d93cf3..de1af90213 100644 --- a/firmware/drivers/lcd-2bit-horz.c +++ b/firmware/drivers/lcd-2bit-horz.c @@ -610,7 +610,26 @@ 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; @@ -624,23 +643,14 @@ void lcd_puts_style(int x, int y, const unsigned char *str, int style) lcd_getstringsize(str, &w, &h); xpos = xmargin + x*w / utf8length((char *)str); ypos = ymargin + y*h; - lcd_putsxy(xpos, ypos, str); - drawmode = (DRMODE_SOLID|DRMODE_INVERSEVID); + drawmode = (style & STYLE_INVERT) ? + (DRMODE_SOLID|DRMODE_INVERSEVID) : DRMODE_SOLID; + lcd_putsxyofs(xpos, ypos, offset, str); + drawmode ^= DRMODE_INVERSEVID; lcd_fillrect(xpos + w, ypos, LCD_WIDTH - (xpos + w), h); - if (style & STYLE_INVERT) - { - drawmode = DRMODE_COMPLEMENT; - lcd_fillrect(xpos, ypos, LCD_WIDTH - xpos, h); - } 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 @@ -686,6 +696,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; @@ -696,10 +717,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); @@ -732,7 +753,7 @@ void lcd_puts_scroll_style(int x, int y, const unsigned char *string, int style) strncpy(end, (char *)string, LCD_WIDTH/2); s->len = utf8length((char *)string); - s->offset = 0; + s->offset = offset; s->startx = x; s->backward = false; scrolling_lines |= (1<