summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWilliam Wilgus <wilgus.william@gmail.com>2020-10-28 10:32:17 -0400
committerWilliam Wilgus <wilgus.william@gmail.com>2020-10-28 13:25:12 -0400
commitc85d8e286549589a38e33d57e2a92d6c99ce5edf (patch)
tree4d4e2fb67b10d9186814b0f3f67a08113d8d8d4f
parenta605cdf7008f856946cbf01193f4dffc3ee63fdb (diff)
downloadrockbox-c85d8e286549589a38e33d57e2a92d6c99ce5edf.tar.gz
rockbox-c85d8e286549589a38e33d57e2a92d6c99ce5edf.tar.bz2
rockbox-c85d8e286549589a38e33d57e2a92d6c99ce5edf.zip
Framebuffer_viewport Rewrite -- BUG FIX
stride was not initialized for the skin_viewport fixed a few other questionable areas Change-Id: I9cc7830a4406857bf3aba26a328c288e3702cddd
-rw-r--r--apps/gui/skin_engine/skin_backdrops.c4
-rw-r--r--apps/gui/skin_engine/skin_render.c37
-rw-r--r--apps/gui/skin_engine/wps_internals.h2
3 files changed, 21 insertions, 22 deletions
diff --git a/apps/gui/skin_engine/skin_backdrops.c b/apps/gui/skin_engine/skin_backdrops.c
index caf705af54..20010efa26 100644
--- a/apps/gui/skin_engine/skin_backdrops.c
+++ b/apps/gui/skin_engine/skin_backdrops.c
@@ -210,7 +210,8 @@ void skin_backdrop_set_buffer(int backdrop_id, struct skin_viewport *svp)
return;
else if (backdrop_id < 0)
{
- svp->vp.buffer = NULL; /*Default*/
+ /* SCREEN_MAIN is ok here screen only matters if passed VP is NULL */
+ screens[SCREEN_MAIN].viewport_set_buffer(&svp->vp, NULL); /*Default*/
return;
}
@@ -224,6 +225,7 @@ void skin_backdrop_set_buffer(int backdrop_id, struct skin_viewport *svp)
{
svp->framebuf.elems = LCD_BACKDROP_BYTES / sizeof(fb_data);
}
+ svp->framebuf.stride = 0; /* default stride */
svp->framebuf.get_address_fn = NULL; /*Default iterator*/
screens[screen].viewport_set_buffer(&svp->vp, &svp->framebuf);
}
diff --git a/apps/gui/skin_engine/skin_render.c b/apps/gui/skin_engine/skin_render.c
index 7f2dcab222..6d4c0bcf68 100644
--- a/apps/gui/skin_engine/skin_render.c
+++ b/apps/gui/skin_engine/skin_render.c
@@ -358,7 +358,6 @@ static void do_tags_in_hidden_conditional(struct skin_element* branch,
{
struct gui_wps *gwps = info->gwps;
struct wps_data *data = gwps->data;
- struct viewport *last_vp;
/* Tags here are ones which need to be "turned off" or cleared
* if they are in a conditional branch which isnt being used */
@@ -436,22 +435,20 @@ static void do_tags_in_hidden_conditional(struct skin_element* branch,
{
skin_backdrop_set_buffer(data->backdrop_id, skin_viewport);
skin_backdrop_show(-1);
+ gwps->display->set_viewport(&skin_viewport->vp);
+ gwps->display->clear_viewport();
+ gwps->display->set_viewport_ex(&info->skin_vp->vp, 0);
+ skin_backdrop_set_buffer(-1, skin_viewport);
+ skin_backdrop_show(data->backdrop_id);
}
+ else
#endif
- last_vp = gwps->display->set_viewport(&skin_viewport->vp);
- gwps->display->clear_viewport();
- gwps->display->set_viewport_ex(&info->skin_vp->vp, 0);
- skin_viewport->hidden_flags |= VP_DRAW_HIDDEN;
-
-#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
- if (skin_viewport->output_to_backdrop_buffer)
{
- gwps->display->set_viewport_ex(last_vp, 0);
- skin_backdrop_show(data->backdrop_id);
+ gwps->display->set_viewport(&skin_viewport->vp);
+ gwps->display->clear_viewport();
+ gwps->display->set_viewport_ex(&info->skin_vp->vp, 0);
}
-#else
- (void)last_vp;
-#endif
+ skin_viewport->hidden_flags |= VP_DRAW_HIDDEN;
}
}
}
@@ -743,7 +740,7 @@ void skin_render_viewport(struct skin_element* viewport, struct gui_wps *gwps,
struct wps_token *token = SKINOFFSETTOPTR(skin_buffer, imglist->token);
if (token) {
struct gui_img *img = (struct gui_img *)SKINOFFSETTOPTR(skin_buffer, token->value.data);
- if (img)
+ if (img)
img->display = -1;
}
imglist = SKINOFFSETTOPTR(skin_buffer, imglist->next);
@@ -823,19 +820,18 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode)
int old_refresh_mode = refresh_mode;
skin_buffer = get_skin_buffer(gwps->data);
- struct viewport* first_vp;
- /* should already be the default buffer */
- first_vp = display->set_viewport(NULL);
-
/* Framebuffer is likely dirty */
if ((refresh_mode&SKIN_REFRESH_ALL) == SKIN_REFRESH_ALL)
{
+ /* should already be the default buffer */
+ struct viewport * first_vp = display->set_viewport_ex(NULL, 0);
if ((first_vp->flags & VP_FLAG_VP_SET_CLEAN) == VP_FLAG_VP_DIRTY &&
get_current_activity() == ACTIVITY_WPS) /* only clear if in WPS */
{
display->clear_viewport();
}
}
+
viewport = SKINOFFSETTOPTR(skin_buffer, data->tree);
if (!viewport) return;
skin_viewport = SKINOFFSETTOPTR(skin_buffer, viewport->data);
@@ -898,6 +894,7 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode)
refresh_mode = old_refresh_mode;
}
#if (LCD_DEPTH > 1) || (defined(HAVE_REMOTE_LCD) && (LCD_REMOTE_DEPTH > 1))
+ skin_backdrop_set_buffer(-1, skin_viewport);
skin_backdrop_show(data->backdrop_id);
#endif
@@ -907,8 +904,8 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode)
* to redraw itself */
send_event(GUI_EVENT_NEED_UI_UPDATE, NULL);
}
- /* Restore the first viewport */
- display->set_viewport_ex(first_vp, VP_FLAG_VP_SET_CLEAN);
+ /* Restore the default viewport */
+ display->set_viewport_ex(NULL, VP_FLAG_VP_SET_CLEAN);
display->update();
}
diff --git a/apps/gui/skin_engine/wps_internals.h b/apps/gui/skin_engine/wps_internals.h
index 48898483de..dcad598dab 100644
--- a/apps/gui/skin_engine/wps_internals.h
+++ b/apps/gui/skin_engine/wps_internals.h
@@ -175,7 +175,7 @@ struct gradient_config {
#define VP_DEFAULT_LABEL_STRING "|"
struct skin_viewport {
struct viewport vp; /* The LCD viewport struct */
- struct frame_buffer_t framebuf;
+ struct frame_buffer_t framebuf; /* holds reference to current framebuffer */
char hidden_flags;
bool is_infovp;
OFFSETTYPE(char*) label;