summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-10-06 12:46:42 +0000
committerThomas Martitz <kugel@rockbox.org>2010-10-06 12:46:42 +0000
commitd9d0b4dd20c440b111930bccd87d29999299c1b1 (patch)
tree3c165d0a5276155add762c6779137aa10f7f7ab5 /firmware
parent53a936ab833ea3cfd460d4713f45a8ab98e6620a (diff)
downloadrockbox-d9d0b4dd20c440b111930bccd87d29999299c1b1.tar.gz
rockbox-d9d0b4dd20c440b111930bccd87d29999299c1b1.tar.bz2
rockbox-d9d0b4dd20c440b111930bccd87d29999299c1b1.zip
Pixel-accurate (vertical) list scrolling for touchscreen targets.
Looks much smoother now as you don't scroll by whole lines anymore. Add some functions lcd driver to enable the line based scrolling engine to draw the lines with a pixel-based y-offset. This should also allow for a sensible kinetic scrolling mechanism (still a todo). git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28214 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/drivers/lcd-bitmap-common.c31
-rw-r--r--firmware/export/lcd.h10
-rw-r--r--firmware/export/scroll_engine.h1
3 files changed, 31 insertions, 11 deletions
diff --git a/firmware/drivers/lcd-bitmap-common.c b/firmware/drivers/lcd-bitmap-common.c
index 9f1d5fef68..2ce11e3398 100644
--- a/firmware/drivers/lcd-bitmap-common.c
+++ b/firmware/drivers/lcd-bitmap-common.c
@@ -284,8 +284,8 @@ static void LCDFN(putsxyofs_style)(int xpos, int ypos,
/*** Line oriented text output ***/
/* put a string at a given char position */
-void LCDFN(puts_style_offset)(int x, int y, const unsigned char *str,
- int style, int offset)
+void LCDFN(puts_style_xyoffset)(int x, int y, const unsigned char *str,
+ int style, int x_offset, int y_offset)
{
int xpos, ypos, w, h;
LCDFN(scroll_stop_line)(current_vp, y);
@@ -294,8 +294,14 @@ void LCDFN(puts_style_offset)(int x, int y, const unsigned char *str,
LCDFN(getstringsize)(str, &w, &h);
xpos = x * LCDFN(getstringsize)(" ", NULL, NULL);
- ypos = y * h;
- LCDFN(putsxyofs_style)(xpos, ypos, str, style, w, h, offset);
+ ypos = y * h + y_offset;
+ LCDFN(putsxyofs_style)(xpos, ypos, str, style, w, h, x_offset);
+}
+
+void LCDFN(puts_style_offset)(int x, int y, const unsigned char *str,
+ int style, int x_offset)
+{
+ LCDFN(puts_style_xyoffset)(x, y, str, style, x_offset, 0);
}
void LCDFN(puts)(int x, int y, const unsigned char *str)
@@ -326,8 +332,8 @@ void LCDFN(puts_offset)(int x, int y, const unsigned char *str, int offset)
/*** scrolling ***/
-void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string,
- int style, int offset)
+void LCDFN(puts_scroll_style_xyoffset)(int x, int y, const unsigned char *string,
+ int style, int x_offset, int y_offset)
{
struct scrollinfo* s;
char *end;
@@ -343,7 +349,7 @@ void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string,
if (LCDFN(scroll_info).lines >= LCDM(SCROLLABLE_LINES)) return;
if (!string)
return;
- LCDFN(puts_style_offset)(x, y, string, style, offset);
+ LCDFN(puts_style_xyoffset)(x, y, string, style, x_offset, y_offset);
LCDFN(getstringsize)(string, &w, &h);
@@ -381,8 +387,9 @@ void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string,
s->vp = current_vp;
s->y = y;
- s->offset = offset;
+ s->offset = x_offset;
s->startx = x * LCDFN(getstringsize)(" ", NULL, NULL);
+ s->y_offset = y_offset;
s->backward = false;
LCDFN(scroll_info).lines++;
@@ -429,7 +436,7 @@ void LCDFN(scroll_fn)(void)
pf = font_get(current_vp->font);
xpos = s->startx;
- ypos = s->y * pf->height;
+ ypos = s->y * pf->height + s->y_offset;
if (s->bidir) { /* scroll bidirectional */
if (s->offset <= 0) {
@@ -457,3 +464,9 @@ void LCDFN(scroll_fn)(void)
}
LCDFN(set_viewport)(old_vp);
}
+
+void LCDFN(puts_scroll_style_offset)(int x, int y, const unsigned char *string,
+ int style, int x_offset)
+{
+ LCDFN(puts_scroll_style_xyoffset)(x, y, string, style, x_offset, 0);
+}
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 1cbb286ad1..54a2f3c511 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -192,6 +192,8 @@ extern void lcd_clear_viewport(void);
extern void lcd_clear_display(void);
extern void lcd_putsxy(int x, int y, const unsigned char *string);
extern void lcd_putsxyf(int x, int y, const unsigned char *fmt, ...);
+extern void lcd_putsxy_style_offset(int x, int y, const unsigned char *str,
+ int style, int offset);
extern void lcd_puts(int x, int y, const unsigned char *string);
extern void lcd_putsf(int x, int y, const unsigned char *fmt, ...);
extern void lcd_puts_style(int x, int y, const unsigned char *string, int style);
@@ -480,9 +482,13 @@ extern void lcd_setfont(int font);
extern int lcd_getfont(void);
extern void lcd_puts_style_offset(int x, int y, const unsigned char *str,
- int style, int offset);
+ int style, int x_offset);
+extern void lcd_puts_style_xyoffset(int x, int y, const unsigned char *str,
+ int style, int x_offset, int y_offset);
extern void lcd_puts_scroll_style_offset(int x, int y, const unsigned char *string,
- int style, int offset);
+ int style, int x_offset);
+extern void lcd_puts_scroll_style_xyoffset(int x, int y, const unsigned char *string,
+ int style, int x_offset, int y_offset);
/* low level drawing function pointer arrays */
#if LCD_DEPTH >= 8
diff --git a/firmware/export/scroll_engine.h b/firmware/export/scroll_engine.h
index ca94828787..0fe6fe464a 100644
--- a/firmware/export/scroll_engine.h
+++ b/firmware/export/scroll_engine.h
@@ -56,6 +56,7 @@ struct scrollinfo
int y; /* Position of the line on the screen (char co-ordinates) */
int offset;
int startx;
+ int y_offset; /* y offset of the line, used for pixel-accurate list scrolling */
#ifdef HAVE_LCD_BITMAP
int width; /* length of line in pixels */
int style; /* line style */