summaryrefslogtreecommitdiff
path: root/apps/gui/skin_engine
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2010-11-04 10:15:33 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2010-11-04 10:15:33 +0000
commit97857324c32f929c396814ba268e39a865a6fa42 (patch)
treeffb911b3fac2e01f95956e540807583b92e65134 /apps/gui/skin_engine
parent72964f2571cce19524c45254d3b71639dd07def3 (diff)
downloadrockbox-97857324c32f929c396814ba268e39a865a6fa42.tar.gz
rockbox-97857324c32f929c396814ba268e39a865a6fa42.zip
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
Diffstat (limited to 'apps/gui/skin_engine')
-rw-r--r--apps/gui/skin_engine/skin_engine.c14
-rw-r--r--apps/gui/skin_engine/skin_parser.c6
2 files changed, 19 insertions, 1 deletions
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 @@
38#include "skin_buffer.h" 38#include "skin_buffer.h"
39#include "statusbar-skinned.h" 39#include "statusbar-skinned.h"
40 40
41static bool skins_initialising = true;
42
43/* Hosted platforms use the host malloc to manage the buffer */
44#if ((CONFIG_PLATFORM&PLATFORM_HOSTED) == 0)
41static char *skin_buffer = NULL; 45static char *skin_buffer = NULL;
42void theme_init_buffer(void) 46void theme_init_buffer(void)
43{ 47{
44 skin_buffer = buffer_alloc(SKIN_BUFFER_SIZE); 48 skin_buffer = buffer_alloc(SKIN_BUFFER_SIZE);
49 skins_initialising = false;
45} 50}
51#else
52#define skin_buffer NULL
53void theme_init_buffer(void)
54{
55 skins_initialising = false;
56}
57#endif
46 58
47void settings_apply_skins(void) 59void settings_apply_skins(void)
48{ 60{
@@ -149,7 +161,7 @@ struct gui_wps *skin_get_gwps(enum skinnable_screens skin, enum screen_type scre
149 { 161 {
150 case CUSTOM_STATUSBAR: 162 case CUSTOM_STATUSBAR:
151#ifdef HAVE_LCD_BITMAP 163#ifdef HAVE_LCD_BITMAP
152 if (skin_buffer == NULL) 164 if (skins_initialising)
153 { 165 {
154 /* still loading, buffers not initialised yet, 166 /* still loading, buffers not initialised yet,
155 * viewport manager calls into the sbs code, not really 167 * 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,
1613 wps_data->backdrop_id = -1; 1613 wps_data->backdrop_id = -1;
1614#endif 1614#endif
1615 /* parse the skin source */ 1615 /* parse the skin source */
1616#if ((CONFIG_PLATFORM&PLATFORM_HOSTED) == 0)
1616 skin_buffer_save_position(); 1617 skin_buffer_save_position();
1618#endif
1617 wps_data->tree = skin_parse(wps_buffer, skin_element_callback, wps_data); 1619 wps_data->tree = skin_parse(wps_buffer, skin_element_callback, wps_data);
1618 if (!wps_data->tree) { 1620 if (!wps_data->tree) {
1619 skin_data_reset(wps_data); 1621 skin_data_reset(wps_data);
1622#if ((CONFIG_PLATFORM&PLATFORM_HOSTED) == 0)
1620 skin_buffer_restore_position(); 1623 skin_buffer_restore_position();
1624#endif
1621 return false; 1625 return false;
1622 } 1626 }
1623 1627
@@ -1639,7 +1643,9 @@ bool skin_data_load(enum screen_type screen, struct wps_data *wps_data,
1639 !skin_load_fonts(wps_data)) 1643 !skin_load_fonts(wps_data))
1640 { 1644 {
1641 skin_data_reset(wps_data); 1645 skin_data_reset(wps_data);
1646#if ((CONFIG_PLATFORM&PLATFORM_HOSTED) == 0)
1642 skin_buffer_restore_position(); 1647 skin_buffer_restore_position();
1648#endif
1643 return false; 1649 return false;
1644 } 1650 }
1645#endif 1651#endif