1
0
Fork 0
forked from len0rd/rockbox

Multi-screen API: Fixed macro checks for screen type/ depth, some cleanup. The multi-screen code doesn't handle certain combinations (which aren't found in current targets). A combination of one charcell and one bitmap lcd will make it crash, and a combination of two bitmap LCDs with a depth > 1 but different pixel formats will show wrong colours/ shades on the remote.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7992 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Jens Arnold 2005-11-19 11:45:08 +00:00
parent 5bf5e6191f
commit b85cdbb259
2 changed files with 30 additions and 30 deletions

View file

@ -37,23 +37,22 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
{
#ifdef HAVE_REMOTE_LCD
case SCREEN_REMOTE:
screen->depth=LCD_REMOTE_DEPTH;
#if 1 /* all remote LCDs are bitmapped so far */
screen->width=LCD_REMOTE_WIDTH;
screen->height=LCD_REMOTE_HEIGHT;
screen->is_color=false;
screen->depth=1;
#ifdef HAVE_LCD_BITMAP
screen->setmargins=&lcd_remote_setmargins;
screen->getymargin=&lcd_remote_getymargin;
screen->getxmargin=&lcd_remote_getxmargin;
screen->setfont=&lcd_remote_setfont;
screen->setfont(FONT_UI);
screen->getstringsize=&lcd_remote_getstringsize;
screen->putsxy=&lcd_remote_putsxy;
screen->mono_bitmap=&lcd_remote_mono_bitmap;
screen->set_drawmode=&lcd_remote_set_drawmode;
#if LCD_DEPTH > 1
/* since lcd_remote_set_background doesn't exist yet ... */
screen->set_background=NULL;
#endif /* LCD_DEPTH > 1 */
#if LCD_REMOTE_DEPTH > 1
screen->set_background=&lcd_remote_set_background;
#endif /* LCD_REMOTE_DEPTH > 1 */
screen->update_rect=&lcd_remote_update_rect;
screen->fillrect=&lcd_remote_fillrect;
screen->drawrect=&lcd_remote_drawrect;
@ -66,12 +65,22 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
screen->scroll_step=&lcd_remote_scroll_step;
screen->puts_scroll_style=&lcd_remote_puts_scroll_style;
screen->invertscroll=&lcd_remote_invertscroll;
#endif /* HAVE_LCD_BITMAP */
#endif /* 1 */
#ifdef HAVE_LCD_CHARCELLS
screen->double_height=&lcd_double_height;
#if 0 /* no charcell remote LCDs so far */
screen->width=11;
screen->height=2;
screen->double_height=&lcd_remote_double_height;
screen->putc=&lcd_remote_putc;
#endif /* HAVE_LCD_CHARCELLS */
screen->get_locked_pattern=&lcd_remote_get_locked_pattern;
screen->define_pattern=&lcd_remote_define_pattern;
#ifdef SIMULATOR
screen->icon=&sim_lcd_remote_icon;
#else
screen->icon=&lcd_remote_icon;
#endif
#endif /* 0 */
screen->init=&lcd_remote_init;
screen->puts_scroll=&lcd_remote_puts_scroll;
screen->stop_scroll=&lcd_remote_stop_scroll;
@ -84,11 +93,6 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
case SCREEN_MAIN:
default:
#ifdef HAVE_LCD_COLOR
screen->is_color=true;
#else
screen->is_color=false;
#endif
screen->depth=LCD_DEPTH;
#ifdef HAVE_LCD_BITMAP
screen->width=LCD_WIDTH;
@ -97,11 +101,12 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
screen->getymargin=&lcd_getymargin;
screen->getxmargin=&lcd_getxmargin;
screen->setfont=&lcd_setfont;
screen->setfont(FONT_UI);
screen->getstringsize=&lcd_getstringsize;
screen->putsxy=&lcd_putsxy;
screen->mono_bitmap=&lcd_mono_bitmap;
screen->set_drawmode=&lcd_set_drawmode;
#if LCD_DEPTH > 1
#if LCD_DEPTH > 1
screen->set_background=&lcd_set_background;
#endif
screen->update_rect=&lcd_update_rect;
@ -130,8 +135,8 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
#else
screen->icon=&lcd_icon;
#endif
#endif /* HAVE_LCD_CHARCELLS */
screen->init=&lcd_init;
screen->puts_scroll=&lcd_puts_scroll;
screen->stop_scroll=&lcd_stop_scroll;
@ -142,9 +147,6 @@ void screen_init(struct screen * screen, enum screen_type screen_type)
screen->puts=&lcd_puts;
break;
}
#ifdef HAVE_LCD_BITMAP
screen->setfont(FONT_UI);
#endif
screen->screen_type=screen_type;
#ifdef HAS_BUTTONBAR
screen->has_buttonbar=false;

View file

@ -51,7 +51,6 @@ struct screen
int width, height;
int nb_lines;
enum screen_type screen_type;
bool is_color;
int depth;
int char_width;
int char_height;
@ -59,8 +58,7 @@ struct screen
bool has_buttonbar;
#endif
#ifdef HAVE_LCD_BITMAP
#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) /* always bitmap */
void (*setmargins)(int x, int y);
int (*getxmargin)(void);
int (*getymargin)(void);
@ -75,9 +73,9 @@ struct screen
void (*mono_bitmap)(const unsigned char *src,
int x, int y, int width, int height);
void (*set_drawmode)(int mode);
#if LCD_DEPTH > 1
#if (LCD_DEPTH > 1) || (LCD_REMOTE_DEPTH > 1)
void (*set_background)(unsigned background);
#endif /* LCD_DEPTH > 1 */
#endif /* (LCD_DEPTH > 1) || (LCD_REMOTE_DEPTH > 1) */
void (*update_rect)(int x, int y, int width, int height);
void (*fillrect)(int x, int y, int width, int height);
void (*drawrect)(int x, int y, int width, int height);
@ -86,9 +84,9 @@ struct screen
void (*vline)(int x, int y1, int y2);
void (*hline)(int x1, int x2, int y);
void (*invertscroll) (int x, int y);
#endif /* HAVE_LCD_BITMAP */
#endif /* HAVE_LCD_BITMAP || HAVE_REMOTE_LCD */
#ifdef HAVE_LCD_CHARCELLS
#ifdef HAVE_LCD_CHARCELLS /* no charcell remote LCDs so far */
void (*double_height)(bool on);
void (*putc)(int x, int y, unsigned short ch);
void (*icon)(int icon, bool enable);
@ -101,7 +99,7 @@ struct screen
void (*clear_display)(void);
unsigned char (*get_locked_pattern)(void);
void (*define_pattern)(int pat, const char *pattern);
#if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR)
#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) || defined(SIMULATOR)
void (*update)(void);
#endif
@ -141,7 +139,7 @@ extern void screen_init(struct screen * screen, enum screen_type screen_type);
#define screen_set_ymargin(screen, ymargin) \
(screen)->setmargins((screen)->getxmargin(), ymargin);
#ifdef HAVE_LCD_BITMAP
#if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD)
/*
* Clear only a given area of the screen
* - screen : the screen structure