Add new hooks for clearing and drawing parts of the screen

We now have a few controls in libplybootsplash that don't
don't the specific details of the loaded splash plugins
background.  These hooks will make it possible for the
controls to clear the screen prior to doing alpha composition.
This commit is contained in:
Ray Strode 2008-07-16 11:46:26 -04:00
parent 186fb1f6ed
commit d4d3ca4c51
2 changed files with 81 additions and 0 deletions

View file

@ -125,6 +125,12 @@ struct _ply_window
ply_window_enter_handler_t enter_handler;
void *enter_handler_user_data;
ply_window_draw_handler_t draw_handler;
void *draw_handler_user_data;
ply_window_erase_handler_t erase_handler;
void *erase_handler_user_data;
};
ply_window_t *
@ -594,6 +600,30 @@ ply_window_get_foreground_color (ply_window_t *window)
return window->foreground_color;
}
void
ply_window_draw_area (ply_window_t *window,
int x,
int y,
int width,
int height)
{
if (window->draw_handler != NULL)
window->draw_handler (window->draw_handler_user_data,
x, y, width, height);
}
void
ply_window_erase_area (ply_window_t *window,
int x,
int y,
int width,
int height)
{
if (window->erase_handler != NULL)
window->erase_handler (window->erase_handler_user_data,
x, y, width, height);
}
uint32_t
ply_window_get_color_hex_value (ply_window_t *window,
ply_window_color_t color)
@ -720,6 +750,28 @@ ply_window_set_enter_handler (ply_window_t *window,
window->enter_handler_user_data = user_data;
}
void
ply_window_set_draw_handler (ply_window_t *window,
ply_window_draw_handler_t draw_handler,
void *user_data)
{
assert (window != NULL);
window->draw_handler = draw_handler;
window->draw_handler_user_data = user_data;
}
void
ply_window_set_erase_handler (ply_window_t *window,
ply_window_erase_handler_t erase_handler,
void *user_data)
{
assert (window != NULL);
window->erase_handler = erase_handler;
window->erase_handler_user_data = user_data;
}
void
ply_window_attach_to_event_loop (ply_window_t *window,
ply_event_loop_t *loop)

View file

@ -42,6 +42,17 @@ typedef void (* ply_window_escape_handler_t) (void *user_data);
typedef void (* ply_window_enter_handler_t) (void *user_data,
const char *line);
typedef void (* ply_window_draw_handler_t) (void *user_data,
int x,
int y,
int width,
int height);
typedef void (* ply_window_erase_handler_t) (void *user_data,
int x,
int y,
int width,
int height);
typedef enum
{
PLY_WINDOW_MODE_TEXT,
@ -77,6 +88,12 @@ void ply_window_set_escape_handler (ply_window_t *window,
void ply_window_set_enter_handler (ply_window_t *window,
ply_window_enter_handler_t enter_handler,
void *user_data);
void ply_window_set_draw_handler (ply_window_t *window,
ply_window_draw_handler_t draw_handler,
void *user_data);
void ply_window_set_erase_handler (ply_window_t *window,
ply_window_erase_handler_t erase_handler,
void *user_data);
bool ply_window_open (ply_window_t *window);
bool ply_window_take_console (ply_window_t *window);
@ -100,6 +117,18 @@ void ply_window_set_foreground_color (ply_window_t *window,
ply_window_color_t ply_window_get_background_color (ply_window_t *window);
ply_window_color_t ply_window_get_foreground_color (ply_window_t *window);
void ply_window_draw_area (ply_window_t *window,
int x,
int y,
int width,
int height);
void ply_window_erase_area (ply_window_t *window,
int x,
int y,
int width,
int height);
uint32_t ply_window_get_color_hex_value (ply_window_t *window,
ply_window_color_t color);
void ply_window_set_color_hex_value (ply_window_t *window,