From 799b75d1a6ef41d96b4bee2b92733e0ad1e6f462 Mon Sep 17 00:00:00 2001 From: Joursoir Date: Thu, 28 Apr 2022 00:46:59 +0300 Subject: graphics: add the bordered rectangle drawing routine --- UefiMonitorTest/Graphics.c | 23 +++++++++++++++++++++++ UefiMonitorTest/Graphics.h | 12 ++++++++++++ 2 files changed, 35 insertions(+) diff --git a/UefiMonitorTest/Graphics.c b/UefiMonitorTest/Graphics.c index 0570dd8..fc9571c 100644 --- a/UefiMonitorTest/Graphics.c +++ b/UefiMonitorTest/Graphics.c @@ -335,6 +335,29 @@ PutRect ( } } +VOID +DrawRectWithBorder ( + IN GRAPHICS_CONTEXT *Graphics, + IN UINTN X0, + IN UINTN Y0, + IN UINTN X1, + IN UINTN Y1, + IN UINTN BorderSize, + IN CONST GRAPHICS_PIXEL_COLOR *MainColor, + IN CONST GRAPHICS_PIXEL_COLOR *BorderColor + ) +{ + UINT8 Index; + + for (Index = 0; Index < BorderSize; Index++) { + DrawLine (Graphics, X0 , Y0 + Index , X1 - 1 , Y0 + Index , BorderColor); + DrawLine (Graphics, X0 + Index , Y0 , X0 + Index , Y1 - 1 , BorderColor); + DrawLine (Graphics, X1 - 1 - Index, Y0 , X1 - 1 - Index, Y1 - 1 , BorderColor); + DrawLine (Graphics, X0 , Y1 - 1 - Index, X1 - 1 , Y1 - 1 - Index, BorderColor); + } + PutRect (Graphics, X0 + BorderSize, Y0 + BorderSize, X1 - BorderSize, Y1 - BorderSize, MainColor); +} + VOID DrawCircle ( IN GRAPHICS_CONTEXT *Graphics, diff --git a/UefiMonitorTest/Graphics.h b/UefiMonitorTest/Graphics.h index 503a222..6396098 100644 --- a/UefiMonitorTest/Graphics.h +++ b/UefiMonitorTest/Graphics.h @@ -137,6 +137,18 @@ PutRect ( IN CONST GRAPHICS_PIXEL_COLOR *Color ); +VOID +DrawRectWithBorder ( + IN GRAPHICS_CONTEXT *Graphics, + IN UINTN X0, + IN UINTN Y0, + IN UINTN X1, + IN UINTN Y1, + IN UINTN BorderSize, + IN CONST GRAPHICS_PIXEL_COLOR *MainColor, + IN CONST GRAPHICS_PIXEL_COLOR *BorderColor + ); + VOID DrawCircle ( IN GRAPHICS_CONTEXT *Graphics, -- cgit v1.2.3-18-g5258