From 0c2bba19840f78fbea8da299ff30fa4f5d09e125 Mon Sep 17 00:00:00 2001 From: Joursoir Date: Sun, 10 Apr 2022 15:24:40 +0300 Subject: main: add the char drawing routine --- UefiMonitorTest/UefiMonitorTest.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/UefiMonitorTest/UefiMonitorTest.c b/UefiMonitorTest/UefiMonitorTest.c index 3eb7323..1b6e026 100644 --- a/UefiMonitorTest/UefiMonitorTest.c +++ b/UefiMonitorTest/UefiMonitorTest.c @@ -11,6 +11,7 @@ #include #include "UefiMonitorTest.h" +#include "fonts/System-8x16.h" #define SWAP(A, B, C) \ C = A; \ @@ -305,6 +306,35 @@ PutRect ( } } +/** + Draws a character to the screen + + @retval VOID +**/ +STATIC +VOID +DrawChar ( + IN GRAPHICS_CONTEXT *Graphics, + IN UINTN X, + IN UINTN Y, + IN UINT32 Icolor, + IN CHAR16 Char + ) +{ + UINTN Index; + UINTN l, c; + + Index = Char * (SYSTEM8X16_FONT_WIDTH * SYSTEM8X16_FONT_HEIGHT) - (SYSTEM8X16_FONT_WIDTH * SYSTEM8X16_FONT_HEIGHT); + for (l = 0; l < SYSTEM8X16_FONT_HEIGHT; l++) { + for (c = 0; c < SYSTEM8X16_FONT_WIDTH; c++) { + if (gFontSystem8x16[Index] == 1) { + PUT_PUXEL (Graphics, (X + c), (Y + l), Icolor); + } + Index++; + } + } +} + STATIC EFI_STATUS Run ( -- cgit v1.2.3-18-g5258