From 81dedee7d050e2b52dfe1a294dbd349c4fe79155 Mon Sep 17 00:00:00 2001 From: Nicolas Pennequin Date: Mon, 12 Nov 2007 01:31:42 +0000 Subject: Various album art improvements: * Make the album art display tag static instead of dynamic, making it be drawn less often, which is good. * Add the possibility of clearing the album art bitmap instead of drawing it, and use this abaility when the display tag is inside a conditional construct. * Add the album art display tag to wps_debug.c. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@15592 a1c6a512-1295-4272-9138-f99709370657 --- apps/recorder/albumart.c | 25 ++++++++++++++++++------- apps/recorder/albumart.h | 5 +++-- 2 files changed, 21 insertions(+), 9 deletions(-) (limited to 'apps/recorder') diff --git a/apps/recorder/albumart.c b/apps/recorder/albumart.c index abae8c1afc..2722b57f8a 100644 --- a/apps/recorder/albumart.c +++ b/apps/recorder/albumart.c @@ -231,8 +231,9 @@ bool find_albumart(const struct mp3entry *id3, char *buf, int buflen) return search_files(id3, size_string, buf, buflen); } -/* Draw the album art bitmap from the given handle ID onto the given WPS. */ -void draw_album_art(struct gui_wps *gwps, int handle_id) +/* 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. */ +void draw_album_art(struct gui_wps *gwps, int handle_id, bool clear) { if (!gwps || !gwps->data || !gwps->display || handle_id < 0) return; @@ -277,9 +278,19 @@ void draw_album_art(struct gui_wps *gwps, int handle_id) y += (data->albumart_max_height - height) / 2; } - /* Draw the bitmap */ - gwps->display->set_drawmode(DRMODE_FG); - gwps->display->bitmap_part((fb_data*)bmp->data, 0, 0, bmp->width, - x, y, width, height); - gwps->display->set_drawmode(DRMODE_SOLID); + if (!clear) + { + /* Draw the bitmap */ + gwps->display->set_drawmode(DRMODE_FG); + gwps->display->bitmap_part((fb_data*)bmp->data, 0, 0, bmp->width, + x, y, width, height); + gwps->display->set_drawmode(DRMODE_SOLID); + } + else + { + /* Clear the bitmap */ + gwps->display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); + gwps->display->fillrect(x, y, width, height); + gwps->display->set_drawmode(DRMODE_SOLID); + } } diff --git a/apps/recorder/albumart.h b/apps/recorder/albumart.h index 21ae50edb9..dcd106465b 100644 --- a/apps/recorder/albumart.h +++ b/apps/recorder/albumart.h @@ -31,8 +31,9 @@ * Returns true if a bitmap was found, false otherwise */ bool find_albumart(const struct mp3entry *id3, char *buf, int buflen); -/* Draw the album art bitmap from the given handle ID onto the given WPS. */ -void draw_album_art(struct gui_wps *gwps, int handle_id); +/* 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. */ +void draw_album_art(struct gui_wps *gwps, int handle_id, bool clear); #endif /* HAVE_ALBUMART */ -- cgit v1.2.3