summaryrefslogtreecommitdiff
path: root/apps/recorder
diff options
context:
space:
mode:
authorAidan MacDonald <amachronic@protonmail.com>2022-10-02 18:02:27 +0100
committerAidan MacDonald <amachronic@protonmail.com>2022-10-17 14:29:12 +0100
commitc6ee9dc8833814bf628ea5ce53e91c60067c5a06 (patch)
tree9a4680c1e1eca4763e98c215acc39a99200fbed7 /apps/recorder
parent4bd97c653558bde62237f095a6b9810fb5d16491 (diff)
downloadrockbox-c6ee9dc8833814bf628ea5ce53e91c60067c5a06.tar.gz
rockbox-c6ee9dc8833814bf628ea5ce53e91c60067c5a06.zip
Limit exposure of skin engine internals
Drop wps_internals.h from skin_engine.h. The WPS and to a lesser extent the radio screen are too tightly integrated to drop their dependency on wps_internals.h, unfortunately. Skinned lists, for obvious reasons, also need access to the internals. Change-Id: I00a55aa423900f9ad22edccbe2fc1910af380e38
Diffstat (limited to 'apps/recorder')
-rw-r--r--apps/recorder/albumart.c70
-rw-r--r--apps/recorder/albumart.h6
2 files changed, 0 insertions, 76 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 */
diff --git a/apps/recorder/albumart.h b/apps/recorder/albumart.h
index 80cacaf5f0..0d663d3d92 100644
--- a/apps/recorder/albumart.h
+++ b/apps/recorder/albumart.h
@@ -35,12 +35,6 @@
35bool find_albumart(const struct mp3entry *id3, char *buf, int buflen, 35bool find_albumart(const struct mp3entry *id3, char *buf, int buflen,
36 const struct dim *dim); 36 const struct dim *dim);
37 37
38#ifndef PLUGIN
39/* Draw the album art bitmap from the given handle ID onto the given Skin.
40 Call with clear = true to clear the bitmap instead of drawing it. */
41void draw_album_art(struct gui_wps *gwps, int handle_id, bool clear);
42#endif
43
44bool search_albumart_files(const struct mp3entry *id3, const char *size_string, 38bool search_albumart_files(const struct mp3entry *id3, const char *size_string,
45 char *buf, int buflen); 39 char *buf, int buflen);
46 40