summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/bitmap/list.c2
-rw-r--r--apps/gui/skin_engine/skin_backdrops.c19
-rw-r--r--apps/gui/skin_engine/skin_engine.c16
-rw-r--r--apps/gui/skin_engine/skin_engine.h2
-rw-r--r--apps/gui/skin_engine/skin_parser.c12
-rw-r--r--apps/gui/skin_engine/wps_internals.h11
6 files changed, 56 insertions, 6 deletions
diff --git a/apps/gui/bitmap/list.c b/apps/gui/bitmap/list.c
index 191446e186..ede0de8881 100644
--- a/apps/gui/bitmap/list.c
+++ b/apps/gui/bitmap/list.c
@@ -277,6 +277,7 @@ void list_draw(struct screen *display, struct gui_synclist *list)
277 list_icons.x += indent; 277 list_icons.x += indent;
278 list_text_vp->x += indent; 278 list_text_vp->x += indent;
279 } 279 }
280 list_icons.width -= indent;
280 list_text_vp->width -= indent; 281 list_text_vp->width -= indent;
281 } 282 }
282 283
@@ -392,6 +393,7 @@ void list_draw(struct screen *display, struct gui_synclist *list)
392 list_icons.x -= indent; 393 list_icons.x -= indent;
393 list_text_vp->x -= indent; 394 list_text_vp->x -= indent;
394 } 395 }
396 list_icons.width += indent;
395 list_text_vp->width += indent; 397 list_text_vp->width += indent;
396 } 398 }
397 } 399 }
diff --git a/apps/gui/skin_engine/skin_backdrops.c b/apps/gui/skin_engine/skin_backdrops.c
index 0d3c8b605f..4d0345c21d 100644
--- a/apps/gui/skin_engine/skin_backdrops.c
+++ b/apps/gui/skin_engine/skin_backdrops.c
@@ -44,6 +44,25 @@ static struct skin_backdrop {
44static int handle_being_loaded; 44static int handle_being_loaded;
45static int current_lcd_backdrop[NB_SCREENS]; 45static int current_lcd_backdrop[NB_SCREENS];
46 46
47bool skin_backdrop_get_debug(int index, char **path, int *ref_count, size_t *size)
48{
49
50 if (index + 1 >= NB_BDROPS)
51 return false;
52
53 *path = backdrops[index].name;
54 *ref_count = backdrops[index].ref_count;
55
56#if defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)
57 enum screen_type screen = backdrops[index].screen;
58 if (screen == SCREEN_REMOTE)
59 *size = REMOTE_LCD_BACKDROP_BYTES;
60 else
61#endif
62 *size = LCD_BACKDROP_BYTES;
63 return true;
64}
65
47static int buflib_move_callback(int handle, void* current, void* new) 66static int buflib_move_callback(int handle, void* current, void* new)
48{ 67{
49 if (handle == handle_being_loaded) 68 if (handle == handle_being_loaded)
diff --git a/apps/gui/skin_engine/skin_engine.c b/apps/gui/skin_engine/skin_engine.c
index 3c3f3221b4..4c113e5c68 100644
--- a/apps/gui/skin_engine/skin_engine.c
+++ b/apps/gui/skin_engine/skin_engine.c
@@ -65,11 +65,21 @@ static struct gui_skin_helper {
65static struct gui_skin { 65static struct gui_skin {
66 struct gui_wps gui_wps; 66 struct gui_wps gui_wps;
67 struct wps_data data; 67 struct wps_data data;
68 struct skin_stats stats;
68 bool failsafe_loaded; 69 bool failsafe_loaded;
69 70
70 bool needs_full_update; 71 bool needs_full_update;
71} skins[SKINNABLE_SCREENS_COUNT][NB_SCREENS]; 72} skins[SKINNABLE_SCREENS_COUNT][NB_SCREENS];
72 73
74int skin_get_num_skins(void)
75{
76 return SKINNABLE_SCREENS_COUNT;
77}
78
79struct skin_stats *skin_get_stats(int number, int screen)
80{
81 return &skins[number][screen].stats;
82}
73 83
74static void gui_skin_reset(struct gui_skin *skin) 84static void gui_skin_reset(struct gui_skin *skin)
75{ 85{
@@ -167,12 +177,14 @@ void skin_load(enum skinnable_screens skin, enum screen_type screen,
167 skin_helpers[skin].preproccess(screen, &skins[skin][screen].data); 177 skin_helpers[skin].preproccess(screen, &skins[skin][screen].data);
168 178
169 if (buf && *buf) 179 if (buf && *buf)
170 loaded = skin_data_load(screen, &skins[skin][screen].data, buf, isfile); 180 loaded = skin_data_load(screen, &skins[skin][screen].data, buf, isfile,
181 &skins[skin][screen].stats);
171 182
172 if (!loaded && skin_helpers[skin].default_skin) 183 if (!loaded && skin_helpers[skin].default_skin)
173 { 184 {
174 loaded = skin_data_load(screen, &skins[skin][screen].data, 185 loaded = skin_data_load(screen, &skins[skin][screen].data,
175 skin_helpers[skin].default_skin(screen), false); 186 skin_helpers[skin].default_skin(screen), false,
187 &skins[skin][screen].stats);
176 skins[skin][screen].failsafe_loaded = loaded; 188 skins[skin][screen].failsafe_loaded = loaded;
177 } 189 }
178 190
diff --git a/apps/gui/skin_engine/skin_engine.h b/apps/gui/skin_engine/skin_engine.h
index 07fafe6a10..59e00b5176 100644
--- a/apps/gui/skin_engine/skin_engine.h
+++ b/apps/gui/skin_engine/skin_engine.h
@@ -57,7 +57,7 @@ void skin_update(enum skinnable_screens skin, enum screen_type screen,
57 * or from a skinfile (isfile = true) 57 * or from a skinfile (isfile = true)
58 */ 58 */
59bool skin_data_load(enum screen_type screen, struct wps_data *wps_data, 59bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
60 const char *buf, bool isfile); 60 const char *buf, bool isfile, struct skin_stats *stats);
61 61
62bool skin_has_sbs(enum screen_type screen, struct wps_data *data); 62bool skin_has_sbs(enum screen_type screen, struct wps_data *data);
63 63
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index adfda54335..cb185d88ba 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -83,6 +83,7 @@ static char* skin_buffer = NULL;
83#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) 83#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
84static char *backdrop_filename; 84static char *backdrop_filename;
85#endif 85#endif
86static struct skin_stats *_stats = NULL;
86 87
87static bool isdefault(struct skin_tag_parameter *param) 88static bool isdefault(struct skin_tag_parameter *param)
88{ 89{
@@ -1770,6 +1771,8 @@ static int load_skin_bmp(struct wps_data *wps_data, struct bitmap *bitmap, char*
1770 close(fd); 1771 close(fd);
1771 return handle; 1772 return handle;
1772 } 1773 }
1774 _stats->buflib_handles++;
1775 _stats->images_size += buf_size;
1773 lseek(fd, 0, SEEK_SET); 1776 lseek(fd, 0, SEEK_SET);
1774 lock_handle(handle); 1777 lock_handle(handle);
1775 bitmap->data = core_get_data(handle); 1778 bitmap->data = core_get_data(handle);
@@ -2282,7 +2285,7 @@ static int skin_element_callback(struct skin_element* element, void* data)
2282/* to setup up the wps-data from a format-buffer (isfile = false) 2285/* to setup up the wps-data from a format-buffer (isfile = false)
2283 from a (wps-)file (isfile = true)*/ 2286 from a (wps-)file (isfile = true)*/
2284bool skin_data_load(enum screen_type screen, struct wps_data *wps_data, 2287bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
2285 const char *buf, bool isfile) 2288 const char *buf, bool isfile, struct skin_stats *stats)
2286{ 2289{
2287 char *wps_buffer = NULL; 2290 char *wps_buffer = NULL;
2288 if (!wps_data || !buf) 2291 if (!wps_data || !buf)
@@ -2315,8 +2318,9 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
2315 } 2318 }
2316#endif 2319#endif
2317 2320
2318 2321 _stats = stats;
2319 /* get buffer space from the plugin buffer */ 2322 skin_clear_stats(stats);
2323 /* get buffer space from the plugin buffer */
2320 size_t buffersize = 0; 2324 size_t buffersize = 0;
2321 wps_buffer = (char *)plugin_get_buffer(&buffersize); 2325 wps_buffer = (char *)plugin_get_buffer(&buffersize);
2322 2326
@@ -2426,6 +2430,8 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
2426 wps_data->wps_loaded = true; 2430 wps_data->wps_loaded = true;
2427 memcpy(core_get_data(wps_data->buflib_handle), skin_buffer, 2431 memcpy(core_get_data(wps_data->buflib_handle), skin_buffer,
2428 skin_buffer_usage()); 2432 skin_buffer_usage());
2433 stats->buflib_handles++;
2434 stats->tree_size = skin_buffer_usage();
2429 } 2435 }
2430#else 2436#else
2431 wps_data->wps_loaded = wps_data->tree >= 0; 2437 wps_data->wps_loaded = wps_data->tree >= 0;
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index 72bab9b668..c9d5429484 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -31,6 +31,17 @@
31#include "core_alloc.h" 31#include "core_alloc.h"
32#endif 32#endif
33 33
34struct skin_stats {
35 size_t buflib_handles;
36 size_t tree_size;
37 size_t images_size;
38};
39
40int skin_get_num_skins(void);
41struct skin_stats *skin_get_stats(int number, int screen);
42#define skin_clear_stats(stats) memset(stats, 0, sizeof(struct skin_stats))
43bool skin_backdrop_get_debug(int index, char **path, int *ref_count, size_t *size);
44
34/* Timeout unit expressed in HZ. In WPS, all timeouts are given in seconds 45/* Timeout unit expressed in HZ. In WPS, all timeouts are given in seconds
35 (possibly with a decimal fraction) but stored as integer values. 46 (possibly with a decimal fraction) but stored as integer values.
36 E.g. 2.5 is stored as 25. This means 25 tenth of a second, i.e. 25 units. 47 E.g. 2.5 is stored as 25. This means 25 tenth of a second, i.e. 25 units.