aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoursoir <chat@joursoir.net>2022-05-10 01:30:31 +0300
committerJoursoir <chat@joursoir.net>2022-05-10 01:30:31 +0300
commit4234e13c3542ca769c21f6cde9207550bda0d8dd (patch)
treebf0f111cd1674719fd282bc09607c46e741275a4
parent73fb0ea5dade3b2a2377f3b2309b07727c416c8f (diff)
downloadumt-4234e13c3542ca769c21f6cde9207550bda0d8dd.tar.gz
umt-4234e13c3542ca769c21f6cde9207550bda0d8dd.tar.bz2
umt-4234e13c3542ca769c21f6cde9207550bda0d8dd.zip
graphics: store color names
-rw-r--r--UefiMonitorTest/Graphics.c34
-rw-r--r--UefiMonitorTest/Graphics.h7
-rw-r--r--UefiMonitorTest/MainMenu.c18
-rw-r--r--UefiMonitorTest/UefiMonitorTestStrings.uni19
-rw-r--r--UefiMonitorTest/tests/SolidColors.c10
5 files changed, 56 insertions, 32 deletions
diff --git a/UefiMonitorTest/Graphics.c b/UefiMonitorTest/Graphics.c
index 592f674..a9c0290 100644
--- a/UefiMonitorTest/Graphics.c
+++ b/UefiMonitorTest/Graphics.c
@@ -24,23 +24,23 @@ CONST EFI_PIXEL_BITMASK mBgrPixelMasks = {
0x00ff0000, 0x0000ff00, 0x000000ff, 0xff000000
};
-CONST GRAPHICS_PIXEL_COLOR gUmtColors[UMT_COLOR_END] = {
- { 0x00, 0x00, 0x00, 0x00 },
- { 0xFF, 0xFF, 0xFF, 0x00 },
- { 0x00, 0x00, 0xFF, 0x00 },
- { 0x00, 0xFF, 0x00, 0x00 },
- { 0xFF, 0x00, 0x00, 0x00 },
- { 0x00, 0xFF, 0xFF, 0x00 },
- { 0xFF, 0xFF, 0x00, 0x00 },
- { 0xFF, 0x00, 0xFF, 0x00 },
- { 0xC0, 0xC0, 0xC0, 0x00 },
- { 0x80, 0x80, 0x80, 0x00 },
- { 0x00, 0x00, 0x80, 0x00 },
- { 0x00, 0x80, 0x80, 0x00 },
- { 0x00, 0x80, 0x00, 0x00 },
- { 0x80, 0x00, 0x80, 0x00 },
- { 0x80, 0x80, 0x00, 0x00 },
- { 0x80, 0x00, 0x00, 0x00 }
+CONST UMT_COLORS gUmtColors[UMT_COLOR_END] = {
+ { STRING_TOKEN (STR_COLOR_BLACK), { 0x00, 0x00, 0x00, 0x00 } },
+ { STRING_TOKEN (STR_COLOR_WHITE), { 0xFF, 0xFF, 0xFF, 0x00 } },
+ { STRING_TOKEN (STR_COLOR_RED), { 0x00, 0x00, 0xFF, 0x00 } },
+ { STRING_TOKEN (STR_COLOR_LIME), { 0x00, 0xFF, 0x00, 0x00 } },
+ { STRING_TOKEN (STR_COLOR_BLUE), { 0xFF, 0x00, 0x00, 0x00 } },
+ { STRING_TOKEN (STR_COLOR_YELLOW), { 0x00, 0xFF, 0xFF, 0x00 } },
+ { STRING_TOKEN (STR_COLOR_AQUA), { 0xFF, 0xFF, 0x00, 0x00 } },
+ { STRING_TOKEN (STR_COLOR_MAGENTA), { 0xFF, 0x00, 0xFF, 0x00 } },
+ { STRING_TOKEN (STR_COLOR_SILVER), { 0xC0, 0xC0, 0xC0, 0x00 } },
+ { STRING_TOKEN (STR_COLOR_GRAY), { 0x80, 0x80, 0x80, 0x00 } },
+ { STRING_TOKEN (STR_COLOR_MAROON), { 0x00, 0x00, 0x80, 0x00 } },
+ { STRING_TOKEN (STR_COLOR_OLIVE), { 0x00, 0x80, 0x80, 0x00 } },
+ { STRING_TOKEN (STR_COLOR_GREEN), { 0x00, 0x80, 0x00, 0x00 } },
+ { STRING_TOKEN (STR_COLOR_PURPLE), { 0x80, 0x00, 0x80, 0x00 } },
+ { STRING_TOKEN (STR_COLOR_TEAL), { 0x80, 0x80, 0x00, 0x00 } },
+ { STRING_TOKEN (STR_COLOR_NAVY), { 0x80, 0x00, 0x00, 0x00 } }
};
STATIC
diff --git a/UefiMonitorTest/Graphics.h b/UefiMonitorTest/Graphics.h
index 37484b0..bfa24cd 100644
--- a/UefiMonitorTest/Graphics.h
+++ b/UefiMonitorTest/Graphics.h
@@ -101,7 +101,12 @@ enum UMT_COLORS {
UMT_COLOR_END
};
-extern CONST GRAPHICS_PIXEL_COLOR gUmtColors[];
+typedef struct {
+ EFI_STRING_ID StringId;
+ GRAPHICS_PIXEL_COLOR Color;
+} UMT_COLORS;
+
+extern CONST UMT_COLORS gUmtColors[];
EFI_STATUS
PrepareGraphicsInfo (
diff --git a/UefiMonitorTest/MainMenu.c b/UefiMonitorTest/MainMenu.c
index df13779..03011a6 100644
--- a/UefiMonitorTest/MainMenu.c
+++ b/UefiMonitorTest/MainMenu.c
@@ -31,11 +31,11 @@ MainMenuInit (
RightColX = MiddleColX + (CHAR_PER_COLUMN * FontWidth);
// Background
- PutRect (Graphics, 0, 0, Width, Height, &gUmtColors[UMT_COLOR_NAVY]);
+ PutRect (Graphics, 0, 0, Width, Height, &gUmtColors[UMT_COLOR_NAVY].Color);
DrawHiiStringF (Graphics,
(Width - 24 * FontWidth) / 2,
Height / 2 - RECT_HALF_HEIGHT - (INDENT * 2),
- &gUmtColors[UMT_COLOR_WHITE],
+ &gUmtColors[UMT_COLOR_WHITE].Color,
STRING_TOKEN (STR_MM_TITLE), gUmtHiiHandle, UMT_VERSION);
// Menu
@@ -45,27 +45,27 @@ MainMenuInit (
Width / 2 + RECT_HALF_WIDTH,
Height / 2 + RECT_HALF_HEIGHT,
20,
- &gUmtColors[UMT_COLOR_WHITE]
+ &gUmtColors[UMT_COLOR_WHITE].Color
);
Y = Height / 2 - RECT_HALF_HEIGHT + INDENT + 5;
- DrawHiiStringF (Graphics, LeftColX, Y, &gUmtColors[UMT_COLOR_BLACK],
+ DrawHiiStringF (Graphics, LeftColX, Y, &gUmtColors[UMT_COLOR_BLACK].Color,
STRING_TOKEN (STR_MM_SUBTITLE), gUmtHiiHandle);
Y += FontHeight + INDENT;
- DrawHiiStringF (Graphics, LeftColX, Y, &gUmtColors[UMT_COLOR_BLACK],
+ DrawHiiStringF (Graphics, LeftColX, Y, &gUmtColors[UMT_COLOR_BLACK].Color,
STRING_TOKEN (STR_MM_MENU), gUmtHiiHandle);
Y += (FontHeight * 4) + (INDENT * 2);
- DrawHiiStringF (Graphics, (Width - 9 * FontWidth) / 2, Y, &gUmtColors[UMT_COLOR_BLACK],
+ DrawHiiStringF (Graphics, (Width - 9 * FontWidth) / 2, Y, &gUmtColors[UMT_COLOR_BLACK].Color,
STRING_TOKEN (STR_MM_TIP_TITLE), gUmtHiiHandle);
Y += FontHeight + INDENT;
- DrawHiiStringF (Graphics, LeftColX, Y, &gUmtColors[UMT_COLOR_BLACK],
+ DrawHiiStringF (Graphics, LeftColX, Y, &gUmtColors[UMT_COLOR_BLACK].Color,
STRING_TOKEN (STR_MM_TIP_FIRST), gUmtHiiHandle);
- DrawHiiStringF (Graphics, MiddleColX, Y, &gUmtColors[UMT_COLOR_BLACK],
+ DrawHiiStringF (Graphics, MiddleColX, Y, &gUmtColors[UMT_COLOR_BLACK].Color,
STRING_TOKEN (STR_MM_TIP_SECOND), gUmtHiiHandle);
- DrawHiiStringF (Graphics, RightColX, Y, &gUmtColors[UMT_COLOR_BLACK],
+ DrawHiiStringF (Graphics, RightColX, Y, &gUmtColors[UMT_COLOR_BLACK].Color,
STRING_TOKEN (STR_MM_TIP_THIRD), gUmtHiiHandle);
}
diff --git a/UefiMonitorTest/UefiMonitorTestStrings.uni b/UefiMonitorTest/UefiMonitorTestStrings.uni
index 24dfd65..3e37065 100644
--- a/UefiMonitorTest/UefiMonitorTestStrings.uni
+++ b/UefiMonitorTest/UefiMonitorTestStrings.uni
@@ -2,6 +2,25 @@
#string STR_NULL_STRING #language en-US " "
+// Colors
+
+#string STR_COLOR_BLACK #language en-US "Black"
+#string STR_COLOR_WHITE #language en-US "White"
+#string STR_COLOR_RED #language en-US "Red"
+#string STR_COLOR_LIME #language en-US "Lime"
+#string STR_COLOR_BLUE #language en-US "Blue"
+#string STR_COLOR_YELLOW #language en-US "Yellow"
+#string STR_COLOR_AQUA #language en-US "Aqua"
+#string STR_COLOR_MAGENTA #language en-US "Magenta"
+#string STR_COLOR_SILVER #language en-US "Silver"
+#string STR_COLOR_GRAY #language en-US "Gray"
+#string STR_COLOR_MAROON #language en-US "Maroon"
+#string STR_COLOR_OLIVE #language en-US "Olive"
+#string STR_COLOR_GREEN #language en-US "Green"
+#string STR_COLOR_PURPLE #language en-US "Purple"
+#string STR_COLOR_TEAL #language en-US "Teal"
+#string STR_COLOR_NAVY #language en-US "Navy"
+
// Main Menu
#string STR_MM_TITLE #language en-US "UEFI MONITOR TEST V%s"
diff --git a/UefiMonitorTest/tests/SolidColors.c b/UefiMonitorTest/tests/SolidColors.c
index 18fe922..b0ed993 100644
--- a/UefiMonitorTest/tests/SolidColors.c
+++ b/UefiMonitorTest/tests/SolidColors.c
@@ -13,7 +13,7 @@ SolidColorsTestInit (
{
GRAPHICS_CONTEXT *Graphics = Ctx->Graphics;
- PutRect (Graphics, 0, 0, Graphics->Width, Graphics->Height, &gUmtColors[CurrentColor]);
+ PutRect (Graphics, 0, 0, Graphics->Width, Graphics->Height, &gUmtColors[CurrentColor].Color);
if (Ctx->ShowTip)
SolidColorsTestTip (Ctx);
}
@@ -41,7 +41,7 @@ SolidColorsTestTip (
if (Ctx->ShowTip == FALSE) {
// Restore
- PutRect (Graphics, 15, Graphics->Height - 15 - 104, 470, Graphics->Height - 15, &gUmtColors[CurrentColor]);
+ PutRect (Graphics, 15, Graphics->Height - 15 - 104, 470, Graphics->Height - 15, &gUmtColors[CurrentColor].Color);
return;
}
@@ -76,9 +76,9 @@ SolidColorsTestTip (
Msg = HiiGetString (gUmtHiiHandle, MsgToken, NULL);
DrawRectWithBorder (Graphics, 15, Graphics->Height - 15 - 104, 470, Graphics->Height - 15,
- 3, &gUmtColors[UMT_COLOR_WHITE], &gUmtColors[UMT_COLOR_NAVY]);
- DrawStringF (Graphics, 25, Graphics->Height - 15 - 94, &gUmtColors[UMT_COLOR_NAVY], Title);
- DrawStringF (Graphics, 25, Graphics->Height - 15 - 74, &gUmtColors[UMT_COLOR_BLACK], Msg);
+ 3, &gUmtColors[UMT_COLOR_WHITE].Color, &gUmtColors[UMT_COLOR_NAVY].Color);
+ DrawStringF (Graphics, 25, Graphics->Height - 15 - 94, &gUmtColors[UMT_COLOR_NAVY].Color, Title);
+ DrawStringF (Graphics, 25, Graphics->Height - 15 - 74, &gUmtColors[UMT_COLOR_BLACK].Color, Msg);
FreePool (Title);
FreePool (Msg);