summaryrefslogtreecommitdiff
path: root/apps/recorder/albumart.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/recorder/albumart.c')
-rw-r--r--apps/recorder/albumart.c70
1 files changed, 0 insertions, 70 deletions
diff --git a/apps/recorder/albumart.c b/apps/recorder/albumart.c
index 9ff9c72f80..e94ffcfb80 100644
--- a/apps/recorder/albumart.c
+++ b/apps/recorder/albumart.c
@@ -297,74 +297,4 @@ bool find_albumart(const struct mp3entry *id3, char *buf, int buflen,
297 return search_albumart_files(id3, size_string, buf, buflen); 297 return search_albumart_files(id3, size_string, buf, buflen);
298} 298}
299 299
300/* Draw the album art bitmap from the given handle ID onto the given WPS.
301 Call with clear = true to clear the bitmap instead of drawing it. */
302void draw_album_art(struct gui_wps *gwps, int handle_id, bool clear)
303{
304 if (!gwps || !gwps->data || !gwps->display || handle_id < 0)
305 return;
306
307 struct wps_data *data = gwps->data;
308 struct skin_albumart *aa = SKINOFFSETTOPTR(get_skin_buffer(data), data->albumart);
309
310 if (!aa)
311 return;
312
313 struct bitmap *bmp;
314 if (bufgetdata(handle_id, 0, (void *)&bmp) <= 0)
315 return;
316
317 short x = aa->x;
318 short y = aa->y;
319 short width = bmp->width;
320 short height = bmp->height;
321
322 if (aa->width > 0)
323 {
324 /* Crop if the bitmap is too wide */
325 width = MIN(bmp->width, aa->width);
326
327 /* Align */
328 if (aa->xalign & WPS_ALBUMART_ALIGN_RIGHT)
329 x += aa->width - width;
330 else if (aa->xalign & WPS_ALBUMART_ALIGN_CENTER)
331 x += (aa->width - width) / 2;
332 }
333
334 if (aa->height > 0)
335 {
336 /* Crop if the bitmap is too high */
337 height = MIN(bmp->height, aa->height);
338
339 /* Align */
340 if (aa->yalign & WPS_ALBUMART_ALIGN_BOTTOM)
341 y += aa->height - height;
342 else if (aa->yalign & WPS_ALBUMART_ALIGN_CENTER)
343 y += (aa->height - height) / 2;
344 }
345
346 if (!clear)
347 {
348 /* Draw the bitmap */
349 gwps->display->bitmap_part((fb_data*)bmp->data, 0, 0,
350 STRIDE(gwps->display->screen_type,
351 bmp->width, bmp->height),
352 x, y, width, height);
353#ifdef HAVE_LCD_INVERT
354 if (global_settings.invert) {
355 gwps->display->set_drawmode(DRMODE_COMPLEMENT);
356 gwps->display->fillrect(x, y, width, height);
357 gwps->display->set_drawmode(DRMODE_SOLID);
358 }
359#endif
360 }
361 else
362 {
363 /* Clear the bitmap */
364 gwps->display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID);
365 gwps->display->fillrect(x, y, width, height);
366 gwps->display->set_drawmode(DRMODE_SOLID);
367 }
368}
369
370#endif /* PLUGIN */ 300#endif /* PLUGIN */