diff options
author | William Wilgus <wilgus.william@gmail.com> | 2022-03-15 20:17:11 -0400 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2022-03-15 20:17:11 -0400 |
commit | b3e0d18f7d1edae3f2ad5908b756052f89a09a9a (patch) | |
tree | a1ae39c2b84f2df703ab7d8b64df2aeb68a4f9a8 | |
parent | a5c16d2990ba951832f126f5aa9da0221c68f609 (diff) | |
download | rockbox-b3e0d18f7d.tar.gz rockbox-b3e0d18f7d.zip |
skin_engine.c settings_apply_skins cleanup
just some cleanup and removal of ifdefs in favor of dummy functions
Change-Id: I03a1d351344afcc428dedb67aab915184f99bd23
-rw-r--r-- | apps/gui/skin_engine/skin_backdrops.c | 18 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_engine.c | 33 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_engine.h | 2 | ||||
-rw-r--r-- | apps/gui/statusbar-skinned.c | 7 | ||||
-rw-r--r-- | apps/gui/statusbar-skinned.h | 2 |
5 files changed, 40 insertions, 22 deletions
diff --git a/apps/gui/skin_engine/skin_backdrops.c b/apps/gui/skin_engine/skin_backdrops.c index 41de1e1f76..146dccb18a 100644 --- a/apps/gui/skin_engine/skin_backdrops.c +++ b/apps/gui/skin_engine/skin_backdrops.c @@ -81,8 +81,9 @@ static int buflib_move_callback(int handle, void* current, void* new) } static struct buflib_callbacks buflib_ops = {buflib_move_callback, NULL, NULL}; static bool first_go = true; -void skin_backdrop_init(void) +bool skin_backdrop_init(void) { + bool go_status = first_go; if (first_go) { for (int i=0; i<NB_BDROPS; i++) @@ -98,6 +99,7 @@ void skin_backdrop_init(void) handle_being_loaded = -1; first_go = false; } + return go_status; } int skin_backdrop_assign(char* backdrop, char *bmpdir, @@ -331,8 +333,20 @@ void skin_backdrop_unload(int backdrop_id) (void)backdrop_id; } #else +static bool first_go = true; +bool skin_backdrop_init(void) +{ + bool go_status = first_go; + first_go = false; + return go_status; +} + +void skin_backdrop_load_setting(void) +{ +} -void skin_backdrop_init(void) +void skin_backdrop_show(int backdrop_id) { + (void) backdrop_id; } #endif diff --git a/apps/gui/skin_engine/skin_engine.c b/apps/gui/skin_engine/skin_engine.c index b3626b681d..8ba76e5739 100644 --- a/apps/gui/skin_engine/skin_engine.c +++ b/apps/gui/skin_engine/skin_engine.c @@ -149,16 +149,28 @@ void skin_unload_all(void) gui_sync_skin_init(); } +static void skin_reset_buffers(int item, int screen) +{ + skin_data_free_buflib_allocs(&skins[item][screen].data); +#ifdef HAVE_ALBUMART + if (skins[item][screen].data.playback_aa_slot >= 0) + playback_release_aa_slot(skins[item][screen].data.playback_aa_slot); +#endif +#ifdef HAVE_BACKDROP_IMAGE + if (skins[item][screen].data.backdrop_id >= 0) + skin_backdrop_unload(skins[item][screen].data.backdrop_id); +#endif +} + void settings_apply_skins(void) { int i; char filename[MAX_PATH]; - static bool first_run = true; if (audio_status() & AUDIO_STATUS_PLAY) audio_stop(); - skin_backdrop_init(); + bool first_run = skin_backdrop_init(); skins_initialised = true; /* Make sure each skin is loaded */ @@ -170,15 +182,7 @@ void settings_apply_skins(void) if (!first_run) { - skin_data_free_buflib_allocs(&skins[i][j].data); -#ifdef HAVE_ALBUMART - if (skins[i][j].data.playback_aa_slot >= 0) - playback_release_aa_slot(skins[i][j].data.playback_aa_slot); -#endif -#ifdef HAVE_BACKDROP_IMAGE - if (skins[i][j].data.backdrop_id >= 0) - skin_backdrop_unload(skins[i][j].data.backdrop_id); -#endif + skin_reset_buffers(i, j); } gui_skin_reset(&skins[i][j]); skins[i][j].gui_wps.display = &screens[j]; @@ -186,17 +190,14 @@ void settings_apply_skins(void) skin_get_gwps(i, j); } } - first_run = false; -#ifdef HAVE_BACKDROP_IMAGE + /* any backdrop that was loaded with "-" has to be reloaded because * the setting may have changed */ skin_backdrop_load_setting(); -#endif viewportmanager_theme_changed(THEME_STATUSBAR); -#ifdef HAVE_BACKDROP_IMAGE + FOR_NB_SCREENS(i) skin_backdrop_show(sb_get_backdrop(i)); -#endif } void skin_load(enum skinnable_screens skin, enum screen_type screen, diff --git a/apps/gui/skin_engine/skin_engine.h b/apps/gui/skin_engine/skin_engine.h index 3b757a5f8b..e26ec34d1f 100644 --- a/apps/gui/skin_engine/skin_engine.h +++ b/apps/gui/skin_engine/skin_engine.h @@ -62,7 +62,7 @@ bool skin_has_sbs(enum screen_type screen, struct wps_data *data); /* load a backdrop into the skin buffer. * reuse buffers if the file is already loaded */ char* skin_backdrop_load(char* backdrop, char *bmpdir, enum screen_type screen); -void skin_backdrop_init(void); +bool skin_backdrop_init(void); int skin_backdrop_assign(char* backdrop, char *bmpdir, enum screen_type screen); bool skin_backdrops_preload(void); diff --git a/apps/gui/statusbar-skinned.c b/apps/gui/statusbar-skinned.c index 63f3197faa..fd695bf6b6 100644 --- a/apps/gui/statusbar-skinned.c +++ b/apps/gui/statusbar-skinned.c @@ -156,7 +156,12 @@ int sb_get_backdrop(enum screen_type screen) else return -1; } - +#else +int sb_get_backdrop(enum screen_type screen) +{ + (void) screen; + return -1; +} #endif static bool force_waiting = false; void sb_skin_update(enum screen_type screen, bool force) diff --git a/apps/gui/statusbar-skinned.h b/apps/gui/statusbar-skinned.h index ad102bef47..3ed36f1a84 100644 --- a/apps/gui/statusbar-skinned.h +++ b/apps/gui/statusbar-skinned.h @@ -49,9 +49,7 @@ void sb_bypass_touchregions(bool enable); int sb_touch_to_button(int context); #endif -#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) int sb_get_backdrop(enum screen_type screen); -#endif int sb_preproccess(enum screen_type screen, struct wps_data *data); int sb_postproccess(enum screen_type screen, struct wps_data *data); |