From 97857324c32f929c396814ba268e39a865a6fa42 Mon Sep 17 00:00:00 2001 From: Jonathan Gordon Date: Thu, 4 Nov 2010 10:15:33 +0000 Subject: RaaA: Use the host's malloc() for the skin engine. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28480 a1c6a512-1295-4272-9138-f99709370657 --- apps/gui/skin_engine/skin_engine.c | 14 +++++++++++++- apps/gui/skin_engine/skin_parser.c | 6 ++++++ 2 files changed, 19 insertions(+), 1 deletion(-) (limited to 'apps/gui/skin_engine') diff --git a/apps/gui/skin_engine/skin_engine.c b/apps/gui/skin_engine/skin_engine.c index 8bf165812a..960bbdb313 100644 --- a/apps/gui/skin_engine/skin_engine.c +++ b/apps/gui/skin_engine/skin_engine.c @@ -38,11 +38,23 @@ #include "skin_buffer.h" #include "statusbar-skinned.h" +static bool skins_initialising = true; + +/* Hosted platforms use the host malloc to manage the buffer */ +#if ((CONFIG_PLATFORM&PLATFORM_HOSTED) == 0) static char *skin_buffer = NULL; void theme_init_buffer(void) { skin_buffer = buffer_alloc(SKIN_BUFFER_SIZE); + skins_initialising = false; } +#else +#define skin_buffer NULL +void theme_init_buffer(void) +{ + skins_initialising = false; +} +#endif void settings_apply_skins(void) { @@ -149,7 +161,7 @@ struct gui_wps *skin_get_gwps(enum skinnable_screens skin, enum screen_type scre { case CUSTOM_STATUSBAR: #ifdef HAVE_LCD_BITMAP - if (skin_buffer == NULL) + if (skins_initialising) { /* still loading, buffers not initialised yet, * viewport manager calls into the sbs code, not really diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c index 43c2ffa304..c0ea3e3ca9 100644 --- a/apps/gui/skin_engine/skin_parser.c +++ b/apps/gui/skin_engine/skin_parser.c @@ -1613,11 +1613,15 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data, wps_data->backdrop_id = -1; #endif /* parse the skin source */ +#if ((CONFIG_PLATFORM&PLATFORM_HOSTED) == 0) skin_buffer_save_position(); +#endif wps_data->tree = skin_parse(wps_buffer, skin_element_callback, wps_data); if (!wps_data->tree) { skin_data_reset(wps_data); +#if ((CONFIG_PLATFORM&PLATFORM_HOSTED) == 0) skin_buffer_restore_position(); +#endif return false; } @@ -1639,7 +1643,9 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data, !skin_load_fonts(wps_data)) { skin_data_reset(wps_data); +#if ((CONFIG_PLATFORM&PLATFORM_HOSTED) == 0) skin_buffer_restore_position(); +#endif return false; } #endif -- cgit v1.2.3