Important speedup by not redrawing too much

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2009-11-24 07:17:18 +01:00
parent 4545f150f3
commit 947fa16c8b
11 changed files with 221 additions and 73 deletions

View file

@ -54,7 +54,15 @@ int grub_gfxmenu_view_execute_entry (grub_gfxmenu_view_t view,
void grub_gfxmenu_view_run_terminal (grub_gfxmenu_view_t view);
void
grub_gfxmenu_redraw_menu (grub_gfxmenu_view_t view);
void
grub_gfxmenu_redraw_timeout (grub_gfxmenu_view_t view);
void
grub_gfxmenu_view_redraw (grub_gfxmenu_view_t view,
const grub_video_rect_t *region);
/* Implementation details -- this should not be used outside of the
view itself. */
@ -86,6 +94,12 @@ struct grub_gfxmenu_view
grub_gui_container_t canvas;
grub_gfxmenu_model_t model;
int last_seconds_remaining;
int double_repaint;
grub_video_rect_t progress_message_frame;
};
#endif /* ! GRUB_GFXMENU_VIEW_HEADER */

View file

@ -50,13 +50,14 @@ struct grub_gui_component_ops
void (*destroy) (void *self);
const char * (*get_id) (void *self);
int (*is_instance) (void *self, const char *type);
void (*paint) (void *self);
void (*paint) (void *self, const grub_video_rect_t *bounds);
void (*set_parent) (void *self, grub_gui_container_t parent);
grub_gui_container_t (*get_parent) (void *self);
void (*set_bounds) (void *self, const grub_video_rect_t *bounds);
void (*get_bounds) (void *self, grub_video_rect_t *bounds);
void (*get_preferred_size) (void *self, int *width, int *height);
grub_err_t (*set_property) (void *self, const char *name, const char *value);
void (*repaint) (void *self, int second_pass);
};
struct grub_gui_container_ops
@ -162,4 +163,17 @@ grub_gui_map_color (grub_gui_color_t c)
return grub_video_map_rgba (c.red, c.green, c.blue, c.alpha);
}
static inline int
grub_video_have_common_points (const grub_video_rect_t *a,
const grub_video_rect_t *b)
{
if (!((a->x <= b->x && b->x <= a->x + a->width)
|| (b->x <= a->x && a->x <= b->x + b->width)))
return 0;
if (!((a->y <= b->y && b->y <= a->y + a->height)
|| (b->y <= a->y && a->y <= b->y + b->height)))
return 0;
return 1;
}
#endif /* ! GRUB_GUI_H */