summaryrefslogtreecommitdiff
path: root/firmware/export
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2014-01-12 01:30:26 +0100
committerThomas Martitz <kugel@rockbox.org>2014-01-12 01:34:06 +0100
commit488a1b983e1c2fac14de25aa781caf12628e53c8 (patch)
tree8d5b5b33e0c7eb9e5222b843f84c6b2d65d1a352 /firmware/export
parent656261bde1122612d1bf8ffc3c992c75a7fbc52e (diff)
downloadrockbox-488a1b983e1c2fac14de25aa781caf12628e53c8.tar.gz
rockbox-488a1b983e1c2fac14de25aa781caf12628e53c8.zip
put_line/scrolling: Make the scroll engine inform custom scrollers about start/stop of scrolling.
With the new lcd_putsxy_scroll_func() code can register custom scroll functions (put_line() makes use of that). In order for the custom scroller to be able to properly manage its userdata pointer (set via struct scrollinfo::userdata) the scroll engine must inform the scroller about start and stop of scrolling. To inform about start the lcd_scroll_* functions now return true when the line will scroll. To inform about stop the scroll engine calls into the scroller one last time, with the text set to NULL. put_line() can use this to release the userdata registered per scrolling line so that it can be recycled. This fixes that some scrolling lines became glitchy after some time because the userdata was recycled too early. Change-Id: Iff0a6ce2a4f9ae2bada1b8e62f4f5950224942a9
Diffstat (limited to 'firmware/export')
-rw-r--r--firmware/export/lcd-remote.h4
-rw-r--r--firmware/export/lcd.h4
-rw-r--r--firmware/export/scroll_engine.h5
3 files changed, 8 insertions, 5 deletions
diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h
index bc26a23cb7..1819a4de72 100644
--- a/firmware/export/lcd-remote.h
+++ b/firmware/export/lcd-remote.h
@@ -176,8 +176,8 @@ extern void lcd_remote_clear_viewport(void);
176extern void lcd_remote_puts(int x, int y, const unsigned char *str); 176extern void lcd_remote_puts(int x, int y, const unsigned char *str);
177extern void lcd_remote_putsf(int x, int y, const unsigned char *fmt, ...); 177extern void lcd_remote_putsf(int x, int y, const unsigned char *fmt, ...);
178extern void lcd_remote_putc(int x, int y, unsigned short ch); 178extern void lcd_remote_putc(int x, int y, unsigned short ch);
179extern void lcd_remote_puts_scroll(int x, int y, const unsigned char *str); 179extern bool lcd_remote_puts_scroll(int x, int y, const unsigned char *str);
180extern void lcd_remote_putsxy_scroll_func(int x, int y, const unsigned char *string, 180extern bool lcd_remote_putsxy_scroll_func(int x, int y, const unsigned char *string,
181 void (*scroll_func)(struct scrollinfo *), 181 void (*scroll_func)(struct scrollinfo *),
182 void *data, int x_offset); 182 void *data, int x_offset);
183 183
diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h
index 87476d9dda..386ac5a8bf 100644
--- a/firmware/export/lcd.h
+++ b/firmware/export/lcd.h
@@ -179,8 +179,8 @@ extern void lcd_putsxy_style_offset(int x, int y, const unsigned char *str,
179extern void lcd_puts(int x, int y, const unsigned char *string); 179extern void lcd_puts(int x, int y, const unsigned char *string);
180extern void lcd_putsf(int x, int y, const unsigned char *fmt, ...); 180extern void lcd_putsf(int x, int y, const unsigned char *fmt, ...);
181extern void lcd_putc(int x, int y, unsigned long ucs); 181extern void lcd_putc(int x, int y, unsigned long ucs);
182extern void lcd_puts_scroll(int x, int y, const unsigned char* string); 182extern bool lcd_puts_scroll(int x, int y, const unsigned char* string);
183extern void lcd_putsxy_scroll_func(int x, int y, const unsigned char *string, 183extern bool lcd_putsxy_scroll_func(int x, int y, const unsigned char *string,
184 void (*scroll_func)(struct scrollinfo *), 184 void (*scroll_func)(struct scrollinfo *),
185 void *data, int x_offset); 185 void *data, int x_offset);
186 186
diff --git a/firmware/export/scroll_engine.h b/firmware/export/scroll_engine.h
index 64e1d6d6ae..ce230a218c 100644
--- a/firmware/export/scroll_engine.h
+++ b/firmware/export/scroll_engine.h
@@ -79,7 +79,10 @@ struct scrollinfo
79 bool bidir; 79 bool bidir;
80 long start_tick; 80 long start_tick;
81 81
82 /* support for custom scrolling functions */ 82 /* support for custom scrolling functions,
83 * must be called with ::line == NULL to indicate that the line
84 * stops scrolling or when the userdata pointer is going to be changed
85 * (the custom scroller can release the userdata then) */
83 void (*scroll_func)(struct scrollinfo *s); 86 void (*scroll_func)(struct scrollinfo *s);
84 void *userdata; 87 void *userdata;
85}; 88};