diff options
Diffstat (limited to 'payloads/libpayload')
-rw-r--r-- | payloads/libpayload/drivers/video/graphics.c | 16 | ||||
-rw-r--r-- | payloads/libpayload/include/cbgfx.h | 5 |
2 files changed, 21 insertions, 0 deletions
diff --git a/payloads/libpayload/drivers/video/graphics.c b/payloads/libpayload/drivers/video/graphics.c index d9c731b064..d4d08f8fc8 100644 --- a/payloads/libpayload/drivers/video/graphics.c +++ b/payloads/libpayload/drivers/video/graphics.c @@ -194,6 +194,22 @@ int clear_canvas(struct rgb_color *rgb) return draw_box(&box, rgb); } +int clear_screen(struct rgb_color *rgb) +{ + uint32_t color; + struct vector p; + + if (cbgfx_init()) + return CBGFX_ERROR_INIT; + + color = calculate_color(rgb); + for (p.y = 0; p.y < screen.size.height; p.y++) + for (p.x = 0; p.x < screen.size.width; p.x++) + set_pixel(&p, color); + + return CBGFX_SUCCESS; +} + /* * This check guarantees we will not try to read outside pixel data. */ diff --git a/payloads/libpayload/include/cbgfx.h b/payloads/libpayload/include/cbgfx.h index 2d6b6e938a..3c28a13cb4 100644 --- a/payloads/libpayload/include/cbgfx.h +++ b/payloads/libpayload/include/cbgfx.h @@ -91,6 +91,11 @@ int draw_box(const struct rect *box, const struct rgb_color *rgb); int clear_canvas(struct rgb_color *rgb); /* + * Clear the screen + */ +int clear_screen(struct rgb_color *rgb); + +/* * Draw a bitmap image on screen. * * top_left_rel: coordinate of the top left corner of the image relative to the |