mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-12-09 05:05:20 -05:00
lists: Detect dirtyness (need to reinit) for each list, instead of once globally.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30721 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
40529dd069
commit
0acdc87df4
2 changed files with 12 additions and 5 deletions
|
|
@ -58,17 +58,18 @@ static void gui_list_select_at_offset(struct gui_synclist * gui_list,
|
|||
void list_draw(struct screen *display, struct gui_synclist *list);
|
||||
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
static int list_need_reinit = false;
|
||||
static long last_dirty_tick;
|
||||
static struct viewport parent[NB_SCREENS];
|
||||
|
||||
static void list_force_reinit(void *param)
|
||||
{
|
||||
(void)param;
|
||||
list_need_reinit = true;
|
||||
last_dirty_tick = current_tick;
|
||||
}
|
||||
|
||||
void list_init(void)
|
||||
{
|
||||
last_dirty_tick = current_tick;
|
||||
add_event(GUI_EVENT_THEME_CHANGED, false, list_force_reinit);
|
||||
}
|
||||
|
||||
|
|
@ -93,7 +94,7 @@ static void list_init_viewports(struct gui_synclist *list)
|
|||
#endif
|
||||
}
|
||||
}
|
||||
list_need_reinit = false;
|
||||
list->dirty_tick = false;
|
||||
}
|
||||
#else
|
||||
static struct viewport parent[NB_SCREENS] =
|
||||
|
|
@ -178,6 +179,7 @@ void gui_synclist_init(struct gui_synclist * gui_list,
|
|||
gui_list->title_icon = Icon_NOICON;
|
||||
|
||||
gui_list->scheduled_talk_tick = gui_list->last_talked_tick = 0;
|
||||
gui_list->dirty_tick = current_tick;
|
||||
gui_list->show_selection_marker = true;
|
||||
|
||||
#ifdef HAVE_LCD_COLOR
|
||||
|
|
@ -227,6 +229,11 @@ int gui_list_get_item_offset(struct gui_synclist * gui_list,
|
|||
}
|
||||
#endif
|
||||
|
||||
static bool is_dirty(struct gui_synclist *list)
|
||||
{
|
||||
return TIME_BEFORE(list->dirty_tick, last_dirty_tick);
|
||||
}
|
||||
|
||||
/*
|
||||
* Force a full screen update.
|
||||
*/
|
||||
|
|
@ -234,7 +241,7 @@ void gui_synclist_draw(struct gui_synclist *gui_list)
|
|||
{
|
||||
int i;
|
||||
#ifdef HAVE_LCD_BITMAP
|
||||
if (list_need_reinit)
|
||||
if (is_dirty(gui_list))
|
||||
{
|
||||
list_init_viewports(gui_list);
|
||||
gui_synclist_select_item(gui_list, gui_list->selected_item);
|
||||
|
|
|
|||
|
|
@ -103,7 +103,7 @@ struct gui_synclist
|
|||
#ifdef HAVE_LCD_BITMAP
|
||||
int offset_position[NB_SCREENS]; /* the list's screen scroll placement in pixels */
|
||||
#endif
|
||||
long scheduled_talk_tick, last_talked_tick;
|
||||
long scheduled_talk_tick, last_talked_tick, dirty_tick;
|
||||
|
||||
list_get_icon *callback_get_item_icon;
|
||||
list_get_name *callback_get_item_name;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue