aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2022-03-27 10:20:44 +0300
committerJoursoir <chat@joursoir.net>2022-03-27 10:20:44 +0300
commit45e788abaf9010efacee53733b449b19a43cd02c (patch)
treefc5949adb1a0200cce98ed59e4f9a1eeea4b732e
parent3a21582ba3d4c4eac6401114484c0a8ae3bc5c16 (diff)
downloadumt-45e788abaf9010efacee53733b449b19a43cd02c.tar.gz
umt-45e788abaf9010efacee53733b449b19a43cd02c.tar.bz2
umt-45e788abaf9010efacee53733b449b19a43cd02c.zip
main: add draw pixel routine
-rw-r--r--UefiMonitorTest/UefiMonitorTest.c27
1 files changed, 27 insertions, 0 deletions
diff --git a/UefiMonitorTest/UefiMonitorTest.c b/UefiMonitorTest/UefiMonitorTest.c
index f84c00a..763a263 100644
--- a/UefiMonitorTest/UefiMonitorTest.c
+++ b/UefiMonitorTest/UefiMonitorTest.c
@@ -180,6 +180,33 @@ GetGraphicsOutputProtocol (
return Gop;
}
+STATIC
+VOID
+PutPixel (
+ IN GRAPHICS_CONTEXT *Graphics,
+ IN UINTN X,
+ IN UINTN Y,
+ GRAPHICS_PIXEL_COLOR *Color
+ )
+{
+ UINT32 *Buffer;
+ UINT32 Ucolor;
+
+ ASSERT (X >= 0 && X <= Graphics->Width);
+ ASSERT (Y >= 0 && Y <= Graphics->Height);
+
+ Buffer = (UINT32 *)(Graphics->BackBuffer + (X * Graphics->PixelWidth) + (Y * Graphics->Pitch));
+ Ucolor = *(UINT32 *)Color;
+ *Buffer = (UINT32)(
+ (((Ucolor << Graphics->PixelShl[0]) >> Graphics->PixelShr[0]) &
+ Graphics->PixelMasks.RedMask) |
+ (((Ucolor << Graphics->PixelShl[1]) >> Graphics->PixelShr[1]) &
+ Graphics->PixelMasks.GreenMask) |
+ (((Ucolor << Graphics->PixelShl[2]) >> Graphics->PixelShr[2]) &
+ Graphics->PixelMasks.BlueMask)
+ );
+}
+
EFI_STATUS
EFIAPI
UefiMain (