From 50eb528bc1f9d2f7b7260eff8b85a5ed5b96e679 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Thu, 31 Jan 2013 07:24:19 +0100 Subject: 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 --- firmware/export/scroll_engine.h | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'firmware/export/scroll_engine.h') 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); extern void lcd_scroll_stop(void); extern void lcd_scroll_stop_viewport(const struct viewport *vp); -extern void lcd_scroll_stop_viewport_line(const struct viewport *vp, int line); -extern void lcd_scroll_fn(void); +extern void lcd_scroll_stop_viewport_rect(const struct viewport *vp, int x, int y, int width, int height); #ifdef HAVE_REMOTE_LCD extern void lcd_remote_scroll_speed(int speed); extern void lcd_remote_scroll_delay(int ms); extern void lcd_remote_scroll_stop(void); extern void lcd_remote_scroll_stop_viewport(const struct viewport *vp); -extern void lcd_remote_scroll_stop_viewport_line(const struct viewport *vp, int line); -extern void lcd_remote_scroll_fn(void); +extern void lcd_remote_scroll_stop_viewport_rect(const struct viewport *vp, int x, int y, int width, int height); #endif -/* internal usage, but in multiple drivers */ +/* internal usage, but in multiple drivers + * larger than the normal linebuffer since it holds the line a second + * time (+3 spaces) for non-bidir scrolling */ #define SCROLL_SPACING 3 #ifdef HAVE_LCD_BITMAP #define SCROLL_LINE_SIZE (MAX_PATH + SCROLL_SPACING + 3*LCD_WIDTH/2 + 2) @@ -60,21 +60,27 @@ extern void lcd_remote_scroll_fn(void); struct scrollinfo { struct viewport* vp; - char line[SCROLL_LINE_SIZE]; + char linebuffer[9*MAX_PATH/10]; + const char *line; #ifdef HAVE_LCD_CHARCELLS int len; /* length of line in chars */ #endif - int y; /* Position of the line on the screen (char co-ordinates) */ + /* rectangle for the line */ + int x, y; /* relative to the viewort */ + int width, height; + /* pixel to skip from the beginning of the string, increments as the text scrolls */ 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 */ -#endif/* HAVE_LCD_BITMAP */ - bool backward; /* scroll presently forward or backward? */ +#endif /* HAVE_LCD_BITMAP */ + /* scroll presently forward or backward? */ + bool backward; bool bidir; long start_tick; + + /* support for custom scrolling functions */ + void (*scroll_func)(struct scrollinfo *s); + void *userdata; }; struct scroll_screen_info -- cgit v1.2.3