summaryrefslogtreecommitdiff
path: root/apps
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
parent72964f2571cce19524c45254d3b71639dd07def3 (diff)
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')
-rw-r--r--apps/gui/skin_engine/skin_engine.c14
-rw-r--r--apps/gui/skin_engine/skin_parser.c6
-rw-r--r--apps/menus/main_menu.c8
3 files changed, 27 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 @@
#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
diff --git a/apps/menus/main_menu.c b/apps/menus/main_menu.c
index 1d22dba7ea..98f664eda6 100644
--- a/apps/menus/main_menu.c
+++ b/apps/menus/main_menu.c
@@ -147,7 +147,9 @@ enum infoscreenorder
INFO_DISK1, /* capacity or internal capacity/free on hotswap */
INFO_DISK2, /* free space or external capacity/free on hotswap */
INFO_BUFFER,
+#if ((CONFIG_PLATFORM&PLATFORM_HOSTED) == 0)
INFO_SKIN_USAGE, /* ram usage of the skins */
+#endif
INFO_VERSION,
INFO_COUNT
};
@@ -157,7 +159,9 @@ static const char* info_getname(int selected_item, void *data,
{
struct info_data *info = (struct info_data*)data;
char s1[32];
+#if defined(HAVE_MULTIVOLUME) || ((CONFIG_PLATFORM&PLATFORM_HOSTED) == 0)
char s2[32];
+#endif
if (info->new_data)
{
fat_size(IF_MV2(0,) &info->size, &info->free);
@@ -242,12 +246,14 @@ static const char* info_getname(int selected_item, void *data,
snprintf(buffer, buffer_len, SIZE_FMT, str(LANG_DISK_SIZE_INFO), s1);
#endif
break;
+#if ((CONFIG_PLATFORM&PLATFORM_HOSTED) == 0)
case INFO_SKIN_USAGE:
output_dyn_value(s1, sizeof s1, skin_buffer_usage(), byte_units, true);
output_dyn_value(s2, sizeof s2, skin_buffer_usage()
+skin_buffer_freespace(), byte_units, true);
snprintf(buffer, buffer_len, "%s %s / %s", str(LANG_SKIN_RAM_USAGE), s1, s2);
break;
+#endif
}
return buffer;
}
@@ -328,10 +334,12 @@ static int info_speak_item(int selected_item, void * data)
output_dyn_value(NULL, 0, info->size, kbyte_units, true);
#endif
break;
+#if ((CONFIG_PLATFORM&PLATFORM_HOSTED) == 0)
case INFO_SKIN_USAGE:
talk_id(LANG_SKIN_RAM_USAGE, false);
output_dyn_value(NULL, 0, skin_buffer_usage(), byte_units, true);
break;
+#endif
}
return 0;