aboutsummaryrefslogtreecommitdiffstats
path: root/UefiMonitorTest/UefiMonitorTest.c
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2022-04-02 14:55:15 +0300
committerJoursoir <chat@joursoir.net>2022-04-02 14:55:15 +0300
commit5da1d9b2fa0e2598cb4024a907145b8eb7a0368a (patch)
tree230e2aec39de9feb6f39b246ae6c1cf793d0e802 /UefiMonitorTest/UefiMonitorTest.c
parentaf43c61f3736605ce0f5a2bd9496b167531b5b2f (diff)
downloadumt-5da1d9b2fa0e2598cb4024a907145b8eb7a0368a.tar.gz
umt-5da1d9b2fa0e2598cb4024a907145b8eb7a0368a.tar.bz2
umt-5da1d9b2fa0e2598cb4024a907145b8eb7a0368a.zip
main: add macros to draw a pixel, get independent color
Using function to draw a pixel is too inefficient
Diffstat (limited to 'UefiMonitorTest/UefiMonitorTest.c')
-rw-r--r--UefiMonitorTest/UefiMonitorTest.c40
1 files changed, 13 insertions, 27 deletions
diff --git a/UefiMonitorTest/UefiMonitorTest.c b/UefiMonitorTest/UefiMonitorTest.c
index 8d67c83..708bf2d 100644
--- a/UefiMonitorTest/UefiMonitorTest.c
+++ b/UefiMonitorTest/UefiMonitorTest.c
@@ -12,6 +12,19 @@
#include "UefiMonitorTest.h"
+#define GET_ICOLOR(Graphics, Ucolor) \
+ (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) \
+ )
+
+#define PUT_PUXEL(Graphics, X, Y, Icolor) \
+ Graphics->BackBuffer[X + (Y * Graphics->Pitch)] = Icolor
+
CONST EFI_PIXEL_BITMASK mRgbPixelMasks = {
0x000000ff, 0x0000ff00, 0x00ff0000, 0xff000000
};
@@ -181,33 +194,6 @@ 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 (