summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-11-08 21:23:02 +0000
committerThomas Martitz <kugel@rockbox.org>2011-11-08 21:23:02 +0000
commit1afcd74fdd6ce9d6cf3911076418fb0589da7d17 (patch)
treec3fa7dade43bcc3baefc9c791de724d38e57ad35
parent2e0fff9732486e7653406f194e6a45087ba70470 (diff)
downloadrockbox-1afcd74fdd6ce9d6cf3911076418fb0589da7d17.tar.gz
rockbox-1afcd74fdd6ce9d6cf3911076418fb0589da7d17.zip
Simplify icon.c a bit.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30934 a1c6a512-1295-4272-9138-f99709370657
-rw-r--r--apps/gui/icon.c31
1 files changed, 16 insertions, 15 deletions
diff --git a/apps/gui/icon.c b/apps/gui/icon.c
index 284e1979a0..c171da5b44 100644
--- a/apps/gui/icon.c
+++ b/apps/gui/icon.c
@@ -176,19 +176,19 @@ void screen_put_cursorxy(struct screen * display, int x, int y, bool on)
static int buflib_move_callback(int handle, void* current, void* new)
{
- (void)current;
+ (void)handle;
(void)new;
int i;
FOR_NB_SCREENS(j)
{
for (i=0; i<Iconset_Count; i++)
{
- if (iconsets[i][j].handle == handle)
+ struct iconset *set = &iconsets[i][j];
+ if (set->bmp.data == current)
{
- if (iconsets[i][j].handle_locked > 0)
+ if (set->handle_locked > 0)
return BUFLIB_CB_CANNOT_MOVE;
- ptrdiff_t diff = new - current;
- iconsets[i][j].bmp.data += diff;
+ set->bmp.data = new;
return BUFLIB_CB_OK;
}
}
@@ -223,17 +223,16 @@ static void load_icons(const char* filename, enum Iconset iconset,
return;
}
lseek(fd, 0, SEEK_SET);
- ic->handle_locked = 1;
ic->bmp.data = core_get_data(ic->handle);
+ ic->handle_locked = 1;
size_read = read_bmp_fd(fd, &ic->bmp, buf_size, bmpformat, NULL);
- if (size_read <= 0)
- {
- core_free(ic->handle);
- return;
- }
ic->handle_locked = 0;
- ic->loaded = true;
+
+ if (size_read <= 0)
+ ic->handle = core_free(ic->handle);
+ else
+ ic->loaded = true;
}
}
@@ -244,13 +243,15 @@ void icons_init(void)
{
for (i=0; i<Iconset_Count; i++)
{
- if (iconsets[i][j].loaded && iconsets[i][j].handle > 0)
+ struct iconset* set = &iconsets[i][j];
+ if (set->loaded && set->handle > 0)
{
- core_free(iconsets[i][j].handle);
- iconsets[i][j].loaded = false;
+ set->handle = core_free(set->handle);
+ set->loaded = false;
}
}
}
+
load_icons(global_settings.icon_file, Iconset_user, SCREEN_MAIN);
if (global_settings.viewers_icon_file[0] &&