From 945c8a221ade41c462a93f8452320a806e5645b3 Mon Sep 17 00:00:00 2001 From: Dave Chapman Date: Mon, 7 Jan 2008 20:34:11 +0000 Subject: Add viewport capabilities to all the LCD drivers, and adapt scrolling code. This is the firmware/ part of FS#8385 - the changes to the WPS code still need more work and will be committed at a later date. NOTE: There are no user-visible changes with this commit - just the infrastructure. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16018 a1c6a512-1295-4272-9138-f99709370657 --- firmware/export/lcd-remote.h | 7 +++++++ firmware/export/lcd.h | 28 ++++++++++++++++++++++++++++ firmware/export/scroll_engine.h | 14 ++++++++++++-- 3 files changed, 47 insertions(+), 2 deletions(-) (limited to 'firmware/export') diff --git a/firmware/export/lcd-remote.h b/firmware/export/lcd-remote.h index 3be23747ea..34c40e52c1 100644 --- a/firmware/export/lcd-remote.h +++ b/firmware/export/lcd-remote.h @@ -24,6 +24,7 @@ #include "cpu.h" #include "config.h" #include "adc.h" +#include "lcd.h" #ifdef HAVE_REMOTE_LCD @@ -109,7 +110,9 @@ extern void lcd_remote_init(void); extern int lcd_remote_default_contrast(void); extern void lcd_remote_set_contrast(int val); +extern void lcd_remote_set_viewport(struct viewport* vp); extern void lcd_remote_clear_display(void); +extern void lcd_remote_clear_viewport(void); extern void lcd_remote_puts(int x, int y, const unsigned char *str); extern void lcd_remote_puts_style(int x, int y, const unsigned char *str, int style); @@ -132,6 +135,8 @@ extern void lcd_remote_puts_scroll_style_offset(int x, int y, 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_viewport(void); +extern void lcd_remote_update_viewport_rect(int x, int y, int width, int height); extern void lcd_remote_set_invert_display(bool yesno); extern void lcd_remote_set_flip(bool yesno); @@ -141,6 +146,8 @@ extern int lcd_remote_get_drawmode(void); extern void lcd_remote_setmargins(int xmargin, int ymargin); extern int lcd_remote_getxmargin(void); extern int lcd_remote_getymargin(void); +extern int lcd_remote_getwidth(void); +extern int lcd_remote_getheight(void); extern void lcd_remote_setfont(int font); extern int lcd_remote_getstringsize(const unsigned char *str, int *w, int *h); diff --git a/firmware/export/lcd.h b/firmware/export/lcd.h index 60d9efaf92..276dcdfedc 100644 --- a/firmware/export/lcd.h +++ b/firmware/export/lcd.h @@ -24,6 +24,28 @@ #include "cpu.h" #include "config.h" +struct viewport { + int x; + int y; + int width; + int height; +#ifdef HAVE_LCD_BITMAP + int font; + int drawmode; +#endif + int xmargin; /* During the transition only - to be removed */ + int ymargin; /* During the transition only - to be removed */ +#if LCD_DEPTH > 1 + unsigned fg_pattern; + unsigned bg_pattern; +#ifdef HAVE_LCD_COLOR + unsigned lss_pattern; + unsigned lse_pattern; + unsigned lst_pattern; +#endif +#endif +}; + #define STYLE_DEFAULT 0x00000000 #define STYLE_COLORED 0x10000000 #define STYLE_INVERT 0x20000000 @@ -76,9 +98,14 @@ extern void lcd_set_contrast(int val); extern void lcd_setmargins(int xmargin, int ymargin); extern int lcd_getxmargin(void); extern int lcd_getymargin(void); +extern int lcd_getwidth(void); +extern int lcd_getheight(void); extern int lcd_getstringsize(const unsigned char *str, int *w, int *h); +extern void lcd_set_viewport(struct viewport* vp); extern void lcd_update(void); +extern void lcd_update_viewport(void); +extern void lcd_clear_viewport(void); extern void lcd_clear_display(void); extern void lcd_putsxy(int x, int y, const unsigned char *string); extern void lcd_puts(int x, int y, const unsigned char *string); @@ -119,6 +146,7 @@ extern void lcd_blit(const fb_data* data, int x, int by, int width, /* update a fraction of the screen */ extern void lcd_update_rect(int x, int y, int width, int height); +extern void lcd_update_viewport_rect(int x, int y, int width, int height); #ifdef HAVE_REMOTE_LCD extern void lcd_remote_update(void); diff --git a/firmware/export/scroll_engine.h b/firmware/export/scroll_engine.h index 5e39990129..48d5c5cb8c 100644 --- a/firmware/export/scroll_engine.h +++ b/firmware/export/scroll_engine.h @@ -23,9 +23,17 @@ #ifndef __SCROLL_ENGINE_H__ #define __SCROLL_ENGINE_H__ +#include + void scroll_init(void); +void lcd_scroll_stop(struct viewport* vp); +void lcd_scroll_stop_line(struct viewport* vp, int y); void lcd_scroll_fn(void); +#ifdef HAVE_REMOTE_LCD void lcd_remote_scroll_fn(void); +void lcd_remote_scroll_stop(struct viewport* vp); +void lcd_remote_scroll_stop_line(struct viewport* vp, int y); +#endif /* internal usage, but in multiple drivers */ #define SCROLL_SPACING 3 @@ -37,8 +45,10 @@ void lcd_remote_scroll_fn(void); struct scrollinfo { + struct viewport* vp; char line[SCROLL_LINE_SIZE]; int len; /* length of line in chars */ + int y; /* Position of the line on the screen (char co-ordinates) */ int offset; int startx; #ifdef HAVE_LCD_BITMAP @@ -54,7 +64,7 @@ struct scroll_screen_info { struct scrollinfo * const scroll; const int num_scroll; /* number of scrollable lines (also number of scroll structs) */ - int lines; /* Bitpattern of which lines are scrolling */ + int lines; /* Number of currently scrolling lines */ long ticks; /* # of ticks between updates*/ long delay; /* ticks delay before start */ int bidir_limit; /* percent */ @@ -74,7 +84,7 @@ struct scroll_screen_info #ifdef HAVE_LCD_BITMAP #define LCD_SCROLLABLE_LINES ((LCD_HEIGHT+4)/5 < 32 ? (LCD_HEIGHT+4)/5 : 32) #else -#define LCD_SCROLLABLE_LINES LCD_HEIGHT +#define LCD_SCROLLABLE_LINES LCD_HEIGHT * 2 #endif extern struct scroll_screen_info lcd_scroll_info; -- cgit v1.2.3