mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-13 18:17:39 -04:00
lcd-common/scroll_engine: Introduce lcd_putsxy_scroll_func().
This function supports installing a custom scroll callback. This will be called when the scrollengine redraws the line. It allows to draw extended styles (or anything your can possible imagine) along with the text. It is also strictly pixel-based, the first pixel-based function that supports scrolling. Change-Id: I57f81ac7b3d08b877aea4cb8afa882f175ebcdfc
This commit is contained in:
parent
b8505222c0
commit
6630958533
6 changed files with 36 additions and 1 deletions
|
@ -25,7 +25,7 @@
|
||||||
#ifdef HAVE_REMOTE_LCD
|
#ifdef HAVE_REMOTE_LCD
|
||||||
#include <lcd-remote.h>
|
#include <lcd-remote.h>
|
||||||
#endif
|
#endif
|
||||||
#include <scroll_engine.h>
|
#include "scroll_engine.h"
|
||||||
#include <font.h>
|
#include <font.h>
|
||||||
#include <button.h>
|
#include <button.h>
|
||||||
#include <settings.h>
|
#include <settings.h>
|
||||||
|
@ -243,6 +243,7 @@ struct screen screens[NB_SCREENS] =
|
||||||
.puts_offset=&lcd_puts_offset,
|
.puts_offset=&lcd_puts_offset,
|
||||||
.puts_scroll=&lcd_puts_scroll,
|
.puts_scroll=&lcd_puts_scroll,
|
||||||
.puts_scroll_offset=&lcd_puts_scroll_offset,
|
.puts_scroll_offset=&lcd_puts_scroll_offset,
|
||||||
|
.putsxy_scroll_func=&lcd_putsxy_scroll_func,
|
||||||
.scroll_speed=&lcd_scroll_speed,
|
.scroll_speed=&lcd_scroll_speed,
|
||||||
.scroll_delay=&lcd_scroll_delay,
|
.scroll_delay=&lcd_scroll_delay,
|
||||||
.clear_display=&lcd_clear_display,
|
.clear_display=&lcd_clear_display,
|
||||||
|
@ -344,6 +345,7 @@ struct screen screens[NB_SCREENS] =
|
||||||
.puts_offset=&lcd_remote_puts_offset,
|
.puts_offset=&lcd_remote_puts_offset,
|
||||||
.puts_scroll=&lcd_remote_puts_scroll,
|
.puts_scroll=&lcd_remote_puts_scroll,
|
||||||
.puts_scroll_offset=&lcd_remote_puts_scroll_offset,
|
.puts_scroll_offset=&lcd_remote_puts_scroll_offset,
|
||||||
|
.putsxy_scroll_func=&lcd_remote_putsxy_scroll_func,
|
||||||
.scroll_speed=&lcd_remote_scroll_speed,
|
.scroll_speed=&lcd_remote_scroll_speed,
|
||||||
.scroll_delay=&lcd_remote_scroll_delay,
|
.scroll_delay=&lcd_remote_scroll_delay,
|
||||||
.clear_display=&lcd_remote_clear_display,
|
.clear_display=&lcd_remote_clear_display,
|
||||||
|
|
|
@ -24,6 +24,7 @@
|
||||||
|
|
||||||
#include "lcd.h"
|
#include "lcd.h"
|
||||||
#include "buttonbar.h"
|
#include "buttonbar.h"
|
||||||
|
#include "scroll_engine.h"
|
||||||
#include "backdrop.h"
|
#include "backdrop.h"
|
||||||
|
|
||||||
#if defined(HAVE_REMOTE_LCD) && !defined (ROCKBOX_HAS_LOGF)
|
#if defined(HAVE_REMOTE_LCD) && !defined (ROCKBOX_HAS_LOGF)
|
||||||
|
@ -143,6 +144,9 @@ struct screen
|
||||||
void (*puts_scroll)(int x, int y, const unsigned char *string);
|
void (*puts_scroll)(int x, int y, const unsigned char *string);
|
||||||
void (*puts_scroll_offset)(int x, int y, const unsigned char *string,
|
void (*puts_scroll_offset)(int x, int y, const unsigned char *string,
|
||||||
int x_offset);
|
int x_offset);
|
||||||
|
void (*putsxy_scroll_func)(int x, int y, const unsigned char *string,
|
||||||
|
void (*scroll_func)(struct scrollinfo *),
|
||||||
|
void *data, int x_offset);
|
||||||
void (*scroll_speed)(int speed);
|
void (*scroll_speed)(int speed);
|
||||||
void (*scroll_delay)(int ms);
|
void (*scroll_delay)(int ms);
|
||||||
void (*clear_display)(void);
|
void (*clear_display)(void);
|
||||||
|
|
|
@ -572,6 +572,17 @@ void LCDFN(puts_scroll_style_xyoffset)(int x, int y, const unsigned char *string
|
||||||
true, LCDFN(scroll_fn), NULL);
|
true, LCDFN(scroll_fn), NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void LCDFN(putsxy_scroll_func)(int x, int y, const unsigned char *string,
|
||||||
|
void (*scroll_func)(struct scrollinfo *),
|
||||||
|
void *data, int x_offset)
|
||||||
|
{
|
||||||
|
if (!scroll_func)
|
||||||
|
LCDFN(putsxyofs)(x, y, x_offset, string);
|
||||||
|
else
|
||||||
|
LCDFN(puts_scroll_worker)(x, y, string, STYLE_NONE, x_offset, 0,
|
||||||
|
false, scroll_func, data);
|
||||||
|
}
|
||||||
|
|
||||||
void LCDFN(puts_scroll)(int x, int y, const unsigned char *string)
|
void LCDFN(puts_scroll)(int x, int y, const unsigned char *string)
|
||||||
{
|
{
|
||||||
LCDFN(puts_scroll_style)(x, y, string, STYLE_DEFAULT);
|
LCDFN(puts_scroll_style)(x, y, string, STYLE_DEFAULT);
|
||||||
|
|
|
@ -563,6 +563,16 @@ void lcd_puts_scroll_worker(int x, int y, const unsigned char *string,
|
||||||
lcd_scroll_info.lines++;
|
lcd_scroll_info.lines++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void lcd_putsxy_scroll_func(int x, int y, const unsigned char *string,
|
||||||
|
void (*scroll_func)(struct scrollinfo *),
|
||||||
|
void *data, int x_offset)
|
||||||
|
{
|
||||||
|
if (!scroll_func)
|
||||||
|
lcd_putsxyofs(x, y, x_offset, string);
|
||||||
|
else
|
||||||
|
lcd_puts_scroll_worker(x, y, string, x_offset, scroll_func, data);
|
||||||
|
}
|
||||||
|
|
||||||
void lcd_scroll_fn(struct scrollinfo* s)
|
void lcd_scroll_fn(struct scrollinfo* s)
|
||||||
{
|
{
|
||||||
lcd_putsxyofs(s->x, s->y, s->offset, s->line);
|
lcd_putsxyofs(s->x, s->y, s->offset, s->line);
|
||||||
|
|
|
@ -196,6 +196,9 @@ extern void lcd_remote_puts_scroll_style_xyoffset(int x, int y,
|
||||||
const unsigned char *string,
|
const unsigned char *string,
|
||||||
int style, int x_offset,
|
int style, int x_offset,
|
||||||
int y_offset);
|
int y_offset);
|
||||||
|
extern void lcd_remote_putsxy_scroll_func(int x, int y, const unsigned char *string,
|
||||||
|
void (*scroll_func)(struct scrollinfo *),
|
||||||
|
void *data, int x_offset);
|
||||||
|
|
||||||
extern void lcd_remote_update(void);
|
extern void lcd_remote_update(void);
|
||||||
extern void lcd_remote_update_rect(int x, int y, int width, int height);
|
extern void lcd_remote_update_rect(int x, int y, int width, int height);
|
||||||
|
|
|
@ -108,6 +108,8 @@ enum screen_type {
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct scrollinfo;
|
||||||
|
|
||||||
#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE
|
#if defined(LCD_STRIDEFORMAT) && LCD_STRIDEFORMAT == VERTICAL_STRIDE
|
||||||
#define STRIDE_MAIN(w, h) (h)
|
#define STRIDE_MAIN(w, h) (h)
|
||||||
#else
|
#else
|
||||||
|
@ -212,6 +214,9 @@ extern void lcd_putc(int x, int y, unsigned long ucs);
|
||||||
extern void lcd_puts_scroll(int x, int y, const unsigned char* string);
|
extern void lcd_puts_scroll(int x, int y, const unsigned char* string);
|
||||||
extern void lcd_puts_scroll_style(int x, int y, const unsigned char* string,
|
extern void lcd_puts_scroll_style(int x, int y, const unsigned char* string,
|
||||||
int style);
|
int style);
|
||||||
|
extern void lcd_putsxy_scroll_func(int x, int y, const unsigned char *string,
|
||||||
|
void (*scroll_func)(struct scrollinfo *),
|
||||||
|
void *data, int x_offset);
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue