libpayload: cbgfx: Support drawing a box with rounded corners
A function draw_rounded_box() is added to draw a box with rounded corners. In addition, this function is different from draw_box() in 2 ways: - The position and size arguments are relative to the canvas. - This function supports drawing only the border of a box (linear time complexity when the thickness is fixed). BRANCH=none BUG=b:146105976 TEST=emerge-nami libpayload Change-Id: Ie480410d2fd8316462d5ff874999ae2317de04f9 Signed-off-by: Yu-Ping Wu <yupingso@chromium.org> Reviewed-on: https://review.coreboot.org/c/coreboot/+/37757 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Hung-Te Lin <hungte@chromium.org>
This commit is contained in:
committed by
Patrick Georgi
parent
8eef3bf3ca
commit
a26986e1a7
@ -114,6 +114,25 @@ struct rgb_color {
|
||||
*/
|
||||
int draw_box(const struct rect *box, const struct rgb_color *rgb);
|
||||
|
||||
/**
|
||||
* Draw a box with rounded corners on screen.
|
||||
*
|
||||
* @param[in] pos_rel Coordinate of the top left corner of the box relative to
|
||||
* the canvas.
|
||||
* @param[in] dim_rel Width and height of the image relative to the canvas.
|
||||
* @param[in] rgb Color of the border of the box.
|
||||
* @param[in] thickness Thickness of the border relative to the canvas. If zero
|
||||
* is given, the box will be filled with the rgb color.
|
||||
* @param[in] radius Radius of the rounded corners relative to the canvas. A
|
||||
* zero value indicates sharp corners will be drawn.
|
||||
*
|
||||
* @return CBGFX_* error codes
|
||||
*/
|
||||
int draw_rounded_box(const struct scale *pos_rel, const struct scale *dim_rel,
|
||||
const struct rgb_color *rgb,
|
||||
const struct fraction *thickness,
|
||||
const struct fraction *radius);
|
||||
|
||||
/**
|
||||
* Clear the canvas
|
||||
*/
|
||||
|
Reference in New Issue
Block a user