video: Add a function to draw a rectangle

Provide a way to draw an unfilled box of a certain width. This is useful
for grouping menu items together.

Add a comment showing how to see the copy-framebuffer, for testing.

Signed-off-by: Simon Glass <sjg@chromium.org>
This commit is contained in:
Simon Glass
2025-04-02 06:29:43 +13:00
committed by Tom Rini
parent cb32266d4a
commit f94f1f4b8c
3 changed files with 75 additions and 1 deletions

View File

@@ -249,7 +249,7 @@ int video_fill(struct udevice *dev, u32 colour);
/**
* video_fill_part() - Erase a region
*
* Erase a rectangle of the display within the given bounds.
* Erase a rectangle on the display within the given bounds
*
* @dev: Device to update
* @xstart: X start position in pixels from the left
@@ -262,6 +262,23 @@ int video_fill(struct udevice *dev, u32 colour);
int video_fill_part(struct udevice *dev, int xstart, int ystart, int xend,
int yend, u32 colour);
/**
* video_draw_box() - Draw a box
*
* Draw a rectangle on the display within the given bounds
*
* @dev: Device to update
* @x0: X start position in pixels from the left
* @y0: Y start position in pixels from the top
* @x1: X end position in pixels from the left
* @y1: Y end position in pixels from the top
* @width: width in pixels
* @colour: Value to write
* Return: 0 if OK, -ENOSYS if the display depth is not supported
*/
int video_draw_box(struct udevice *dev, int x0, int y0, int x1, int y1,
int width, u32 colour);
/**
* video_sync() - Sync a device's frame buffer with its hardware
*