1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Thomas Martitz 2013-01-31 07:24:19 +01:00
parent 26801b3bd8
commit 50eb528bc1
7 changed files with 202 additions and 155 deletions

View file

@ -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