From f94f1f4b8ce62855693b4b48356f7e8d229b3fa4 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Wed, 2 Apr 2025 06:29:43 +1300 Subject: 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 --- test/dm/video.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'test') diff --git a/test/dm/video.c b/test/dm/video.c index dd06b2f58e8..ecf74605b5c 100644 --- a/test/dm/video.c +++ b/test/dm/video.c @@ -902,3 +902,24 @@ static int dm_test_video_silence(struct unit_test_state *uts) return 0; } DM_TEST(dm_test_video_silence, UTF_SCAN_FDT); + +/* test drawing a box */ +static int dm_test_video_box(struct unit_test_state *uts) +{ + struct video_priv *priv; + struct udevice *dev; + + ut_assertok(video_get_nologo(uts, &dev)); + priv = dev_get_uclass_priv(dev); + video_draw_box(dev, 100, 100, 200, 200, 3, + video_index_to_colour(priv, VID_LIGHT_BLUE)); + video_draw_box(dev, 300, 100, 400, 200, 1, + video_index_to_colour(priv, VID_MAGENTA)); + video_draw_box(dev, 500, 100, 600, 200, 20, + video_index_to_colour(priv, VID_LIGHT_RED)); + ut_asserteq(133, video_compress_fb(uts, dev, false)); + ut_assertok(video_check_copy_fb(uts, dev)); + + return 0; +} +DM_TEST(dm_test_video_box, UTF_SCAN_FDT); -- cgit v1.3.1