gui: skin_engine: reduce updates

Slight optimization of c145d19. Not supposed to result in
any visible difference.

- if UI viewport is drawn for GUI_EVENT_NEED_UI_UPDATE,
  it doesn't need to do a viewport update; skin_render
  already updates the display

- skin_render_deferred shouldn't need to request that
  the skin perform an immediate update

Change-Id: Id03cf89357eaf0d61af1e928c94942d8c4882dba
This commit is contained in:
Christian Soffke 2026-05-08 11:32:41 +02:00
parent ce403586e0
commit ae871d25a9
2 changed files with 13 additions and 5 deletions

View file

@ -850,12 +850,14 @@ void skin_defer_rendering(bool deferred)
void skin_render_deferred(struct screen *display, struct viewport *vp)
{
if (defer_rendering)
return;
if (dirty[display->screen_type])
{
dirty[display->screen_type] = false;
display->set_viewport(NULL);
display->update();
sb_skin_force_next_update();
}
else
{
@ -955,17 +957,18 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode)
skin_backdrop_show(data->backdrop_id);
#endif
dirty[display->screen_type] = defer_rendering;
if (((refresh_mode&SKIN_REFRESH_ALL) == SKIN_REFRESH_ALL))
{
defer_rendering = true;
/* If this is the UI viewport then let the UI know
* to redraw itself */
send_event(GUI_EVENT_NEED_UI_UPDATE, NULL);
defer_rendering = dirty[display->screen_type];
}
/* Restore the default viewport */
display->set_viewport_ex(NULL, VP_FLAG_VP_SET_CLEAN);
if (defer_rendering)
dirty[display->screen_type] = true;
else
if (!defer_rendering)
display->update();
}

View file

@ -38,6 +38,7 @@ struct view_info {
int line_count; /* number of lines */
int line; /* current first line */
int start; /* possition of first line in text */
bool ui_update_cb;
};
static bool isbrchr(const unsigned char *str, int len)
@ -156,6 +157,7 @@ static int init_view(struct view_info *info,
info->line_count = 0;
info->line = 0;
info->start = 0;
info->ui_update_cb = false;
if (!info->sbs_has_title)
{
@ -223,7 +225,9 @@ static void draw_text(struct view_info *info)
info->line_count, info->line, info->line + max_show, VERTICAL);
}
display->set_viewport(NULL);
display->update();
if (!info->ui_update_cb)
display->update();
info->ui_update_cb = false;
}
static void scroll_up(struct view_info *info, int n)
@ -269,6 +273,7 @@ static void ui_update_cb(unsigned short id, void* param, void* user_data)
(void)id;
(void)param;
struct view_info *info = (struct view_info *) user_data;
info->ui_update_cb = true;
draw_text(info);
}