summaryrefslogtreecommitdiff
path: root/firmware/export/scroll_engine.h
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2013-01-31 07:24:19 +0100
committerThomas Martitz <kugel@rockbox.org>2013-12-14 23:11:31 +0100
commit50eb528bc1f9d2f7b7260eff8b85a5ed5b96e679 (patch)
tree47b53d62c0880a3ea6b9e761efdf0628855d13e0 /firmware/export/scroll_engine.h
parent26801b3bd8f11fe680146086aa0a2fd12e7de289 (diff)
downloadrockbox-50eb528bc1f9d2f7b7260eff8b85a5ed5b96e679.tar.gz
rockbox-50eb528bc1f9d2f7b7260eff8b85a5ed5b96e679.zip
scroll_engine: Major rework to support pixel-based scrolling and scroll callbacks.
Much of the scrolling work is moved from lcd-bitmap-common to lcd-scroll.c, a small scroll callback routine remains. This callback can potentially be overridden by more extensive scrollers. The callback also gets fed with pixel-based scrolling information, which finally removes the strict line-based nature of the scroll engine. Along with this is the change from scroll_stop_viewport_line() to scroll_stop_viewport_rect() which works on a pixel-based rectangle instead of lines. The ultimate goal is to move most of the scroll work to apps, which can much better decide which line decorations to apply etc. This work is laying the ground work. Change-Id: I3b2885cf7d8696ddd9253d5a9a73318d3d42831a
Diffstat (limited to 'firmware/export/scroll_engine.h')
-rw-r--r--firmware/export/scroll_engine.h30
1 files changed, 18 insertions, 12 deletions
diff --git a/firmware/export/scroll_engine.h b/firmware/export/scroll_engine.h
index 01a9a5e33d..c7eb97aecc 100644
--- a/firmware/export/scroll_engine.h
+++ b/firmware/export/scroll_engine.h
@@ -37,19 +37,19 @@ extern void lcd_scroll_delay(int ms);
37 37
38extern void lcd_scroll_stop(void); 38extern void lcd_scroll_stop(void);
39extern void lcd_scroll_stop_viewport(const struct viewport *vp); 39extern void lcd_scroll_stop_viewport(const struct viewport *vp);
40extern void lcd_scroll_stop_viewport_line(const struct viewport *vp, int line); 40extern void lcd_scroll_stop_viewport_rect(const struct viewport *vp, int x, int y, int width, int height);
41extern void lcd_scroll_fn(void);
42#ifdef HAVE_REMOTE_LCD 41#ifdef HAVE_REMOTE_LCD
43extern void lcd_remote_scroll_speed(int speed); 42extern void lcd_remote_scroll_speed(int speed);
44extern void lcd_remote_scroll_delay(int ms); 43extern void lcd_remote_scroll_delay(int ms);
45 44
46extern void lcd_remote_scroll_stop(void); 45extern void lcd_remote_scroll_stop(void);
47extern void lcd_remote_scroll_stop_viewport(const struct viewport *vp); 46extern void lcd_remote_scroll_stop_viewport(const struct viewport *vp);
48extern void lcd_remote_scroll_stop_viewport_line(const struct viewport *vp, int line); 47extern void lcd_remote_scroll_stop_viewport_rect(const struct viewport *vp, int x, int y, int width, int height);
49extern void lcd_remote_scroll_fn(void);
50#endif 48#endif
51 49
52/* internal usage, but in multiple drivers */ 50/* internal usage, but in multiple drivers
51 * larger than the normal linebuffer since it holds the line a second
52 * time (+3 spaces) for non-bidir scrolling */
53#define SCROLL_SPACING 3 53#define SCROLL_SPACING 3
54#ifdef HAVE_LCD_BITMAP 54#ifdef HAVE_LCD_BITMAP
55#define SCROLL_LINE_SIZE (MAX_PATH + SCROLL_SPACING + 3*LCD_WIDTH/2 + 2) 55#define SCROLL_LINE_SIZE (MAX_PATH + SCROLL_SPACING + 3*LCD_WIDTH/2 + 2)
@@ -60,21 +60,27 @@ extern void lcd_remote_scroll_fn(void);
60struct scrollinfo 60struct scrollinfo
61{ 61{
62 struct viewport* vp; 62 struct viewport* vp;
63 char line[SCROLL_LINE_SIZE]; 63 char linebuffer[9*MAX_PATH/10];
64 const char *line;
64#ifdef HAVE_LCD_CHARCELLS 65#ifdef HAVE_LCD_CHARCELLS
65 int len; /* length of line in chars */ 66 int len; /* length of line in chars */
66#endif 67#endif
67 int y; /* Position of the line on the screen (char co-ordinates) */ 68 /* rectangle for the line */
69 int x, y; /* relative to the viewort */
70 int width, height;
71 /* pixel to skip from the beginning of the string, increments as the text scrolls */
68 int offset; 72 int offset;
69 int startx;
70 int y_offset; /* y offset of the line, used for pixel-accurate list scrolling */
71#ifdef HAVE_LCD_BITMAP 73#ifdef HAVE_LCD_BITMAP
72 int width; /* length of line in pixels */
73 int style; /* line style */ 74 int style; /* line style */
74#endif/* HAVE_LCD_BITMAP */ 75#endif /* HAVE_LCD_BITMAP */
75 bool backward; /* scroll presently forward or backward? */ 76 /* scroll presently forward or backward? */
77 bool backward;
76 bool bidir; 78 bool bidir;
77 long start_tick; 79 long start_tick;
80
81 /* support for custom scrolling functions */
82 void (*scroll_func)(struct scrollinfo *s);
83 void *userdata;
78}; 84};
79 85
80struct scroll_screen_info 86struct scroll_screen_info