diff options
author | Thomas Martitz <kugel@rockbox.org> | 2010-02-21 19:29:33 +0000 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2010-02-21 19:29:33 +0000 |
commit | a31624e76e45230aa9f94b16709f86e0042bad91 (patch) | |
tree | 769c368493e01c8ad6beb58f8f4843d572bf77bc | |
parent | d401d7bc5528360130746e4511e03068821cc3af (diff) | |
download | rockbox-a31624e76e45230aa9f94b16709f86e0042bad91.tar.gz rockbox-a31624e76e45230aa9f94b16709f86e0042bad91.zip |
Fix the mechanism to fail to parse skins if images fail to load and fix having no backdrop at all (neither %X nor backdrop setting, DancePuffDuo was broken).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@24814 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r-- | apps/gui/skin_engine/skin_backdrops.c | 5 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_parser.c | 17 |
2 files changed, 14 insertions, 8 deletions
diff --git a/apps/gui/skin_engine/skin_backdrops.c b/apps/gui/skin_engine/skin_backdrops.c index b057935241..0a89553cd8 100644 --- a/apps/gui/skin_engine/skin_backdrops.c +++ b/apps/gui/skin_engine/skin_backdrops.c | |||
@@ -62,7 +62,7 @@ char* skin_backdrop_load(char* backdrop, char *bmpdir, enum screen_type screen) | |||
62 | else | 62 | else |
63 | #endif | 63 | #endif |
64 | buf_size = LCD_BACKDROP_BYTES; | 64 | buf_size = LCD_BACKDROP_BYTES; |
65 | 65 | ||
66 | if (backdrop[0] == '-') | 66 | if (backdrop[0] == '-') |
67 | { | 67 | { |
68 | #if NB_SCREENS > 1 | 68 | #if NB_SCREENS > 1 |
@@ -73,7 +73,8 @@ char* skin_backdrop_load(char* backdrop, char *bmpdir, enum screen_type screen) | |||
73 | else | 73 | else |
74 | #endif | 74 | #endif |
75 | { | 75 | { |
76 | if (!global_settings.backdrop_file[0]) | 76 | char settings_bdrop = global_settings.backdrop_file[0]; |
77 | if (settings_bdrop == '\0' || settings_bdrop == '-') | ||
77 | { | 78 | { |
78 | return NULL; /* backdrop setting not set */ | 79 | return NULL; /* backdrop setting not set */ |
79 | } | 80 | } |
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 414da44581..4363a293c8 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c | |||
@@ -1986,7 +1986,6 @@ static void skin_data_reset(struct wps_data *wps_data) | |||
1986 | static bool load_skin_bmp(struct wps_data *wps_data, struct bitmap *bitmap, char* bmpdir) | 1986 | static bool load_skin_bmp(struct wps_data *wps_data, struct bitmap *bitmap, char* bmpdir) |
1987 | { | 1987 | { |
1988 | (void)wps_data; /* only needed for remote targets */ | 1988 | (void)wps_data; /* only needed for remote targets */ |
1989 | bool loaded = false; | ||
1990 | char img_path[MAX_PATH]; | 1989 | char img_path[MAX_PATH]; |
1991 | get_image_filename(bitmap->data, bmpdir, | 1990 | get_image_filename(bitmap->data, bmpdir, |
1992 | img_path, sizeof(img_path)); | 1991 | img_path, sizeof(img_path)); |
@@ -2008,19 +2007,19 @@ static bool load_skin_bmp(struct wps_data *wps_data, struct bitmap *bitmap, char | |||
2008 | if (ret > 0) | 2007 | if (ret > 0) |
2009 | { | 2008 | { |
2010 | skin_buffer_increment(ret, true); | 2009 | skin_buffer_increment(ret, true); |
2011 | loaded = true; | 2010 | return true; |
2012 | } | 2011 | } |
2013 | else | 2012 | else |
2014 | { | 2013 | { |
2015 | /* Abort if we can't load an image */ | 2014 | /* Abort if we can't load an image */ |
2016 | loaded = false; | 2015 | return false; |
2017 | } | 2016 | } |
2018 | return loaded; | ||
2019 | } | 2017 | } |
2020 | 2018 | ||
2021 | static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir) | 2019 | static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir) |
2022 | { | 2020 | { |
2023 | struct skin_token_list *list; | 2021 | struct skin_token_list *list; |
2022 | bool retval = true; /* return false if a single image failed to load */ | ||
2024 | /* do the progressbars */ | 2023 | /* do the progressbars */ |
2025 | list = wps_data->progressbars; | 2024 | list = wps_data->progressbars; |
2026 | while (list) | 2025 | while (list) |
@@ -2029,6 +2028,8 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir) | |||
2029 | if (pb->bm.data) | 2028 | if (pb->bm.data) |
2030 | { | 2029 | { |
2031 | pb->have_bitmap_pb = load_skin_bmp(wps_data, &pb->bm, bmpdir); | 2030 | pb->have_bitmap_pb = load_skin_bmp(wps_data, &pb->bm, bmpdir); |
2031 | if (!pb->have_bitmap_pb) /* no success */ | ||
2032 | retval = false; | ||
2032 | } | 2033 | } |
2033 | list = list->next; | 2034 | list = list->next; |
2034 | } | 2035 | } |
@@ -2042,6 +2043,8 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir) | |||
2042 | img->loaded = load_skin_bmp(wps_data, &img->bm, bmpdir); | 2043 | img->loaded = load_skin_bmp(wps_data, &img->bm, bmpdir); |
2043 | if (img->loaded) | 2044 | if (img->loaded) |
2044 | img->subimage_height = img->bm.height / img->num_subimages; | 2045 | img->subimage_height = img->bm.height / img->num_subimages; |
2046 | else | ||
2047 | retval = false; | ||
2045 | } | 2048 | } |
2046 | list = list->next; | 2049 | list = list->next; |
2047 | } | 2050 | } |
@@ -2053,13 +2056,15 @@ static bool load_skin_bitmaps(struct wps_data *wps_data, char *bmpdir) | |||
2053 | */ | 2056 | */ |
2054 | if (wps_data->backdrop) | 2057 | if (wps_data->backdrop) |
2055 | { | 2058 | { |
2059 | bool needed = wps_data->backdrop[0] != '-'; | ||
2056 | wps_data->backdrop = skin_backdrop_load(wps_data->backdrop, | 2060 | wps_data->backdrop = skin_backdrop_load(wps_data->backdrop, |
2057 | bmpdir, curr_screen); | 2061 | bmpdir, curr_screen); |
2062 | if (!wps_data->backdrop && needed) | ||
2063 | retval = false; | ||
2058 | } | 2064 | } |
2059 | #endif /* has backdrop support */ | 2065 | #endif /* has backdrop support */ |
2060 | 2066 | ||
2061 | /* If we got here, everything was OK */ | 2067 | return retval; |
2062 | return true; | ||
2063 | } | 2068 | } |
2064 | 2069 | ||
2065 | #endif /* HAVE_LCD_BITMAP */ | 2070 | #endif /* HAVE_LCD_BITMAP */ |