From 6aa12c11f741a4544d780d11fc583a25a5aef171 Mon Sep 17 00:00:00 2001 From: Michael Sevakis Date: Sat, 14 Oct 2006 01:32:58 +0000 Subject: Added a small interface to screens to translate colors into remote gray levels on the x5. Splash screens paint properly with light gray. Should be adapted to a more general approach in the future. A few trailing whitespace trimmings got into a couple files but that is fine. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@11218 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/splash.c | 6 ++++-- apps/plugin.c | 8 ++++---- apps/plugin.h | 8 ++++---- apps/screen_access.c | 16 +++++++++++----- apps/screen_access.h | 7 +++++-- 5 files changed, 28 insertions(+), 17 deletions(-) (limited to 'apps') diff --git a/apps/gui/splash.c b/apps/gui/splash.c index 1f04b89fc0..30909217b2 100644 --- a/apps/gui/splash.c +++ b/apps/gui/splash.c @@ -137,7 +137,8 @@ static void splash(struct screen * screen, bool center, { prevfg = screen->get_foreground(); screen->set_drawmode(DRMODE_FG); - screen->set_foreground(LCD_LIGHTGRAY); + screen->set_foreground( + SCREEN_COLOR_TO_NATIVE(screen, LCD_LIGHTGRAY)); } else #endif @@ -147,7 +148,8 @@ static void splash(struct screen * screen, bool center, #if LCD_DEPTH > 1 if (screen->depth > 1) - screen->set_foreground(LCD_BLACK); + screen->set_foreground( + SCREEN_COLOR_TO_NATIVE(screen, LCD_BLACK)); else #endif screen->set_drawmode(DRMODE_SOLID); diff --git a/apps/plugin.c b/apps/plugin.c index 876f82d774..38fdaa8f35 100644 --- a/apps/plugin.c +++ b/apps/plugin.c @@ -220,7 +220,7 @@ static const struct plugin_api rockbox_api = { gui_synclist_scroll_left, #endif gui_synclist_do_button, - + /* button */ button_get, button_get_w_tmo, @@ -413,7 +413,7 @@ static const struct plugin_api rockbox_api = { get_action, action_signalscreenchange, action_userabort, - + /* power */ battery_level, battery_level_safe, @@ -466,7 +466,7 @@ static const struct plugin_api rockbox_api = { /* new stuff at the end, sort into place next time the API gets incompatible */ - + strtok_r, #ifdef HAVE_WHEEL_POSITION wheel_status, @@ -608,7 +608,7 @@ int plugin_load(const char* plugin, void* parameter) #ifdef HAVE_REMOTE_LCD #if LCD_REMOTE_DEPTH > 1 - lcd_remote_set_drawinfo(DRMODE_SOLID, LCD_REMOTE_DEFAULT_FG, + lcd_remote_set_drawinfo(DRMODE_SOLID, LCD_REMOTE_DEFAULT_FG, LCD_REMOTE_DEFAULT_BG); #else lcd_remote_set_drawmode(DRMODE_SOLID); diff --git a/apps/plugin.h b/apps/plugin.h index 25bbeb2324..461c0d816a 100644 --- a/apps/plugin.h +++ b/apps/plugin.h @@ -237,7 +237,7 @@ struct plugin_api { #if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) void (*lcd_remote_set_foreground)(unsigned foreground); unsigned (*lcd_remote_get_foreground)(void); - void (*lcd_remote_set_background)(unsigned foreground); + void (*lcd_remote_set_background)(unsigned background); unsigned (*lcd_remote_get_background)(void); void (*lcd_remote_bitmap_part)(const fb_remote_data *src, int src_x, int src_y, int stride, int x, int y, int width, int height); @@ -276,7 +276,7 @@ struct plugin_api { void (*gui_synclist_scroll_left)(struct gui_synclist * lists); #endif unsigned (*gui_synclist_do_button)(struct gui_synclist * lists, unsigned button); - + /* button */ long (*button_get)(bool block); long (*button_get_w_tmo)(int ticks); @@ -319,8 +319,8 @@ struct plugin_api { long* current_tick; long (*default_event_handler)(long event); long (*default_event_handler_ex)(long event, void (*callback)(void *), void *parameter); - struct thread_entry* (*create_thread)(void (*function)(void), void* stack, - int stack_size, const char *name + struct thread_entry* (*create_thread)(void (*function)(void), void* stack, + int stack_size, const char *name IF_PRIO(, int priority)); void (*remove_thread)(struct thread_entry *thread); void (*reset_poweroff_timer)(void); diff --git a/apps/screen_access.c b/apps/screen_access.c index 704cab1a37..b784637308 100644 --- a/apps/screen_access.c +++ b/apps/screen_access.c @@ -52,9 +52,12 @@ void screen_init(struct screen * screen, enum screen_type screen_type) screen->getstringsize=&lcd_remote_getstringsize; screen->putsxy=&lcd_remote_putsxy; screen->mono_bitmap=&lcd_remote_mono_bitmap; - screen->mono_bitmap_part=&lcd_remote_mono_bitmap_part; + screen->mono_bitmap_part=&lcd_remote_mono_bitmap_part; screen->set_drawmode=&lcd_remote_set_drawmode; #if LCD_REMOTE_DEPTH > 1 +#if defined(HAVE_LCD_COLOR) + screen->color_to_native=&lcd_remote_color_to_native; +#endif screen->get_background=&lcd_remote_get_background; screen->get_foreground=&lcd_remote_get_foreground; screen->set_background=&lcd_remote_set_background; @@ -126,9 +129,9 @@ void screen_init(struct screen * screen, enum screen_type screen_type) screen->mono_bitmap=&lcd_mono_bitmap; screen->mono_bitmap_part=&lcd_mono_bitmap_part; screen->set_drawmode=&lcd_set_drawmode; -#if LCD_DEPTH > 1 +#if LCD_DEPTH > 1 screen->bitmap=&lcd_bitmap; - screen->bitmap_part=&lcd_bitmap_part; + screen->bitmap_part=&lcd_bitmap_part; #if LCD_DEPTH == 2 /* No transparency yet for grayscale lcd */ screen->transparent_bitmap=&lcd_bitmap; @@ -136,6 +139,9 @@ void screen_init(struct screen * screen, enum screen_type screen_type) #else screen->transparent_bitmap=&lcd_bitmap_transparent; screen->transparent_bitmap_part=&lcd_bitmap_transparent_part; +#endif +#if defined(HAVE_LCD_COLOR) && LCD_REMOTE_DEPTH > 1 + screen->color_to_native=&lcd_color_to_native; #endif screen->get_background=&lcd_get_background; screen->get_foreground=&lcd_get_foreground; @@ -149,8 +155,8 @@ void screen_init(struct screen * screen, enum screen_type screen_type) screen->drawline=&lcd_drawline; screen->vline=&lcd_vline; screen->hline=&lcd_hline; - screen->scroll_speed=&lcd_scroll_speed; - screen->scroll_delay=&lcd_scroll_delay; + screen->scroll_speed=&lcd_scroll_speed; + screen->scroll_delay=&lcd_scroll_delay; screen->scroll_step=&lcd_scroll_step; screen->invertscroll=&lcd_invertscroll; screen->puts_offset=&lcd_puts_offset; diff --git a/apps/screen_access.h b/apps/screen_access.h index 680c6625fe..cf74a97ba1 100644 --- a/apps/screen_access.h +++ b/apps/screen_access.h @@ -72,7 +72,7 @@ struct screen void (*scroll_step)(int pixels); void (*puts_offset)(int x, int y, const unsigned char *str, int offset); - void (*puts_style_offset)(int x, int y, const unsigned char *str, + void (*puts_style_offset)(int x, int y, const unsigned char *str, int style, int offset); void (*puts_scroll_style)(int x, int y, const unsigned char *string, int style); @@ -87,12 +87,15 @@ struct screen void (*bitmap)(const fb_data *src, int x, int y, int width, int height); void (*bitmap_part)(const fb_data *src, int src_x, int src_y, - int stride, int x, int y, int width, int height); + int stride, int x, int y, int width, int height); void (*transparent_bitmap)(const fb_data *src, int x, int y, int width, int height); void (*transparent_bitmap_part)(const fb_data *src, int src_x, int src_y, int stride, int x, int y, int width, int height); void (*set_drawmode)(int mode); +#if defined(HAVE_LCD_COLOR) && LCD_REMOTE_DEPTH > 1 + unsigned (*color_to_native)(unsigned color); +#endif #if (LCD_DEPTH > 1) || (LCD_REMOTE_DEPTH > 1) unsigned (*get_background)(void); unsigned (*get_foreground)(void); -- cgit v1.2.3