Index: apps/screen_access.c =================================================================== --- apps/screen_access.c (revision 24254) +++ apps/screen_access.c (working copy) @@ -200,7 +200,6 @@ .is_backlight_on=&is_backlight_on, .backlight_set_timeout=&backlight_set_timeout, .backdrop_load=&backdrop_load, - .backdrop_unload=&backdrop_unload, .backdrop_show=&backdrop_show, #ifdef HAVE_BUTTONBAR .has_buttonbar=false, @@ -286,7 +285,6 @@ .is_backlight_on=&is_remote_backlight_on, .backlight_set_timeout=&remote_backlight_set_timeout, .backdrop_load=&remote_backdrop_load, - .backdrop_unload=&remote_backdrop_unload, .backdrop_show=&remote_backdrop_show, #ifdef HAVE_BUTTONBAR .has_buttonbar=false, Index: apps/screen_access.h =================================================================== --- apps/screen_access.h (revision 24254) +++ apps/screen_access.h (working copy) @@ -147,9 +147,8 @@ void (*backlight_off)(void); bool (*is_backlight_on)(bool ignore_always_off); void (*backlight_set_timeout)(int index); - bool (*backdrop_load)(enum backdrop_type bdrop, const char* filename); - void (*backdrop_unload)(enum backdrop_type bdrop); - void (*backdrop_show)(enum backdrop_type bdrop); + bool (*backdrop_load)(const char *filename, char* backdrop_buffer); + void (*backdrop_show)(char* backdrop_buffer); }; #if defined(HAVE_LCD_BITMAP) || defined(HAVE_REMOTE_LCD) Index: apps/settings.c =================================================================== --- apps/settings.c (revision 24254) +++ apps/settings.c (working copy) @@ -63,7 +63,6 @@ #include "settings_list.h" #include "filetypes.h" #include "option_select.h" -#include "backdrop.h" #if CONFIG_TUNER #include "radio.h" #endif @@ -906,21 +905,6 @@ load_kbd(NULL); #endif - -#if LCD_DEPTH > 1 - if ( global_settings.backdrop_file[0] && - global_settings.backdrop_file[0] != 0xff ) { - snprintf(buf, sizeof buf, BACKDROP_DIR "/%s.bmp", - global_settings.backdrop_file); - backdrop_load(BACKDROP_MAIN, buf); - } else { - backdrop_unload(BACKDROP_MAIN); - } -#endif - - FOR_NB_SCREENS(screen) - screens[screen].backdrop_show(BACKDROP_MAIN); - if ( global_settings.lang_file[0]) { snprintf(buf, sizeof buf, LANG_DIR "/%s.lng", global_settings.lang_file); Index: apps/onplay.c =================================================================== --- apps/onplay.c (revision 24254) +++ apps/onplay.c (working copy) @@ -589,16 +589,16 @@ static bool set_backdrop(void) { /* load the image */ - if(backdrop_load(BACKDROP_MAIN, selected_file)) { + if(sb_set_backdrop(SCREEN_MAIN, selected_file)) { splash(HZ, str(LANG_BACKDROP_LOADED)); set_file(selected_file, (char *)global_settings.backdrop_file, MAX_FILENAME); - backdrop_show(BACKDROP_MAIN); return true; } else { splash(HZ, str(LANG_BACKDROP_FAILED)); return false; } + return true; } #endif Index: apps/gui/backdrop.c =================================================================== --- apps/gui/backdrop.c (revision 24254) +++ apps/gui/backdrop.c (working copy) @@ -27,115 +27,40 @@ #endif #include "backdrop.h" -static fb_data main_backdrop[LCD_FBHEIGHT][LCD_FBWIDTH] - __attribute__ ((aligned (16))); -static fb_data skin_backdrop[LCD_FBHEIGHT][LCD_FBWIDTH] - __attribute__ ((aligned (16))); +/* api functions */ -#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 -static fb_remote_data -remote_skin_backdrop[LCD_REMOTE_FBHEIGHT][LCD_REMOTE_FBWIDTH]; -static bool remote_skin_backdrop_valid = false; -#endif - -static bool main_backdrop_valid = false; -static bool skin_backdrop_valid = false; - -/* load a backdrop into a buffer */ -static bool load_backdrop(const char* filename, fb_data* backdrop_buffer) +bool backdrop_load(const char* filename, char *backdrop_buffer) { struct bitmap bm; int ret; /* load the image */ - bm.data=(char*)backdrop_buffer; - ret = read_bmp_file(filename, &bm, sizeof(main_backdrop), + bm.data = backdrop_buffer; + ret = read_bmp_file(filename, &bm, LCD_BACKDROP_BYTES, FORMAT_NATIVE | FORMAT_DITHER, NULL); return ((ret > 0) && (bm.width == LCD_WIDTH) && (bm.height == LCD_HEIGHT)); } -static bool load_main_backdrop(const char* filename) -{ - main_backdrop_valid = load_backdrop(filename, &main_backdrop[0][0]); - return main_backdrop_valid; -} -static inline bool load_skin_backdrop(const char* filename) +void backdrop_show(char *backdrop_buffer) { - skin_backdrop_valid = load_backdrop(filename, &skin_backdrop[0][0]); - return skin_backdrop_valid; + lcd_set_backdrop((fb_data*)backdrop_buffer); } -static inline void unload_main_backdrop(void) -{ - main_backdrop_valid = false; -} -static inline void unload_skin_backdrop(void) -{ - skin_backdrop_valid = false; -} +#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 -static inline void show_main_backdrop(void) -{ - lcd_set_backdrop(main_backdrop_valid ? &main_backdrop[0][0] : NULL); -} - -static void show_skin_backdrop(void) -{ - /* if no wps backdrop, fall back to main backdrop */ - if(skin_backdrop_valid) - { - lcd_set_backdrop(&skin_backdrop[0][0]); - } - else - { - show_main_backdrop(); - } -} - /* api functions */ - -bool backdrop_load(enum backdrop_type bdrop, const char* filename) +bool remote_backdrop_load(const char *filename, char* backdrop_buffer) { - if (bdrop == BACKDROP_MAIN) - return load_main_backdrop(filename); - else if (bdrop == BACKDROP_SKIN_WPS) - return load_skin_backdrop(filename); - else - return false; -} - -void backdrop_unload(enum backdrop_type bdrop) -{ - if (bdrop == BACKDROP_MAIN) - unload_main_backdrop(); - else if (bdrop == BACKDROP_SKIN_WPS) - unload_skin_backdrop(); -} - -void backdrop_show(enum backdrop_type bdrop) -{ - if (bdrop == BACKDROP_MAIN) - show_main_backdrop(); - else if (bdrop == BACKDROP_SKIN_WPS) - show_skin_backdrop(); -} - - -#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 - -static bool load_remote_backdrop(const char* filename, - fb_remote_data* backdrop_buffer) -{ struct bitmap bm; int ret; /* load the image */ - bm.data=(char*)backdrop_buffer; - ret = read_bmp_file(filename, &bm, sizeof(main_backdrop), + bm.data = backdrop_buffer; + ret = read_bmp_file(filename, &bm, REMOTE_LCD_BACKDROP_BYTES, FORMAT_NATIVE | FORMAT_DITHER | FORMAT_REMOTE, NULL); return ((ret > 0) @@ -143,62 +68,9 @@ && (bm.height == LCD_REMOTE_HEIGHT)); } -static inline bool load_remote_skin_backdrop(const char* filename) +void remote_backdrop_show(char* backdrop_buffer) { - remote_skin_backdrop_valid = - load_remote_backdrop(filename, &remote_skin_backdrop[0][0]); - return remote_skin_backdrop_valid; + lcd_remote_set_backdrop((fb_remote_data*)backdrop_buffer); } -static inline void unload_remote_skin_backdrop(void) -{ - remote_skin_backdrop_valid = false; -} - -static inline void show_remote_main_backdrop(void) -{ - lcd_remote_set_backdrop(NULL); -} - -static inline void show_remote_skin_backdrop(void) -{ - /* if no wps backdrop, fall back to main backdrop */ - if(remote_skin_backdrop_valid) - { - lcd_remote_set_backdrop(&remote_skin_backdrop[0][0]); - } - else - { - show_remote_main_backdrop(); - } -} - - -/* api functions */ -bool remote_backdrop_load(enum backdrop_type bdrop, - const char *filename) -{ - if (bdrop == BACKDROP_SKIN_WPS) - return load_remote_skin_backdrop(filename); - else if (bdrop == BACKDROP_MAIN) - return true; - else - return false; -} - -void remote_backdrop_show(enum backdrop_type bdrop) -{ - if (bdrop == BACKDROP_MAIN) - show_remote_main_backdrop(); - else if (bdrop == BACKDROP_SKIN_WPS) - show_remote_skin_backdrop(); -} - -void remote_backdrop_unload(enum backdrop_type bdrop) -{ - if (bdrop != BACKDROP_MAIN) - unload_remote_skin_backdrop(); -} - - #endif Index: apps/gui/usb_screen.c =================================================================== --- apps/gui/usb_screen.c (revision 24254) +++ apps/gui/usb_screen.c (working copy) @@ -202,7 +202,6 @@ #endif screen->set_viewport(parent); - screen->backdrop_show(BACKDROP_MAIN); screen->backlight_on(); screen->clear_viewport(); Index: apps/gui/backdrop.h =================================================================== --- apps/gui/backdrop.h (revision 24254) +++ apps/gui/backdrop.h (working copy) @@ -22,59 +22,53 @@ #ifndef _BACKDROP_H #define _BACKDROP_H -enum backdrop_type { - BACKDROP_MAIN, - BACKDROP_SKIN_WPS, -}; + #if LCD_DEPTH > 1 && !defined(__PCTOOL__) #include "lcd.h" #include "bmp.h" -bool backdrop_load(enum backdrop_type bdrop, const char*); -void backdrop_unload(enum backdrop_type bdrop); -void backdrop_show(enum backdrop_type bdrop); +#define LCD_BACKDROP_BYTES (LCD_FBHEIGHT*LCD_FBWIDTH*sizeof(fb_data)) +#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 +#define REMOTE_LCD_BACKDROP_BYTES \ + (LCD_REMOTE_FBHEIGHT*LCD_REMOTE_FBWIDTH*sizeof(fb_remote_data)) +#else +#define REMOTE_LCD_BACKDROP_BYTES 0 +#endif + +bool backdrop_load(const char *filename, char* backdrop_buffer); +void backdrop_show(char* backdrop_buffer); + #else /* LCD_DEPTH <= 1 || __PCTOOL__ */ -static inline bool backdrop_load(enum backdrop_type bdrop, const char* filename) +static inline bool backdrop_load(const char *filename, char* backdrop_buffer) { - (void)filename; (void)bdrop; return true; + (void)filename; (void)backdrop_buffer; return true; } -static inline void backdrop_unload(enum backdrop_type bdrop) +static inline void backdrop_show(char* backdrop_buffer) { - (void)bdrop; + (void)backdrop_buffer; } -static inline void backdrop_show(enum backdrop_type bdrop) -{ - (void)bdrop; -} - #endif #if defined(HAVE_REMOTE_LCD) /* no main backdrop, stubs! */ #if LCD_REMOTE_DEPTH > 1 -bool remote_backdrop_load(enum backdrop_type bdrop,const char* filename); -void remote_backdrop_unload(enum backdrop_type bdrop); -void remote_backdrop_show(enum backdrop_type bdrop); +bool remote_backdrop_load(const char *filename, char* backdrop_buffer); +void remote_backdrop_show(char* backdrop_buffer); #else -static inline -bool remote_backdrop_load(enum backdrop_type bdrop,const char* filename) -{ - (void)filename; (void)bdrop; return true; -} -static inline void remote_backdrop_unload(enum backdrop_type bdrop) +static inline bool remote_backdrop_load(const char *filename, char* backdrop_buffer) { - (void)bdrop; + (void)filename; (void)backdrop_buffer; return true; } -static inline void remote_backdrop_show(enum backdrop_type bdrop) +static inline void remote_backdrop_show(char* backdrop_buffer) { - (void)bdrop; + (void)backdrop_buffer; } #endif #endif Index: apps/gui/statusbar-skinned.c =================================================================== --- apps/gui/statusbar-skinned.c (revision 24254) +++ apps/gui/statusbar-skinned.c (working copy) @@ -41,8 +41,6 @@ static struct wps_sync_data sb_skin_sync_data = { .do_full_update = false }; /* initial setup of wps_data */ - -static bool loaded_ok[NB_SCREENS] = { false }; static int update_delay = DEFAULT_UPDATE_DELAY; @@ -68,66 +66,62 @@ vp->hidden_flags = VP_NEVER_VISIBLE; } - loaded_ok[screen] = success; + if (!success && isfile) + sb_create_from_settings(screen); } -/* temporary viewport structs while the non-skinned bar is in the build */ -static struct viewport inbuilt[NB_SCREENS]; struct viewport *sb_skin_get_info_vp(enum screen_type screen) { - int bar_setting = statusbar_position(screen); - if (bar_setting == STATUSBAR_CUSTOM) - return &find_viewport(VP_INFO_LABEL, sb_skin[screen].data)->vp; - else if (bar_setting == STATUSBAR_OFF) - return NULL; - else - { - viewport_set_fullscreen(&inbuilt[screen], screen); - /* WE need to return the UI area.. NOT the statusbar area! */ - if (bar_setting == STATUSBAR_TOP) - inbuilt[screen].y = STATUSBAR_HEIGHT; - inbuilt[screen].height -= STATUSBAR_HEIGHT; - return &inbuilt[screen]; - } + return &find_viewport(VP_INFO_LABEL, sb_skin[screen].data)->vp; } -inline bool sb_skin_get_state(enum screen_type screen) +#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) +char* sb_get_backdrop(enum screen_type screen) { - /* Temp fix untill the hardcoded bar is removed */ - int bar_setting = global_settings.statusbar; -#if NB_SCREENS > 1 - if (screen == SCREEN_REMOTE) - bar_setting = global_settings.remote_statusbar; -#endif - switch (bar_setting) + return sb_skin[screen].data->backdrop; +} + +bool sb_set_backdrop(enum screen_type screen, char* filename) +{ + if (!filename) { - case STATUSBAR_CUSTOM: - return loaded_ok[screen]; - case STATUSBAR_TOP: - case STATUSBAR_BOTTOM: - return true; - case STATUSBAR_OFF: - return false; + sb_skin[screen].data->backdrop = NULL; + return true; } - return false; /* Should never actually get here */ + else if (!sb_skin[screen].data->backdrop) + { + /* need to make room on the buffer */ + size_t buf_size; +#if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) + if (curr_screen == SCREEN_REMOTE) + buf_size = LCD_REMOTE_FBHEIGHT * LCD_REMOTE_FBWIDTH * sizeof(fb_remote_data); + else +#endif + buf_size = LCD_FBHEIGHT * LCD_FBWIDTH * sizeof(fb_data); + sb_skin[screen].data->backdrop = skin_buffer_alloc(buf_size); + if (!sb_skin[screen].data->backdrop) + return false; + } + + if (!screens[screen].backdrop_load(filename, sb_skin[screen].data->backdrop)) + sb_skin[screen].data->backdrop = NULL; + return sb_skin[screen].data->backdrop != NULL; } - + +#endif void sb_skin_update(enum screen_type screen, bool force) { static long next_update = 0; int i = screen; if (TIME_AFTER(current_tick, next_update) || force) { - if (sb_skin_get_state(i)) - { #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) - /* currently, all remotes are readable without backlight - * so still update those */ - if (lcd_active() || (i != SCREEN_MAIN)) + /* currently, all remotes are readable without backlight + * so still update those */ + if (lcd_active() || (i != SCREEN_MAIN)) #endif - skin_update(&sb_skin[i], force? - WPS_REFRESH_ALL : WPS_REFRESH_NON_STATIC); - } + skin_update(&sb_skin[i], force? + WPS_REFRESH_ALL : WPS_REFRESH_NON_STATIC); next_update = current_tick + update_delay; /* don't update too often */ sb_skin[SCREEN_MAIN].sync_data->do_full_update = false; } @@ -148,6 +142,58 @@ update_delay = delay; } +/* This creates and loads a ".sbs" based on the user settings for: + * - regular statusbar + * - colours + * - ui viewport + * - backdrop + */ +void sb_create_from_settings(enum screen_type screen) +{ + char buf[128], *ptr, *ptr2; + int len, remaining = sizeof(buf); + + ptr = buf; + +#if LCD_DEPTH > 1 + /* backdrop */ + if (screen == SCREEN_MAIN && global_settings.backdrop_file[0]) + { + len = snprintf(ptr, remaining, "%%X|%s.bmp|\n", global_settings.backdrop_file); + ptr += len; + remaining -= len; + } +#endif + /* %Vi viewport, colours handled by the parser */ +#if NB_SCREENS > 1 + if (screen == SCREEN_REMOTE) + ptr2 = global_settings.remote_ui_vp_config; +#endif + ptr2 = global_settings.ui_vp_config; + + if (ptr2[0] && ptr2[0] != '-') /* from ui viewport setting */ + { + len = snprintf(ptr, remaining, "%%Vi|%s\n", ptr2); + while ((ptr2 = strchr(ptr, ','))) + *ptr2 = '|'; + } + else + { + int y = 0, height; + switch (statusbar_position(screen)) + { + case STATUSBAR_TOP: + y = STATUSBAR_HEIGHT; + case STATUSBAR_BOTTOM: + height = LCD_HEIGHT - STATUSBAR_HEIGHT; + break; + default: + height = LCD_HEIGHT; + } + len = snprintf(ptr, remaining, "%%Vi|0|%d|-|%d|1|-|-|\n", y, height); + } + sb_skin_data_load(screen, buf, false); +} void sb_skin_init(void) { Index: apps/gui/statusbar-skinned.h =================================================================== --- apps/gui/statusbar-skinned.h (revision 24254) +++ apps/gui/statusbar-skinned.h (working copy) @@ -33,20 +33,24 @@ void sb_skin_data_load(enum screen_type screen, const char *buf, bool isfile); -/* probably temporary, to shut the classic statusbar up */ -bool sb_skin_get_state(enum screen_type screen); +void sb_create_from_settings(enum screen_type screen); void sb_skin_init(void); struct viewport *sb_skin_get_info_vp(enum screen_type screen); void sb_skin_update(enum screen_type screen, bool force); void sb_skin_set_update_delay(int delay); +#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) +char* sb_get_backdrop(enum screen_type screen); +bool sb_set_backdrop(enum screen_type screen, char* filename); +#endif + #else /* CHARCELL */ #define sb_skin_init() #define sb_skin_data_load(a,b,c) #define sb_skin_set_update_delay(a) #define sb_skin_set_state(a,b) -#define sb_skin_get_state(a) +#define sb_create_from_settings(a) #endif void do_sbs_update_callback(void *param); #endif /* __STATUSBAR_SKINNED_H__ */ Index: apps/gui/skin_engine/skin_engine.h =================================================================== --- apps/gui/skin_engine/skin_engine.h (revision 24254) +++ apps/gui/skin_engine/skin_engine.h (working copy) @@ -27,6 +27,15 @@ #include "wps_internals.h" /* TODO: remove this line.. shoudlnt be needed */ +enum skinnable_screens { + CUSTOM_STATUSBAR = 0, + WPS, + + + SKINNABLE_SCREENS_COUNT +}; + + #ifdef HAVE_TOUCHSCREEN int wps_get_touchaction(struct wps_data *data); #endif Index: apps/gui/skin_engine/skin_parser.c =================================================================== --- apps/gui/skin_engine/skin_parser.c (revision 24254) +++ apps/gui/skin_engine/skin_parser.c (working copy) @@ -92,22 +92,6 @@ static int follow_lang_direction = 0; -#ifdef HAVE_LCD_BITMAP - -#if LCD_DEPTH > 1 -#define MAX_BITMAPS (MAX_IMAGES+MAX_PROGRESSBARS+1) /* WPS images + pbar bitmap + backdrop */ -#else -#define MAX_BITMAPS (MAX_IMAGES+MAX_PROGRESSBARS) /* WPS images + pbar bitmap */ -#endif - -#define PROGRESSBAR_BMP MAX_IMAGES -#define BACKDROP_BMP (MAX_BITMAPS-1) - -/* pointers to the bitmap filenames in the WPS source */ -static const char *bmp_names[MAX_BITMAPS]; - -#endif /* HAVE_LCD_BITMAP */ - #if defined(DEBUG) || defined(SIMULATOR) /* debugging function */ extern void print_debug_info(struct wps_data *data, int fail, int line); @@ -935,7 +919,18 @@ if (token->type == WPS_TOKEN_IMAGE_BACKDROP) { /* format: %X|filename.bmp| */ - bmp_names[BACKDROP_BMP] = wps_bufptr + 1; + if (*(wps_bufptr+1) == '-') + { +#if 0 /* (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) */ + char *bdrop; + if (curr_screen == SCREEN_REMOTE) + bdrop = global_settings.remote_backdrop; /* no support yet */ +#endif + if (global_settings.backdrop_file[0]) + wps_data->backdrop = (char*)global_settings.backdrop_file; + } + else + wps_data->backdrop = (char*)wps_bufptr + 1; } #endif @@ -1899,6 +1894,9 @@ wps_data->images = NULL; wps_data->progressbars = NULL; #endif +#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 + wps_data->backdrop = NULL; +#endif #ifdef HAVE_TOUCHSCREEN wps_data->touchregions = NULL; #endif @@ -1996,12 +1994,30 @@ } #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) - if (bmp_names[BACKDROP_BMP]) + if (wps_data->backdrop) { char img_path[MAX_PATH]; - get_image_filename(bmp_names[BACKDROP_BMP], bmpdir, + bool loaded = false; + size_t buf_size; +#if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) + if (curr_screen == SCREEN_REMOTE) + buf_size = LCD_REMOTE_FBHEIGHT * LCD_REMOTE_FBWIDTH * sizeof(fb_remote_data); + else +#endif + buf_size = LCD_FBHEIGHT * LCD_FBWIDTH * sizeof(fb_data); + char *buffer = skin_buffer_alloc(buf_size); + if (!buffer) + return false; + get_image_filename(wps_data->backdrop, bmpdir, img_path, sizeof(img_path)); - screens[curr_screen].backdrop_load(BACKDROP_SKIN_WPS, img_path); + if (!(loaded = screens[curr_screen].backdrop_load(img_path, buffer))) + { + /* try in /.rockbox/backdrops/ instead of .rockbox/wps/ */ + get_image_filename(wps_data->backdrop, BACKDROP_DIR, + img_path, sizeof(img_path)); + loaded = screens[curr_screen].backdrop_load(img_path, buffer); + } + wps_data->backdrop = loaded ? buffer : NULL; } #endif /* has backdrop support */ @@ -2059,7 +2075,18 @@ if (!isfile) { - return wps_parse(wps_data, buf, false); + if (wps_parse(wps_data, buf, false)) + { +#ifdef HAVE_LCD_BITMAP + /* load the backdrop */ + if (!load_skin_bitmaps(wps_data, BACKDROP_DIR)) { + skin_data_reset(wps_data); + return false; + } +#endif + return true; + } + return false; } else { @@ -2093,11 +2120,6 @@ if (start <= 0) return false; -#ifdef HAVE_LCD_BITMAP - /* Set all filename pointers to NULL */ - memset(bmp_names, 0, sizeof(bmp_names)); -#endif - /* parse the WPS source */ if (!wps_parse(wps_data, wps_buffer, true)) { skin_data_reset(wps_data); Index: apps/gui/skin_engine/skin_display.c =================================================================== --- apps/gui/skin_engine/skin_display.c (revision 24254) +++ apps/gui/skin_engine/skin_display.c (working copy) @@ -1011,6 +1011,8 @@ { struct skin_line *line; struct skin_viewport *skin_viewport = find_viewport(VP_DEFAULT_LABEL, data); + + display->backdrop_show(data->backdrop); if (!(skin_viewport->hidden_flags & VP_NEVER_VISIBLE)) { Index: apps/gui/skin_engine/skin_buffer.c =================================================================== --- apps/gui/skin_engine/skin_buffer.c (revision 24254) +++ apps/gui/skin_engine/skin_buffer.c (working copy) @@ -27,6 +27,7 @@ #include "buffer.h" #include "settings.h" #include "screen_access.h" +#include "skin_engine.h" #include "wps_internals.h" #include "skin_tokens.h" #include "skin_buffer.h" @@ -54,12 +55,14 @@ #ifdef HAVE_LCD_BITMAP -#define MAIN_BUFFER ((LCD_HEIGHT*LCD_WIDTH*LCD_DEPTH/8) \ - + (2*LCD_HEIGHT*LCD_WIDTH/8)) +#define MAIN_BUFFER ((LCD_HEIGHT*LCD_WIDTH*LCD_DEPTH/8) \ + + (2*LCD_HEIGHT*LCD_WIDTH/8) \ + + (SKINNABLE_SCREENS_COUNT * LCD_BACKDROP_BYTES)) #if (NB_SCREENS > 1) #define REMOTE_BUFFER ((LCD_REMOTE_HEIGHT*LCD_REMOTE_WIDTH*LCD_REMOTE_DEPTH/8) \ - + (2*LCD_REMOTE_HEIGHT*LCD_REMOTE_WIDTH/8)) + + (2*LCD_REMOTE_HEIGHT*LCD_REMOTE_WIDTH/8) \ + + (SKINNABLE_SCREENS_COUNT * REMOTE_LCD_BACKDROP_BYTES)) #else #define REMOTE_BUFFER 0 #endif Index: apps/gui/skin_engine/wps_internals.h =================================================================== --- apps/gui/skin_engine/wps_internals.h (revision 24254) +++ apps/gui/skin_engine/wps_internals.h (working copy) @@ -271,6 +271,9 @@ struct skin_token_list *images; struct skin_token_list *progressbars; #endif +#if LCD_DEPTH > 1 || defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 + char *backdrop; +#endif #ifdef HAVE_TOUCHSCREEN struct skin_token_list *touchregions; Index: apps/gui/wps.c =================================================================== --- apps/gui/wps.c (revision 24254) +++ apps/gui/wps.c (working copy) @@ -99,8 +99,6 @@ { bool loaded_ok; - screens[screen].backdrop_unload(BACKDROP_SKIN_WPS); - #ifndef __PCTOOL__ /* * Hardcode loading WPS_DEFAULTCFG to cause a reset ideally this @@ -561,7 +559,6 @@ FOR_NB_SCREENS(i) { gui_wps[i].display->stop_scroll(); - gui_wps[i].display->backdrop_show(BACKDROP_MAIN); #ifdef HAVE_LCD_BITMAP bool draw = false; @@ -1180,8 +1177,6 @@ /* we remove the update delay since it's not very usable in the wps, * e.g. during volume changing or ffwd/rewind */ sb_skin_set_update_delay(0); - FOR_NB_SCREENS(i) - gui_wps[i].display->backdrop_show(BACKDROP_SKIN_WPS); wps_sync_data.do_full_update = update = false; gwps_enter_wps(); } @@ -1291,7 +1286,6 @@ /* Currently no seperate wps_state needed/possible so use the only available ( "global" ) one */ gui_wps[i].state = &wps_state; - gui_wps[i].display->backdrop_unload(BACKDROP_SKIN_WPS); /* must point to the same struct for both screens */ gui_wps[i].sync_data = &wps_sync_data; } Index: apps/gui/viewport.c =================================================================== --- apps/gui/viewport.c (revision 24254) +++ apps/gui/viewport.c (working copy) @@ -93,6 +93,9 @@ * could cause a tiny flicker. Redo your screen code if that happens */ if (!was_enabled[screen] || force) { +#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) + screens[screen].backdrop_show(sb_get_backdrop(screen)); +#endif struct viewport deadspace, user; viewport_set_defaults(&user, screen); deadspace = user; /* get colours and everything */ @@ -142,7 +145,10 @@ else { FOR_NB_SCREENS(i) + { screens[i].stop_scroll(); + screens[i].backdrop_show(NULL); + } #if defined(HAVE_LCD_ENABLE) || defined(HAVE_LCD_SLEEP) remove_event(LCD_EVENT_ACTIVATION, do_sbs_update_callback); #endif @@ -185,11 +191,6 @@ int top = theme_stack_top[screen]; return theme_stack[screen][top].enabled; } - -static bool custom_vp_loaded_ok[NB_SCREENS]; -static struct viewport custom_vp[NB_SCREENS]; - -static unsigned viewport_init_ui_vp(void); #endif /* HAVE_LCD_BITMAP */ int viewport_get_nb_lines(const struct viewport *vp) @@ -244,7 +245,6 @@ #endif if (which & THEME_UI_VIEWPORT) { - viewport_init_ui_vp(); } if (which & THEME_LANGUAGE) { @@ -262,34 +262,6 @@ send_event(GUI_EVENT_THEME_CHANGED, NULL); } -/* - * (re)parse the UI vp from the settings - * - Returns - * 0 if no UI vp is used at all - * else the bit for the screen (1<x < b->x + b->width && - a->x + a->width > b->x && - a->y < b->y + b->height && - a->y + a->height > b->y) - { - /* copy from ui vp first (for other field),fix coordinates after */ - *vp = *user_setting; - set_default_align_flags(vp); - vp->x = MAX(a->x, b->x); - vp->y = MAX(a->y, b->y); - vp->width = MIN(a->x + a->width, b->x + b->width) - vp->x; - vp->height = MIN(a->y + a->height, b->y + b->height) - vp->y; - return; - } - /* else (no overlap at all) fall back to info vp from sbs, that - * has no redraw problems */ } - - /* if only one is active use it - * or if the above check for overlapping failed, use info vp then, because - * that doesn't give redraw problems */ + sbs_area = sb_skin_get_info_vp(screen); + if (sbs_area) *vp = *sbs_area; - else if (user_setting) - *vp = *user_setting; - /* have neither so its fullscreen which was fixed at the beginning */ else #endif /* HAVE_LCD_BITMAP */ viewport_set_fullscreen(vp, screen); Index: apps/menus/theme_menu.c =================================================================== --- apps/menus/theme_menu.c (revision 24254) +++ apps/menus/theme_menu.c (working copy) @@ -47,11 +47,7 @@ static int clear_main_backdrop(void) { global_settings.backdrop_file[0]=0; - backdrop_unload(BACKDROP_MAIN); - backdrop_show(BACKDROP_MAIN); - /* force a full redraw so the whole backdrop is cleared */ - viewportmanager_theme_enable(SCREEN_MAIN, false, NULL); - viewportmanager_theme_undo(SCREEN_MAIN, false); + sb_set_backdrop(SCREEN_MAIN, NULL); settings_save(); return 0; } Index: apps/filetree.c =================================================================== --- apps/filetree.c (revision 24254) +++ apps/filetree.c (working copy) @@ -52,7 +52,6 @@ #include "radio.h" #endif #include "wps.h" -#include "backdrop.h" static int compare_sort_dir; /* qsort key for sorting directories */ @@ -503,9 +502,6 @@ /* wps config file */ case FILE_ATTR_WPS: splash(0, ID2P(LANG_WAIT)); -#if LCD_DEPTH > 1 - backdrop_unload(BACKDROP_SKIN_WPS); -#endif set_file(buf, (char *)global_settings.wps_file, MAX_FILENAME); settings_apply_skins(); @@ -515,9 +511,6 @@ /* remote-wps config file */ case FILE_ATTR_RWPS: splash(0, ID2P(LANG_WAIT)); -#if defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1 - remote_backdrop_unload(BACKDROP_SKIN_WPS); -#endif set_file(buf, (char *)global_settings.rwps_file, MAX_FILENAME); settings_apply_skins(); Index: apps/bookmark.c =================================================================== --- apps/bookmark.c (revision 24254) +++ apps/bookmark.c (working copy) @@ -40,7 +40,6 @@ #include "yesno.h" #include "list.h" #include "plugin.h" -#include "backdrop.h" #include "file.h" #include "filefuncs.h" @@ -165,7 +164,6 @@ char* bookmark; if (!system_check()) return false; - int i; audio_pause(); /* first pause playback */ bookmark = create_bookmark(); @@ -193,8 +191,6 @@ str(LANG_CONFIRM_WITH_BUTTON)}; const struct text_message message={lines, 2}; #endif - FOR_NB_SCREENS(i) - screens[i].backdrop_show(BACKDROP_MAIN); if(gui_syncyesno_run(&message, NULL, NULL)==YESNO_YES) {