From: Ray Strode Date: Wed, 16 Jul 2008 15:46:26 +0000 (-0400) Subject: Add new hooks for clearing and drawing parts of the screen X-Git-Tag: 0.6.0~237 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d4d3ca4c515752be2c82784c9bf598771f71b27c;p=thirdparty%2Fplymouth.git 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. --- diff --git a/src/libplybootsplash/ply-window.c b/src/libplybootsplash/ply-window.c index d7182037..7f46c5af 100644 --- a/src/libplybootsplash/ply-window.c +++ b/src/libplybootsplash/ply-window.c @@ -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) diff --git a/src/libplybootsplash/ply-window.h b/src/libplybootsplash/ply-window.h index a79d99b7..9ec719dd 100644 --- a/src/libplybootsplash/ply-window.h +++ b/src/libplybootsplash/ply-window.h @@ -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,