diff options
author | William Wilgus <wilgus.william@gmail.com> | 2020-10-07 02:01:35 -0400 |
---|---|---|
committer | William Wilgus <wilgus.william@gmail.com> | 2020-10-26 12:28:48 -0400 |
commit | 3237ae4a4ff9296a377ff9194a11038da161208f (patch) | |
tree | af4338c78467b9b0845d76c39da1fbe10f25e23e /apps/gui/skin_engine/skin_render.c | |
parent | 12f3ed1699d6bef25bed90ba95cbcc1a6bb4934a (diff) | |
download | rockbox-3237ae4a4ff9296a377ff9194a11038da161208f.tar.gz rockbox-3237ae4a4ff9296a377ff9194a11038da161208f.zip |
LCD core move buf ptr and address look up function viewport struct
I'm currently running up against the limitations of the lcd_draw functions
I want these functions to be able to be used on any size buffer not
just buffers with a stride matching the underlying device
[DONE] allow the framebuffer to be decoupled from the device framebuffer
[DONE need examples] allow for some simple blit like transformations
[DONE] remove the device framebuffer from the plugin api
[DONE}ditto remote framebuffer
[DONE] remove _viewport_get_framebuffer you can call struct *vp = lcd_set_viewport(NULL) and vp->buffer->fb_ptr
while remote lcds may compile (and work in the sim) its not been tested on targets
[FIXED] backdrops need work to be screen agnostic
[FIXED] screen statusbar is not being combined into the main viewport correctly yet
[FIXED] screen elements are displayed incorrectly after switch to void*
[FIXED] core didn't restore proper viewport on splash etc.
[NEEDS TESTING] remote lcd garbled data
[FIXED] osd lib garbled screen on bmp_part
[FIXED] grey_set_vp needs to return old viewport like lcd_set_viewport
[FIXED] Viewport update now handles viewports with differing buffers/strides by copying to the main buffer
[FIXED] splash on top of WPS leaves old framebuffer data (doesn't redraw)
[UPDATE] refined this a bit more to have clear_viewport set the clean bit and have skin_render do its own screen clear
scrolling viewports no longer trigger wps refresh
also fixed a bug where guisyncyesno was displaying and then disappearing
[ADDED!] New LCD macros that allow you to create properly size frame buffers in you desired size without wasting bytes
(LCD_ and LCD_REMOTE_)
LCD_STRIDE(w, h) same as STRIDE_MAIN
LCD_FBSTRIDE(w, h) returns target specific stride for a buffer W x H
LCD_NBELEMS(w, h) returns the number of fb_data sized elemenst needed for a buffer W x H
LCD_NATIVE_STRIDE(s) conversion between rockbox native vertical and lcd native stride (2bitH)
test_viewports.c has an example of usage
[FIXED!!] 2bit targets don't respect non-native strides
[FIXED] Few define snags
Change-Id: I0d04c3834e464eca84a5a715743a297a0cefd0af
Diffstat (limited to 'apps/gui/skin_engine/skin_render.c')
-rw-r--r-- | apps/gui/skin_engine/skin_render.c | 45 |
1 files changed, 30 insertions, 15 deletions
diff --git a/apps/gui/skin_engine/skin_render.c b/apps/gui/skin_engine/skin_render.c index 51c58fc196..00981f5b67 100644 --- a/apps/gui/skin_engine/skin_render.c +++ b/apps/gui/skin_engine/skin_render.c | |||
@@ -349,6 +349,8 @@ static void do_tags_in_hidden_conditional(struct skin_element* branch, | |||
349 | { | 349 | { |
350 | struct gui_wps *gwps = info->gwps; | 350 | struct gui_wps *gwps = info->gwps; |
351 | struct wps_data *data = gwps->data; | 351 | struct wps_data *data = gwps->data; |
352 | struct viewport *last_vp; | ||
353 | |||
352 | /* Tags here are ones which need to be "turned off" or cleared | 354 | /* Tags here are ones which need to be "turned off" or cleared |
353 | * if they are in a conditional branch which isnt being used */ | 355 | * if they are in a conditional branch which isnt being used */ |
354 | if (branch->type == LINE_ALTERNATOR) | 356 | if (branch->type == LINE_ALTERNATOR) |
@@ -420,22 +422,23 @@ static void do_tags_in_hidden_conditional(struct skin_element* branch, | |||
420 | #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) | 422 | #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) |
421 | if (skin_viewport->output_to_backdrop_buffer) | 423 | if (skin_viewport->output_to_backdrop_buffer) |
422 | { | 424 | { |
423 | void *backdrop = skin_backdrop_get_buffer(data->backdrop_id); | 425 | skin_backdrop_set_buffer(data->backdrop_id, skin_viewport); |
424 | gwps->display->set_framebuffer(backdrop); | ||
425 | skin_backdrop_show(-1); | 426 | skin_backdrop_show(-1); |
426 | } | 427 | } |
427 | #endif | 428 | #endif |
428 | gwps->display->set_viewport(&skin_viewport->vp); | 429 | last_vp = gwps->display->set_viewport(&skin_viewport->vp); |
429 | gwps->display->clear_viewport(); | 430 | gwps->display->clear_viewport(); |
430 | gwps->display->set_viewport(&info->skin_vp->vp); | 431 | gwps->display->set_viewport_ex(&info->skin_vp->vp, 0); |
431 | skin_viewport->hidden_flags |= VP_DRAW_HIDDEN; | 432 | skin_viewport->hidden_flags |= VP_DRAW_HIDDEN; |
432 | 433 | ||
433 | #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) | 434 | #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) |
434 | if (skin_viewport->output_to_backdrop_buffer) | 435 | if (skin_viewport->output_to_backdrop_buffer) |
435 | { | 436 | { |
436 | gwps->display->set_framebuffer(NULL); | 437 | gwps->display->set_viewport_ex(last_vp, 0); |
437 | skin_backdrop_show(data->backdrop_id); | 438 | skin_backdrop_show(data->backdrop_id); |
438 | } | 439 | } |
440 | #else | ||
441 | (void)last_vp; | ||
439 | #endif | 442 | #endif |
440 | } | 443 | } |
441 | } | 444 | } |
@@ -792,6 +795,7 @@ void skin_render_viewport(struct skin_element* viewport, struct gui_wps *gwps, | |||
792 | 795 | ||
793 | void skin_render(struct gui_wps *gwps, unsigned refresh_mode) | 796 | void skin_render(struct gui_wps *gwps, unsigned refresh_mode) |
794 | { | 797 | { |
798 | const int vp_is_appearing = (VP_DRAW_WASHIDDEN|VP_DRAW_HIDEABLE); | ||
795 | struct wps_data *data = gwps->data; | 799 | struct wps_data *data = gwps->data; |
796 | struct screen *display = gwps->display; | 800 | struct screen *display = gwps->display; |
797 | 801 | ||
@@ -801,7 +805,20 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode) | |||
801 | 805 | ||
802 | int old_refresh_mode = refresh_mode; | 806 | int old_refresh_mode = refresh_mode; |
803 | skin_buffer = get_skin_buffer(gwps->data); | 807 | skin_buffer = get_skin_buffer(gwps->data); |
804 | 808 | ||
809 | struct viewport* first_vp; | ||
810 | /* should already be the default buffer */ | ||
811 | first_vp = display->set_viewport(NULL); | ||
812 | |||
813 | /* Framebuffer is likely dirty */ | ||
814 | if ((refresh_mode&SKIN_REFRESH_ALL) == SKIN_REFRESH_ALL) | ||
815 | { | ||
816 | if ((first_vp->flags & VP_FLAG_VP_SET_CLEAN) == VP_FLAG_VP_DIRTY && | ||
817 | get_current_activity() == ACTIVITY_WPS) /* only clear if in WPS */ | ||
818 | { | ||
819 | display->clear_viewport(); | ||
820 | } | ||
821 | } | ||
805 | 822 | ||
806 | viewport = SKINOFFSETTOPTR(skin_buffer, data->tree); | 823 | viewport = SKINOFFSETTOPTR(skin_buffer, data->tree); |
807 | skin_viewport = SKINOFFSETTOPTR(skin_buffer, viewport->data); | 824 | skin_viewport = SKINOFFSETTOPTR(skin_buffer, viewport->data); |
@@ -822,12 +839,12 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode) | |||
822 | #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) | 839 | #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && LCD_REMOTE_DEPTH > 1) |
823 | if (skin_viewport->output_to_backdrop_buffer) | 840 | if (skin_viewport->output_to_backdrop_buffer) |
824 | { | 841 | { |
825 | display->set_framebuffer(skin_backdrop_get_buffer(data->backdrop_id)); | 842 | skin_backdrop_set_buffer(data->backdrop_id, skin_viewport); |
826 | skin_backdrop_show(-1); | 843 | skin_backdrop_show(-1); |
827 | } | 844 | } |
828 | else | 845 | else |
829 | { | 846 | { |
830 | display->set_framebuffer(NULL); | 847 | skin_backdrop_set_buffer(-1, skin_viewport); |
831 | skin_backdrop_show(data->backdrop_id); | 848 | skin_backdrop_show(data->backdrop_id); |
832 | } | 849 | } |
833 | #endif | 850 | #endif |
@@ -842,15 +859,14 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode) | |||
842 | skin_viewport->hidden_flags |= VP_DRAW_WASHIDDEN; | 859 | skin_viewport->hidden_flags |= VP_DRAW_WASHIDDEN; |
843 | continue; | 860 | continue; |
844 | } | 861 | } |
845 | else if (((skin_viewport->hidden_flags& | 862 | else if ((skin_viewport->hidden_flags & vp_is_appearing) == vp_is_appearing) |
846 | (VP_DRAW_WASHIDDEN|VP_DRAW_HIDEABLE)) | ||
847 | == (VP_DRAW_WASHIDDEN|VP_DRAW_HIDEABLE))) | ||
848 | { | 863 | { |
849 | vp_refresh_mode = SKIN_REFRESH_ALL; | 864 | vp_refresh_mode = SKIN_REFRESH_ALL; |
850 | skin_viewport->hidden_flags = VP_DRAW_HIDEABLE; | 865 | skin_viewport->hidden_flags = VP_DRAW_HIDEABLE; |
851 | } | 866 | } |
852 | 867 | ||
853 | display->set_viewport(&skin_viewport->vp); | 868 | display->set_viewport_ex(&skin_viewport->vp, VP_FLAG_VP_SET_CLEAN); |
869 | |||
854 | if ((vp_refresh_mode&SKIN_REFRESH_ALL) == SKIN_REFRESH_ALL) | 870 | if ((vp_refresh_mode&SKIN_REFRESH_ALL) == SKIN_REFRESH_ALL) |
855 | { | 871 | { |
856 | display->clear_viewport(); | 872 | display->clear_viewport(); |
@@ -862,7 +878,6 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode) | |||
862 | refresh_mode = old_refresh_mode; | 878 | refresh_mode = old_refresh_mode; |
863 | } | 879 | } |
864 | #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) | 880 | #if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1)) |
865 | display->set_framebuffer(NULL); | ||
866 | skin_backdrop_show(data->backdrop_id); | 881 | skin_backdrop_show(data->backdrop_id); |
867 | #endif | 882 | #endif |
868 | 883 | ||
@@ -872,8 +887,8 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode) | |||
872 | * to redraw itself */ | 887 | * to redraw itself */ |
873 | send_event(GUI_EVENT_NEED_UI_UPDATE, NULL); | 888 | send_event(GUI_EVENT_NEED_UI_UPDATE, NULL); |
874 | } | 889 | } |
875 | /* Restore the default viewport */ | 890 | /* Restore the first viewport */ |
876 | display->set_viewport(NULL); | 891 | display->set_viewport_ex(first_vp, VP_FLAG_VP_SET_CLEAN); |
877 | display->update(); | 892 | display->update(); |
878 | } | 893 | } |
879 | 894 | ||