summaryrefslogtreecommitdiff
path: root/payloads/libpayload/include
diff options
context:
space:
mode:
authorYu-Ping Wu <yupingso@chromium.org>2019-12-13 17:13:42 +0800
committerPatrick Georgi <pgeorgi@google.com>2020-01-14 18:25:36 +0000
commita26986e1a7b9ae26224454ec453bba7738a54d55 (patch)
tree086da36420a343acdc5102d7dc5f2a5191885cb0 /payloads/libpayload/include
parent8eef3bf3ca27e8a79862422fe9ee0c505b0567cc (diff)
downloadcoreboot-a26986e1a7b9ae26224454ec453bba7738a54d55.tar.xz
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>
Diffstat (limited to 'payloads/libpayload/include')
-rw-r--r--payloads/libpayload/include/cbgfx.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/payloads/libpayload/include/cbgfx.h b/payloads/libpayload/include/cbgfx.h
index cffc7fd7a6..3276867cb2 100644
--- a/payloads/libpayload/include/cbgfx.h
+++ b/payloads/libpayload/include/cbgfx.h
@@ -115,6 +115,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
*/
int clear_canvas(const struct rgb_color *rgb);