mirror of
https://github.com/Rockbox/rockbox.git
synced 2026-07-10 13:29:52 -04:00
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:
parent
ce403586e0
commit
ae871d25a9
2 changed files with 13 additions and 5 deletions
|
|
@ -850,12 +850,14 @@ void skin_defer_rendering(bool deferred)
|
||||||
|
|
||||||
void skin_render_deferred(struct screen *display, struct viewport *vp)
|
void skin_render_deferred(struct screen *display, struct viewport *vp)
|
||||||
{
|
{
|
||||||
|
if (defer_rendering)
|
||||||
|
return;
|
||||||
|
|
||||||
if (dirty[display->screen_type])
|
if (dirty[display->screen_type])
|
||||||
{
|
{
|
||||||
dirty[display->screen_type] = false;
|
dirty[display->screen_type] = false;
|
||||||
display->set_viewport(NULL);
|
display->set_viewport(NULL);
|
||||||
display->update();
|
display->update();
|
||||||
sb_skin_force_next_update();
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -955,17 +957,18 @@ void skin_render(struct gui_wps *gwps, unsigned refresh_mode)
|
||||||
skin_backdrop_show(data->backdrop_id);
|
skin_backdrop_show(data->backdrop_id);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
dirty[display->screen_type] = defer_rendering;
|
||||||
if (((refresh_mode&SKIN_REFRESH_ALL) == SKIN_REFRESH_ALL))
|
if (((refresh_mode&SKIN_REFRESH_ALL) == SKIN_REFRESH_ALL))
|
||||||
{
|
{
|
||||||
|
defer_rendering = true;
|
||||||
/* If this is the UI viewport then let the UI know
|
/* If this is the UI viewport then let the UI know
|
||||||
* to redraw itself */
|
* to redraw itself */
|
||||||
send_event(GUI_EVENT_NEED_UI_UPDATE, NULL);
|
send_event(GUI_EVENT_NEED_UI_UPDATE, NULL);
|
||||||
|
defer_rendering = dirty[display->screen_type];
|
||||||
}
|
}
|
||||||
/* Restore the default viewport */
|
/* Restore the default viewport */
|
||||||
display->set_viewport_ex(NULL, VP_FLAG_VP_SET_CLEAN);
|
display->set_viewport_ex(NULL, VP_FLAG_VP_SET_CLEAN);
|
||||||
if (defer_rendering)
|
if (!defer_rendering)
|
||||||
dirty[display->screen_type] = true;
|
|
||||||
else
|
|
||||||
display->update();
|
display->update();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ struct view_info {
|
||||||
int line_count; /* number of lines */
|
int line_count; /* number of lines */
|
||||||
int line; /* current first line */
|
int line; /* current first line */
|
||||||
int start; /* possition of first line in text */
|
int start; /* possition of first line in text */
|
||||||
|
bool ui_update_cb;
|
||||||
};
|
};
|
||||||
|
|
||||||
static bool isbrchr(const unsigned char *str, int len)
|
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_count = 0;
|
||||||
info->line = 0;
|
info->line = 0;
|
||||||
info->start = 0;
|
info->start = 0;
|
||||||
|
info->ui_update_cb = false;
|
||||||
|
|
||||||
if (!info->sbs_has_title)
|
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);
|
info->line_count, info->line, info->line + max_show, VERTICAL);
|
||||||
}
|
}
|
||||||
display->set_viewport(NULL);
|
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)
|
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)id;
|
||||||
(void)param;
|
(void)param;
|
||||||
struct view_info *info = (struct view_info *) user_data;
|
struct view_info *info = (struct view_info *) user_data;
|
||||||
|
info->ui_update_cb = true;
|
||||||
draw_text(info);
|
draw_text(info);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue