forked from len0rd/rockbox
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
This commit is contained in:
parent
4963925767
commit
81dedee7d0
6 changed files with 43 additions and 11 deletions
|
|
@ -932,7 +932,7 @@ static char *get_token_value(struct gui_wps *gwps,
|
||||||
|
|
||||||
#ifdef HAVE_ALBUMART
|
#ifdef HAVE_ALBUMART
|
||||||
case WPS_TOKEN_ALBUMART_DISPLAY:
|
case WPS_TOKEN_ALBUMART_DISPLAY:
|
||||||
draw_album_art(gwps, audio_current_aa_hid());
|
draw_album_art(gwps, audio_current_aa_hid(), false);
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
case WPS_TOKEN_ALBUMART_FOUND:
|
case WPS_TOKEN_ALBUMART_FOUND:
|
||||||
|
|
@ -1418,6 +1418,11 @@ static int evaluate_conditional(struct gui_wps *gwps, int cond_index)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_ALBUMART
|
||||||
|
if (data->albumart_cond_index == cond_index)
|
||||||
|
draw_album_art(gwps, audio_current_aa_hid(), true);
|
||||||
|
#endif
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -344,6 +344,8 @@ struct wps_data
|
||||||
+ .._INCREASE, + .._DECREASE */
|
+ .._INCREASE, + .._DECREASE */
|
||||||
short albumart_max_width;
|
short albumart_max_width;
|
||||||
short albumart_max_height;
|
short albumart_max_height;
|
||||||
|
|
||||||
|
int albumart_cond_index;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#else /*HAVE_LCD_CHARCELLS */
|
#else /*HAVE_LCD_CHARCELLS */
|
||||||
|
|
|
||||||
|
|
@ -214,6 +214,15 @@ static void dump_wps_tokens(struct wps_data *data)
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef HAVE_ALBUMART
|
||||||
|
case WPS_TOKEN_ALBUMART_DISPLAY:
|
||||||
|
snprintf(buf, sizeof(buf), "album art display at x=%d, y=%d, "
|
||||||
|
"maxwidth=%d, maxheight=%d", data->albumart_x,
|
||||||
|
data->albumart_y, data->albumart_max_width,
|
||||||
|
data->albumart_max_height);
|
||||||
|
break;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_LCD_BITMAP
|
#ifdef HAVE_LCD_BITMAP
|
||||||
case WPS_TOKEN_IMAGE_BACKDROP:
|
case WPS_TOKEN_IMAGE_BACKDROP:
|
||||||
snprintf(buf, sizeof(buf), "backdrop image");
|
snprintf(buf, sizeof(buf), "backdrop image");
|
||||||
|
|
|
||||||
|
|
@ -293,7 +293,7 @@ static const struct wps_tag all_tags[] = {
|
||||||
{ WPS_TOKEN_IMAGE_PROGRESS_BAR, "P", 0, parse_image_special },
|
{ WPS_TOKEN_IMAGE_PROGRESS_BAR, "P", 0, parse_image_special },
|
||||||
#ifdef HAVE_ALBUMART
|
#ifdef HAVE_ALBUMART
|
||||||
{ WPS_NO_TOKEN, "Cl", 0, parse_albumart_load },
|
{ WPS_NO_TOKEN, "Cl", 0, parse_albumart_load },
|
||||||
{ WPS_TOKEN_ALBUMART_DISPLAY, "C", WPS_REFRESH_DYNAMIC,
|
{ WPS_TOKEN_ALBUMART_DISPLAY, "C", WPS_REFRESH_STATIC,
|
||||||
parse_albumart_conditional },
|
parse_albumart_conditional },
|
||||||
#endif
|
#endif
|
||||||
#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1))
|
#if (LCD_DEPTH > 1) || (defined(HAVE_LCD_REMOTE) && (LCD_REMOTE_DEPTH > 1))
|
||||||
|
|
@ -824,7 +824,11 @@ static int parse_albumart_conditional(const char *wps_bufptr,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
/* This %C tag is in a conditional construct. */
|
||||||
|
wps_data->albumart_cond_index = condindex[level];
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
#endif /* HAVE_ALBUMART */
|
#endif /* HAVE_ALBUMART */
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -231,8 +231,9 @@ bool find_albumart(const struct mp3entry *id3, char *buf, int buflen)
|
||||||
return search_files(id3, size_string, buf, buflen);
|
return search_files(id3, size_string, buf, buflen);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw the album art bitmap from the given handle ID onto the given WPS. */
|
/* 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)
|
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)
|
if (!gwps || !gwps->data || !gwps->display || handle_id < 0)
|
||||||
return;
|
return;
|
||||||
|
|
@ -277,9 +278,19 @@ void draw_album_art(struct gui_wps *gwps, int handle_id)
|
||||||
y += (data->albumart_max_height - height) / 2;
|
y += (data->albumart_max_height - height) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Draw the bitmap */
|
if (!clear)
|
||||||
gwps->display->set_drawmode(DRMODE_FG);
|
{
|
||||||
gwps->display->bitmap_part((fb_data*)bmp->data, 0, 0, bmp->width,
|
/* Draw the bitmap */
|
||||||
x, y, width, height);
|
gwps->display->set_drawmode(DRMODE_FG);
|
||||||
gwps->display->set_drawmode(DRMODE_SOLID);
|
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,9 @@
|
||||||
* Returns true if a bitmap was found, false otherwise */
|
* 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);
|
||||||
|
|
||||||
/* Draw the album art bitmap from the given handle ID onto the given WPS. */
|
/* 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);
|
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 */
|
#endif /* HAVE_ALBUMART */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue