From ef12c6a5c077155ecc152c3cefbb60cd928a6acc Mon Sep 17 00:00:00 2001 From: HyperNiki <102851041+HyperNiki@users.noreply.github.com> Date: Sat, 9 Apr 2022 17:16:59 +0300 Subject: main: add the rect drawing routine --- UefiMonitorTest/UefiMonitorTest.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/UefiMonitorTest/UefiMonitorTest.c b/UefiMonitorTest/UefiMonitorTest.c index 56dbd80..3eb7323 100644 --- a/UefiMonitorTest/UefiMonitorTest.c +++ b/UefiMonitorTest/UefiMonitorTest.c @@ -272,6 +272,39 @@ DrawLine ( } } +STATIC +VOID +PutRect ( + IN GRAPHICS_CONTEXT *Graphics, + IN UINTN X0, + IN UINTN Y0, + IN UINTN X1, + IN UINTN Y1, + GRAPHICS_PIXEL_COLOR *Color + ) +{ + UINT32 *Buffer; + UINT32 Ucolor; + UINT32 Icolor; + UINT32 I, J; + + ASSERT (X0 >= 0 && X0 <= Graphics->Width); + ASSERT (Y0 >= 0 && Y0 <= Graphics->Height); + ASSERT (X1 >= 0 && X1 <= Graphics->Width && X1 >= X0); + ASSERT (Y1 >= 0 && Y1 <= Graphics->Height && Y1 >= Y0); + + Buffer = Graphics->BackBuffer + Y0 * Graphics->Pitch; + Ucolor = *(UINT32 *)Color; + Icolor = GET_ICOLOR(Graphics, Ucolor); + + for (J = Y0; J < Y1; J++) { + for (I = X0; I < X1; I++) { + Buffer[I] = Icolor; + } + Buffer += Graphics->Pitch; + } +} + STATIC EFI_STATUS Run ( -- cgit v1.2.3-18-g5258