summaryrefslogtreecommitdiffstats
path: root/apps/gui/skin_engine/skin_engine.c
diff options
context:
space:
mode:
authorJonathan Gordon <rockbox@jdgordon.info>2011-09-25 12:55:40 +0000
committerJonathan Gordon <rockbox@jdgordon.info>2011-09-25 12:55:40 +0000
commitf7c2978cc46c4e704fa5ca04910cd6865d3720af (patch)
tree1b4fa13c6b60f500731e334f0631d3fe12fdc45a /apps/gui/skin_engine/skin_engine.c
parent93e748ac840da04b72f7ad02d4937f9ef09e4cb3 (diff)
downloadrockbox-f7c2978cc46c4e704fa5ca04910cd6865d3720af.tar.gz
rockbox-f7c2978cc46c4e704fa5ca04910cd6865d3720af.zip
Check for the magic file "/.rockbox/skin_buffer_size.txt" on bootup which can have a number which is the amount of kilobytes to allocate for the skin buffer. This is only checked on boot so if you need to change it you must reboot to enable.
Currently the default size is 80KB on colour targets which can be way too much or not enough for users. The format of the /.rockbox/skin_buffer_size.txt file is simply a number (so 120 if you want 120 kilobytes), NO trainling spaces or text of any kind git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30599 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui/skin_engine/skin_engine.c')
-rw-r--r--apps/gui/skin_engine/skin_engine.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/apps/gui/skin_engine/skin_engine.c b/apps/gui/skin_engine/skin_engine.c
index 069c3467a9..0d86cc289f 100644
--- a/apps/gui/skin_engine/skin_engine.c
+++ b/apps/gui/skin_engine/skin_engine.c
@@ -25,6 +25,7 @@
#include <limits.h>
#include "inttypes.h"
#include "config.h"
+#include "core_alloc.h"
#include "action.h"
#include "crc32.h"
#include "settings.h"
@@ -48,9 +49,31 @@ void theme_init_buffer(void)
skins_initialising = false;
}
#else
-static char skin_buffer[SKIN_BUFFER_SIZE];
+static size_t skin_buffer_size;
+static char *skin_buffer = NULL;
+static int buflib_move_callback(int handle, void* current, void* new)
+{
+ (void)current;
+ (void)new;
+ return BUFLIB_CB_CANNOT_MOVE;
+}
+static struct buflib_callbacks buflib_ops = {buflib_move_callback, NULL};
+
void theme_init_buffer(void)
{
+ int fd;
+ size_t size = SKIN_BUFFER_SIZE;
+ fd = open_utf8(ROCKBOX_DIR "/skin_buffer_size.txt", O_RDONLY);
+ if (fd >= 0)
+ {
+ char buf[32];
+ read(fd, buf, sizeof(buf));
+ if (buf[0] >= '0' && buf[0] <= '9')
+ size = atoi(buf)*1024;
+ close(fd);
+ }
+ skin_buffer = core_get_data(core_alloc_ex("skin buffer", size, &buflib_ops));
+ skin_buffer_size = size;
skins_initialising = false;
}
#endif
@@ -113,7 +136,7 @@ void settings_apply_skins(void)
skin_data_free_buflib_allocs(&skins[j][i].data);
}
- skin_buffer_init(skin_buffer, SKIN_BUFFER_SIZE);
+ skin_buffer_init(skin_buffer, skin_buffer_size);
#ifdef HAVE_LCD_BITMAP
skin_backdrop_init();