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
This commit is contained in:
Thomas Martitz 2011-11-08 21:39:28 +00:00
parent c7b8054714
commit b02c82e105
2 changed files with 6 additions and 1 deletions

View file

@ -189,7 +189,7 @@ static void load_icons(const char* filename, enum Iconset iconset,
enum screen_type screen)
{
int size_read;
int bmpformat = (FORMAT_NATIVE|FORMAT_DITHER);
int bmpformat = (FORMAT_NATIVE|FORMAT_DITHER|FORMAT_TRANSPARENT);
struct iconset *ic = &iconsets[iconset][screen];
int fd;
@ -217,6 +217,9 @@ static void load_icons(const char* filename, enum Iconset iconset,
size_read = read_bmp_fd(fd, &ic->bmp, buf_size, bmpformat, NULL);
ic->handle_locked = 0;
/* free unused alpha channel, if any */
core_shrink(ic->handle, ic->bmp.data, size_read);
if (size_read <= 0)
ic->handle = core_free(ic->handle);
else

View file

@ -1577,6 +1577,8 @@ static int load_skin_bmp(struct wps_data *wps_data, struct bitmap *bitmap, char*
close(fd);
if (ret > 0)
{
/* free unused alpha channel, if any */
core_shrink(handle, core_get_data(handle), ret);
return handle;
}
else