aboutsummaryrefslogtreecommitdiffstats
path: root/UefiMonitorTest/tests
diff options
context:
space:
mode:
authorNikita <102851041+HyperNiki@users.noreply.github.com>2022-05-14 10:29:24 +0300
committerGitHub <noreply@github.com>2022-05-14 10:29:24 +0300
commit2b1649ef3fbd3801706be5d529daa523e16e49ea (patch)
treecb78a730b382ba6ce95c7b622f386f14e761f9a1 /UefiMonitorTest/tests
parent08d27be07efcc802dd648e1c957662d654b7cb64 (diff)
downloadumt-2b1649ef3fbd3801706be5d529daa523e16e49ea.tar.gz
umt-2b1649ef3fbd3801706be5d529daa523e16e49ea.tar.bz2
umt-2b1649ef3fbd3801706be5d529daa523e16e49ea.zip
implement the grayscale test
Diffstat (limited to 'UefiMonitorTest/tests')
-rw-r--r--UefiMonitorTest/tests/Grayscale.c64
1 files changed, 63 insertions, 1 deletions
diff --git a/UefiMonitorTest/tests/Grayscale.c b/UefiMonitorTest/tests/Grayscale.c
index eb1bf9a..7b41414 100644
--- a/UefiMonitorTest/tests/Grayscale.c
+++ b/UefiMonitorTest/tests/Grayscale.c
@@ -1,11 +1,33 @@
+#include <Library/DebugLib.h>
+#include <Library/HiiLib.h>
+#include <Library/MemoryAllocationLib.h>
+
#include "Grayscale.h"
+STATIC UINT32 CurrentGrayTone = 50;
+
VOID
GrayscaleTestInit (
IN UMT_CONTEXT *Ctx
)
{
+ GRAPHICS_PIXEL_COLOR ColorOutput = { 0x00 };
+ GRAPHICS_CONTEXT *Graphics = Ctx->Graphics;
+
+ ColorOutput.Red = (CurrentGrayTone * 255) / 100;
+ ColorOutput.Green = (CurrentGrayTone * 255) / 100;
+ ColorOutput.Blue = (CurrentGrayTone * 255) / 100;
+ PutRect (Graphics,
+ 0,
+ 0,
+ Graphics->Width,
+ Graphics->Height,
+ &ColorOutput);
+
+ if (Ctx->ShowTip) {
+ GrayscaleTestTip (Ctx);
+ }
}
VOID
@@ -21,14 +43,43 @@ GrayscaleTestTip (
IN UMT_CONTEXT *Ctx
)
{
+ GRAPHICS_CONTEXT *Graphics;
+
+ Graphics = Ctx->Graphics;
+ if (Ctx->ShowTip == FALSE) {
+ // Restore
+ GrayscaleTestInit (Ctx);
+ return;
+ }
+
+ DrawRectWithBorder (Graphics,
+ 15,
+ Graphics->Height - 15 - 134,
+ 430, Graphics->Height - 15,
+ 3,
+ &gUmtColors[UMT_COLOR_WHITE].Color,
+ &gUmtColors[UMT_COLOR_NAVY].Color);
+
+ DrawHiiStringF (Graphics,
+ 25,
+ Graphics->Height - 15 - 124,
+ &gUmtColors[UMT_COLOR_NAVY].Color,
+ STRING_TOKEN (STR_GRAYSCALE_TITLE), gUmtHiiHandle);
+
+ DrawHiiStringF (Graphics,
+ 25,
+ Graphics->Height - 15 - 104,
+ &gUmtColors[UMT_COLOR_BLACK].Color,
+ STRING_TOKEN (STR_GRAYSCALE_MSG), gUmtHiiHandle,
+ CurrentGrayTone);
}
VOID
GrayscaleTestChangeParam (
IN UMT_CONTEXT *Ctx,
IN INT8 ParamStep
- )
+)
{
}
@@ -39,5 +90,16 @@ GrayscaleTestChangeValue (
IN INT8 ValueStep
)
{
+ if (CurrentGrayTone == 5 && ValueStep < 0) {
+ return;
+ } else {
+ CurrentGrayTone += ValueStep * 5;
+ if (CurrentGrayTone > 95)
+ {
+ CurrentGrayTone = 95;
+ return;
+ }
+ }
+ GrayscaleTestInit (Ctx);
}