From 0ecd0b0fc2450c3a51239af2970793124b7af5e1 Mon Sep 17 00:00:00 2001 From: Linus Nielsen Feltzing Date: Thu, 2 Feb 2006 22:00:56 +0000 Subject: patch #1422861 by Adam Boot - Fix splash() color problems git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8541 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/splash.c | 16 +++++++++++++--- apps/screen_access.c | 6 ++++++ apps/screen_access.h | 3 +++ 3 files changed, 22 insertions(+), 3 deletions(-) (limited to 'apps') diff --git a/apps/gui/splash.c b/apps/gui/splash.c index fffa520b4f..d04ef015b9 100644 --- a/apps/gui/splash.c +++ b/apps/gui/splash.c @@ -51,6 +51,10 @@ static void splash(struct screen * screen, bool first=true; #ifdef HAVE_LCD_BITMAP int maxw=0; +#if LCD_DEPTH > 1 + unsigned prevbg = LCD_DEFAULT_BG; + unsigned prevfg = LCD_DEFAULT_FG; +#endif #endif #ifdef HAVE_LCD_CHARCELLS @@ -127,8 +131,12 @@ static void splash(struct screen * screen, int xx = (screen->width-maxw)/2 - 2; /* The new graphics routines handle clipping, so no need to check */ #if LCD_DEPTH > 1 - if(screen->depth>1) + if(screen->depth>1) { + prevbg = screen->get_background(); + prevfg = screen->get_foreground(); screen->set_background(LCD_LIGHTGRAY); + screen->set_foreground(LCD_BLACK); + } #endif screen->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); screen->fillrect(xx, y-2, maxw+4, screen->height-y*2+4); @@ -177,8 +185,10 @@ static void splash(struct screen * screen, } #if defined(HAVE_LCD_BITMAP) && (LCD_DEPTH > 1) - if(screen->depth > 1) - screen->set_background(LCD_DEFAULT_BG); + if(screen->depth > 1) { + screen->set_background(prevbg); + screen->set_foreground(prevfg); + } #endif #if defined(HAVE_LCD_BITMAP) || defined(SIMULATOR) screen->update(); diff --git a/apps/screen_access.c b/apps/screen_access.c index d38f1ca6a9..a1f615cd16 100644 --- a/apps/screen_access.c +++ b/apps/screen_access.c @@ -54,7 +54,10 @@ void screen_init(struct screen * screen, enum screen_type screen_type) screen->mono_bitmap=&lcd_remote_mono_bitmap; screen->set_drawmode=&lcd_remote_set_drawmode; #if LCD_REMOTE_DEPTH > 1 + screen->get_background=&lcd_remote_get_background; + screen->get_foreground=&lcd_remote_get_foreground; screen->set_background=&lcd_remote_set_background; + screen->set_foreground=&lcd_remote_set_foreground; #endif /* LCD_REMOTE_DEPTH > 1 */ screen->update_rect=&lcd_remote_update_rect; screen->fillrect=&lcd_remote_fillrect; @@ -127,7 +130,10 @@ void screen_init(struct screen * screen, enum screen_type screen_type) #else screen->transparent_bitmap=&lcd_bitmap_transparent; #endif + screen->get_background=&lcd_get_background; + screen->get_foreground=&lcd_get_foreground; screen->set_background=&lcd_set_background; + screen->set_foreground=&lcd_set_foreground; #endif screen->update_rect=&lcd_update_rect; screen->fillrect=&lcd_fillrect; diff --git a/apps/screen_access.h b/apps/screen_access.h index 3664ecb13d..7b8018dc41 100644 --- a/apps/screen_access.h +++ b/apps/screen_access.h @@ -88,7 +88,10 @@ struct screen int x, int y, int width, int height); void (*set_drawmode)(int mode); #if (LCD_DEPTH > 1) || (LCD_REMOTE_DEPTH > 1) + unsigned (*get_background)(void); + unsigned (*get_foreground)(void); void (*set_background)(unsigned background); + void (*set_foreground)(unsigned foreground); #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); -- cgit v1.2.3