summaryrefslogtreecommitdiff
path: root/apps/gui
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2011-11-08 21:39:28 +0000
committerThomas Martitz <kugel@rockbox.org>2011-11-08 21:39:28 +0000
commitb02c82e10529f2750103e31285500e927ec37a7c (patch)
tree642e2fabdc43391881c3762486e6090b72af35cf /apps/gui
parentc7b8054714cff4580ddbdbf5c9d503b20ff45740 (diff)
downloadrockbox-b02c82e10529f2750103e31285500e927ec37a7c.tar.gz
rockbox-b02c82e10529f2750103e31285500e927ec37a7c.zip
Adapt icon and skin engine to make use of the new 32bit bitmap capabilities.
You can now use 32bit icons in lists and skins (except album art, but can be added if wanted). The code also shows how to free the unused alpha channel data if the bitmap doesn't actually contain such information. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30939 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/gui')
-rw-r--r--apps/gui/icon.c5
-rw-r--r--apps/gui/skin_engine/skin_parser.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/apps/gui/icon.c b/apps/gui/icon.c
index 4c006f947a..d24d8bb677 100644
--- a/apps/gui/icon.c
+++ b/apps/gui/icon.c
@@ -189,7 +189,7 @@ static void load_icons(const char* filename, enum Iconset iconset,
189 enum screen_type screen) 189 enum screen_type screen)
190{ 190{
191 int size_read; 191 int size_read;
192 int bmpformat = (FORMAT_NATIVE|FORMAT_DITHER); 192 int bmpformat = (FORMAT_NATIVE|FORMAT_DITHER|FORMAT_TRANSPARENT);
193 struct iconset *ic = &iconsets[iconset][screen]; 193 struct iconset *ic = &iconsets[iconset][screen];
194 int fd; 194 int fd;
195 195
@@ -217,6 +217,9 @@ static void load_icons(const char* filename, enum Iconset iconset,
217 size_read = read_bmp_fd(fd, &ic->bmp, buf_size, bmpformat, NULL); 217 size_read = read_bmp_fd(fd, &ic->bmp, buf_size, bmpformat, NULL);
218 ic->handle_locked = 0; 218 ic->handle_locked = 0;
219 219
220 /* free unused alpha channel, if any */
221 core_shrink(ic->handle, ic->bmp.data, size_read);
222
220 if (size_read <= 0) 223 if (size_read <= 0)
221 ic->handle = core_free(ic->handle); 224 ic->handle = core_free(ic->handle);
222 else 225 else
diff --git a/apps/gui/skin_engine/skin_parser.c b/apps/gui/skin_engine/skin_parser.c
index d207a1fb3e..8eef1dedee 100644
--- a/apps/gui/skin_engine/skin_parser.c
+++ b/apps/gui/skin_engine/skin_parser.c
@@ -1577,6 +1577,8 @@ static int load_skin_bmp(struct wps_data *wps_data, struct bitmap *bitmap, char*
1577 close(fd); 1577 close(fd);
1578 if (ret > 0) 1578 if (ret > 0)
1579 { 1579 {
1580 /* free unused alpha channel, if any */
1581 core_shrink(handle, core_get_data(handle), ret);
1580 return handle; 1582 return handle;
1581 } 1583 }
1582 else 1584 else