diff options
Diffstat (limited to 'apps/gui/skin_engine')
-rw-r--r-- | apps/gui/skin_engine/skin_display.c | 71 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_display.h | 4 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_engine.c | 55 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_engine.h | 10 | ||||
-rw-r--r-- | apps/gui/skin_engine/skin_render.c | 2 | ||||
-rw-r--r-- | apps/gui/skin_engine/wps_internals.h | 11 |
6 files changed, 151 insertions, 2 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; |
diff --git a/apps/gui/skin_engine/skin_display.h b/apps/gui/skin_engine/skin_display.h index de1b0b20b5..6226da3eec 100644 --- a/apps/gui/skin_engine/skin_display.h +++ b/apps/gui/skin_engine/skin_display.h | |||
@@ -54,4 +54,8 @@ void write_line(struct screen *display, struct align_pos *format_align, | |||
54 | int line, bool scroll, struct line_desc *line_desc); | 54 | int line, bool scroll, struct line_desc *line_desc); |
55 | void draw_peakmeters(struct gui_wps *gwps, int line_number, | 55 | void draw_peakmeters(struct gui_wps *gwps, int line_number, |
56 | struct viewport *viewport); | 56 | struct viewport *viewport); |
57 | /* Draw the album art bitmap from the given handle ID onto the given Skin. | ||
58 | Call with clear = true to clear the bitmap instead of drawing it. */ | ||
59 | void draw_album_art(struct gui_wps *gwps, int handle_id, bool clear); | ||
60 | |||
57 | #endif | 61 | #endif |
diff --git a/apps/gui/skin_engine/skin_engine.c b/apps/gui/skin_engine/skin_engine.c index 8ba76e5739..a3ad85fd6e 100644 --- a/apps/gui/skin_engine/skin_engine.c +++ b/apps/gui/skin_engine/skin_engine.c | |||
@@ -34,9 +34,11 @@ | |||
34 | #if CONFIG_TUNER | 34 | #if CONFIG_TUNER |
35 | #include "radio.h" | 35 | #include "radio.h" |
36 | #endif | 36 | #endif |
37 | #include "gui/list.h" | ||
37 | #include "skin_engine.h" | 38 | #include "skin_engine.h" |
38 | #include "skin_buffer.h" | 39 | #include "skin_buffer.h" |
39 | #include "statusbar-skinned.h" | 40 | #include "statusbar-skinned.h" |
41 | #include "wps_internals.h" | ||
40 | 42 | ||
41 | #define FAILSAFENAME "rockbox_failsafe" | 43 | #define FAILSAFENAME "rockbox_failsafe" |
42 | 44 | ||
@@ -334,3 +336,56 @@ void skin_request_full_update(enum skinnable_screens skin) | |||
334 | FOR_NB_SCREENS(i) | 336 | FOR_NB_SCREENS(i) |
335 | skins[skin][i].needs_full_update = true; | 337 | skins[skin][i].needs_full_update = true; |
336 | } | 338 | } |
339 | |||
340 | bool dbg_skin_engine(void) | ||
341 | { | ||
342 | struct simplelist_info info; | ||
343 | int i, total = 0; | ||
344 | #if defined(HAVE_BACKDROP_IMAGE) | ||
345 | int ref_count; | ||
346 | char *path; | ||
347 | size_t bytes; | ||
348 | int path_prefix_len = strlen(ROCKBOX_DIR "/wps/"); | ||
349 | #endif | ||
350 | simplelist_info_init(&info, "Skin engine usage", 0, NULL); | ||
351 | simplelist_set_line_count(0); | ||
352 | FOR_NB_SCREENS(j) { | ||
353 | #if NB_SCREENS > 1 | ||
354 | simplelist_addline("%s display:", | ||
355 | j == 0 ? "Main" : "Remote"); | ||
356 | #endif | ||
357 | for (i = 0; i < skin_get_num_skins(); i++) { | ||
358 | struct skin_stats *stats = skin_get_stats(i, j); | ||
359 | if (stats->buflib_handles) | ||
360 | { | ||
361 | simplelist_addline("Skin ID: %d, %d allocations", | ||
362 | i, stats->buflib_handles); | ||
363 | simplelist_addline("\tskin: %d bytes", | ||
364 | stats->tree_size); | ||
365 | simplelist_addline("\tImages: %d bytes", | ||
366 | stats->images_size); | ||
367 | simplelist_addline("\tTotal: %d bytes", | ||
368 | stats->tree_size + stats->images_size); | ||
369 | total += stats->tree_size + stats->images_size; | ||
370 | } | ||
371 | } | ||
372 | } | ||
373 | simplelist_addline("Skin total usage: %d bytes", total); | ||
374 | #if defined(HAVE_BACKDROP_IMAGE) | ||
375 | simplelist_addline("Backdrop Images:"); | ||
376 | i = 0; | ||
377 | while (skin_backdrop_get_debug(i++, &path, &ref_count, &bytes)) { | ||
378 | if (ref_count > 0) { | ||
379 | |||
380 | if (!strncasecmp(path, ROCKBOX_DIR "/wps/", path_prefix_len)) | ||
381 | path += path_prefix_len; | ||
382 | simplelist_addline("%s", path); | ||
383 | simplelist_addline("\tref_count: %d", ref_count); | ||
384 | simplelist_addline("\tsize: %d", bytes); | ||
385 | total += bytes; | ||
386 | } | ||
387 | } | ||
388 | simplelist_addline("Total usage: %d bytes", total); | ||
389 | #endif | ||
390 | return simplelist_show_list(&info); | ||
391 | } | ||
diff --git a/apps/gui/skin_engine/skin_engine.h b/apps/gui/skin_engine/skin_engine.h index e26ec34d1f..d7efb5b888 100644 --- a/apps/gui/skin_engine/skin_engine.h +++ b/apps/gui/skin_engine/skin_engine.h | |||
@@ -26,8 +26,7 @@ | |||
26 | #ifndef PLUGIN | 26 | #ifndef PLUGIN |
27 | 27 | ||
28 | #include "tag_table.h" | 28 | #include "tag_table.h" |
29 | 29 | #include "screen_access.h" | |
30 | #include "wps_internals.h" /* TODO: remove this line.. shoudlnt be needed */ | ||
31 | 30 | ||
32 | enum skinnable_screens { | 31 | enum skinnable_screens { |
33 | CUSTOM_STATUSBAR, | 32 | CUSTOM_STATUSBAR, |
@@ -39,6 +38,11 @@ enum skinnable_screens { | |||
39 | SKINNABLE_SCREENS_COUNT | 38 | SKINNABLE_SCREENS_COUNT |
40 | }; | 39 | }; |
41 | 40 | ||
41 | struct skin_stats; | ||
42 | struct skin_viewport; | ||
43 | struct touchregion; | ||
44 | struct wps_data; | ||
45 | |||
42 | #ifdef HAVE_TOUCHSCREEN | 46 | #ifdef HAVE_TOUCHSCREEN |
43 | int skin_get_touchaction(struct wps_data *data, int* edge_offset, | 47 | int skin_get_touchaction(struct wps_data *data, int* edge_offset, |
44 | struct touchregion **retregion); | 48 | struct touchregion **retregion); |
@@ -89,5 +93,7 @@ void skin_unload_all(void); | |||
89 | bool skin_do_full_update(enum skinnable_screens skin, enum screen_type screen); | 93 | bool skin_do_full_update(enum skinnable_screens skin, enum screen_type screen); |
90 | void skin_request_full_update(enum skinnable_screens skin); | 94 | void skin_request_full_update(enum skinnable_screens skin); |
91 | 95 | ||
96 | bool dbg_skin_engine(void); | ||
97 | |||
92 | #endif /* !PLUGIN */ | 98 | #endif /* !PLUGIN */ |
93 | #endif | 99 | #endif |
diff --git a/apps/gui/skin_engine/skin_render.c b/apps/gui/skin_engine/skin_render.c index 1f777b6672..2238bd9bec 100644 --- a/apps/gui/skin_engine/skin_render.c +++ b/apps/gui/skin_engine/skin_render.c | |||
@@ -74,6 +74,8 @@ struct skin_draw_info { | |||
74 | int offset; /* used by the playlist viewer */ | 74 | int offset; /* used by the playlist viewer */ |
75 | }; | 75 | }; |
76 | 76 | ||
77 | extern void sb_set_info_vp(enum screen_type screen, OFFSETTYPE(char*) label); | ||
78 | |||
77 | typedef bool (*skin_render_func)(struct skin_element* alternator, struct skin_draw_info *info); | 79 | typedef bool (*skin_render_func)(struct skin_element* alternator, struct skin_draw_info *info); |
78 | bool skin_render_alternator(struct skin_element* alternator, struct skin_draw_info *info); | 80 | bool skin_render_alternator(struct skin_element* alternator, struct skin_draw_info *info); |
79 | 81 | ||
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h index c220480f13..35d7b979fc 100644 --- a/apps/gui/skin_engine/wps_internals.h +++ b/apps/gui/skin_engine/wps_internals.h | |||
@@ -313,6 +313,17 @@ struct listitem { | |||
313 | short offset; | 313 | short offset; |
314 | }; | 314 | }; |
315 | 315 | ||
316 | struct listitem_viewport_cfg { | ||
317 | struct wps_data *data; | ||
318 | OFFSETTYPE(char *) label; | ||
319 | int width; | ||
320 | int height; | ||
321 | int xmargin; | ||
322 | int ymargin; | ||
323 | bool tile; | ||
324 | struct skin_viewport selected_item_vp; | ||
325 | }; | ||
326 | |||
316 | #ifdef HAVE_SKIN_VARIABLES | 327 | #ifdef HAVE_SKIN_VARIABLES |
317 | struct skin_var { | 328 | struct skin_var { |
318 | OFFSETTYPE(const char *) label; | 329 | OFFSETTYPE(const char *) label; |