aboutsummaryrefslogtreecommitdiffstats
path: root/UefiMonitorTest/tests/Grayscale.c
blob: 7b41414a511c19bdec765927343eb3a23b8966b4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
#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
GrayscaleTestDoit (
  IN UMT_CONTEXT *Ctx
  )
{

}

VOID
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
)
{

}

VOID
GrayscaleTestChangeValue (
  IN  UMT_CONTEXT *Ctx,
  IN  INT8        ValueStep
  )
{
  if (CurrentGrayTone == 5 && ValueStep < 0) {
    return;
  } else {
    CurrentGrayTone += ValueStep * 5;
    if (CurrentGrayTone > 95)
    {
      CurrentGrayTone = 95;
      return;
    }
  }

  GrayscaleTestInit (Ctx);
}