From 877d378710337e7b89b015e3901e467fbcff53be Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Tue, 16 Feb 2010 05:24:27 +0000 Subject: Reuse the backdrop buffers if 2 skins use the same backdrop (on the same screen of course) git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24690 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/skin_engine/skin_parser.c | 43 +++----------------------------------- 1 file changed, 3 insertions(+), 40 deletions(-) (limited to 'apps/gui/skin_engine/skin_parser.c') diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 034ff532f0..fe68c7c57e 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -567,7 +567,7 @@ static int get_image_id(int c) return -1; } -static char *get_image_filename(const char *start, const char* bmpdir, +char *get_image_filename(const char *start, const char* bmpdir, char *buf, int buf_size) { const char *end = strchr(start, '|'); @@ -2045,45 +2045,8 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir) */ if (wps_data->backdrop) { - char img_path[MAX_PATH]; - bool loaded = false; - size_t buf_size; -#if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1) - if (curr_screen == SCREEN_REMOTE) - buf_size = REMOTE_LCD_BACKDROP_BYTES; - else -#endif - buf_size = LCD_BACKDROP_BYTES; - if (wps_data->backdrop[0] == '-') - { -#if NB_SCREENS > 1 - if (curr_screen == SCREEN_REMOTE) - { - wps_data->backdrop = NULL; - return true; - } - else -#endif - { - if (!global_settings.backdrop_file[0]) - { - wps_data->backdrop = NULL; - return true; - } - snprintf(img_path, sizeof(img_path), "%s/%s.bmp", - BACKDROP_DIR, global_settings.backdrop_file); - } - } - else - { - get_image_filename(wps_data->backdrop, bmpdir, - img_path, sizeof(img_path)); - } - char *buffer = skin_buffer_alloc(buf_size); - if (!buffer) - return false; - loaded = screens[curr_screen].backdrop_load(img_path, buffer); - wps_data->backdrop = loaded ? buffer : NULL; + wps_data->backdrop = skin_backdrop_load(wps_data->backdrop, + bmpdir, curr_screen); } #endif /* has backdrop support */ -- cgit v1.2.3