diff options
Diffstat (limited to 'apps/gui/skin_engine/skin_display.c')
-rw-r--r-- | apps/gui/skin_engine/skin_display.c | 71 |
1 files changed, 71 insertions, 0 deletions
diff --git a/apps/gui/skin_engine/skin_display.c b/apps/gui/skin_engine/skin_display.c index 2285a20b59..cef38892ff 100644 --- a/apps/gui/skin_engine/skin_display.c +++ b/apps/gui/skin_engine/skin_display.c | |||
@@ -46,6 +46,7 @@ | |||
46 | #include "tagcache.h" | 46 | #include "tagcache.h" |
47 | #include "list.h" | 47 | #include "list.h" |
48 | #include "option_select.h" | 48 | #include "option_select.h" |
49 | #include "buffering.h" | ||
49 | 50 | ||
50 | #include "peakmeter.h" | 51 | #include "peakmeter.h" |
51 | /* Image stuff */ | 52 | /* Image stuff */ |
@@ -636,6 +637,76 @@ void draw_peakmeters(struct gui_wps *gwps, int line_number, | |||
636 | } | 637 | } |
637 | } | 638 | } |
638 | 639 | ||
640 | /* Draw the album art bitmap from the given handle ID onto the given WPS. | ||
641 | Call with clear = true to clear the bitmap instead of drawing it. */ | ||
642 | void draw_album_art(struct gui_wps *gwps, int handle_id, bool clear) | ||
643 | { | ||
644 | if (!gwps || !gwps->data || !gwps->display || handle_id < 0) | ||
645 | return; | ||
646 | |||
647 | struct wps_data *data = gwps->data; | ||
648 | struct skin_albumart *aa = SKINOFFSETTOPTR(get_skin_buffer(data), data->albumart); | ||
649 | |||
650 | if (!aa) | ||
651 | return; | ||
652 | |||
653 | struct bitmap *bmp; | ||
654 | if (bufgetdata(handle_id, 0, (void *)&bmp) <= 0) | ||
655 | return; | ||
656 | |||
657 | short x = aa->x; | ||
658 | short y = aa->y; | ||
659 | short width = bmp->width; | ||
660 | short height = bmp->height; | ||
661 | |||
662 | if (aa->width > 0) | ||
663 | { | ||
664 | /* Crop if the bitmap is too wide */ | ||
665 | width = MIN(bmp->width, aa->width); | ||
666 | |||
667 | /* Align */ | ||
668 | if (aa->xalign & WPS_ALBUMART_ALIGN_RIGHT) | ||
669 | x += aa->width - width; | ||
670 | else if (aa->xalign & WPS_ALBUMART_ALIGN_CENTER) | ||
671 | x += (aa->width - width) / 2; | ||
672 | } | ||
673 | |||
674 | if (aa->height > 0) | ||
675 | { | ||
676 | /* Crop if the bitmap is too high */ | ||
677 | height = MIN(bmp->height, aa->height); | ||
678 | |||
679 | /* Align */ | ||
680 | if (aa->yalign & WPS_ALBUMART_ALIGN_BOTTOM) | ||
681 | y += aa->height - height; | ||
682 | else if (aa->yalign & WPS_ALBUMART_ALIGN_CENTER) | ||
683 | y += (aa->height - height) / 2; | ||
684 | } | ||
685 | |||
686 | if (!clear) | ||
687 | { | ||
688 | /* Draw the bitmap */ | ||
689 | gwps->display->bitmap_part((fb_data*)bmp->data, 0, 0, | ||
690 | STRIDE(gwps->display->screen_type, | ||
691 | bmp->width, bmp->height), | ||
692 | x, y, width, height); | ||
693 | #ifdef HAVE_LCD_INVERT | ||
694 | if (global_settings.invert) { | ||
695 | gwps->display->set_drawmode(DRMODE_COMPLEMENT); | ||
696 | gwps->display->fillrect(x, y, width, height); | ||
697 | gwps->display->set_drawmode(DRMODE_SOLID); | ||
698 | } | ||
699 | #endif | ||
700 | } | ||
701 | else | ||
702 | { | ||
703 | /* Clear the bitmap */ | ||
704 | gwps->display->set_drawmode(DRMODE_SOLID|DRMODE_INVERSEVID); | ||
705 | gwps->display->fillrect(x, y, width, height); | ||
706 | gwps->display->set_drawmode(DRMODE_SOLID); | ||
707 | } | ||
708 | } | ||
709 | |||
639 | bool skin_has_sbs(enum screen_type screen, struct wps_data *data) | 710 | bool skin_has_sbs(enum screen_type screen, struct wps_data *data) |
640 | { | 711 | { |
641 | (void)screen; | 712 | (void)screen; |