From e9c10189e93fe53cff74ae8fa15d19b1c522d5e4 Mon Sep 17 00:00:00 2001 From: Thomas Martitz Date: Fri, 16 Oct 2009 19:14:41 +0000 Subject: Rework albumart buffering internally to allow for mutliple albumart sizes. Playback now has a few albumart slots. Anything (most importantly: skins) can obtain such a slot. The slot has fields for the size which is passed to bufopen then to image_load to buffer the albumart with the proper size. Currently there's 1 slot. We can increase it for remotes if we want. Custom statusbar will increase it. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@23209 a1c6a512-1295-4272-9138-f99709370657 --- apps/recorder/albumart.c | 23 +++-------------------- apps/recorder/albumart.h | 4 +++- 2 files changed, 6 insertions(+), 21 deletions(-) (limited to 'apps/recorder') diff --git a/apps/recorder/albumart.c b/apps/recorder/albumart.c index bb2fae4af7..b668bf4eba 100644 --- a/apps/recorder/albumart.c +++ b/apps/recorder/albumart.c @@ -274,22 +274,18 @@ bool search_albumart_files(const struct mp3entry *id3, const char *size_string, /* Look for albumart bitmap in the same dir as the track and in its parent dir. * Stores the found filename in the buf parameter. * Returns true if a bitmap was found, false otherwise */ -bool find_albumart(const struct mp3entry *id3, char *buf, int buflen) +bool find_albumart(const struct mp3entry *id3, char *buf, int buflen, + struct dim *dim) { if (!id3 || !buf) return false; char size_string[9]; - int width = 0, height = 0; - - if (!wps_uses_albumart(&width, &height)) - return false; - logf("Looking for album art for %s", id3->path); /* Write the size string, e.g. ".100x100". */ snprintf(size_string, sizeof(size_string), ".%dx%d", - width, height); + dim->width, dim->height); /* First we look for a bitmap of the right size */ if (search_albumart_files(id3, size_string, buf, buflen)) @@ -376,17 +372,4 @@ void draw_album_art(struct gui_wps *gwps, int handle_id, bool clear) } } -void get_albumart_size(struct bitmap *bmp) -{ - /* FIXME: What should we do with albumart on remote? */ - int width, height; - - if (!wps_uses_albumart(&width, &height)) - { - width = 0; height = 0; - } - - bmp->width = width; - bmp->height = height; -} #endif /* PLUGIN */ diff --git a/apps/recorder/albumart.h b/apps/recorder/albumart.h index d1c2dfa7bd..51f456d175 100644 --- a/apps/recorder/albumart.h +++ b/apps/recorder/albumart.h @@ -29,9 +29,11 @@ #include "skin_engine/skin_engine.h" /* Look for albumart bitmap in the same dir as the track and in its parent dir. + * Calls size_func to get the dimensions to look for * Stores the found filename in the buf parameter. * Returns true if a bitmap was found, false otherwise */ -bool find_albumart(const struct mp3entry *id3, char *buf, int buflen); +bool find_albumart(const struct mp3entry *id3, char *buf, int buflen, + struct dim *dim); /* Draw the album art bitmap from the given handle ID onto the given WPS. Call with clear = true to clear the bitmap instead of drawing it. */ -- cgit v1.2.3