aboutsummaryrefslogtreecommitdiffstats
path: root/UefiMonitorTest/UefiMonitorTest.c
diff options
context:
space:
mode:
authorNikita <102851041+HyperNiki@users.noreply.github.com>2022-04-18 11:22:06 +0300
committerGitHub <noreply@github.com>2022-04-18 08:22:06 +0000
commit51b4786f58650c4a95f8a1c7e10d7302ae787ad9 (patch)
tree20a981b56e266d30d463c35a98a2ac80dda1348e /UefiMonitorTest/UefiMonitorTest.c
parent789541a9b34b74f82af02fc4e7f4d7a0bc31e4c2 (diff)
downloadumt-51b4786f58650c4a95f8a1c7e10d7302ae787ad9.tar.gz
umt-51b4786f58650c4a95f8a1c7e10d7302ae787ad9.tar.bz2
umt-51b4786f58650c4a95f8a1c7e10d7302ae787ad9.zip
main: add the filled circle drawing routine
Diffstat (limited to 'UefiMonitorTest/UefiMonitorTest.c')
-rw-r--r--UefiMonitorTest/UefiMonitorTest.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/UefiMonitorTest/UefiMonitorTest.c b/UefiMonitorTest/UefiMonitorTest.c
index 5bd56cd..ecffb3c 100644
--- a/UefiMonitorTest/UefiMonitorTest.c
+++ b/UefiMonitorTest/UefiMonitorTest.c
@@ -309,6 +309,41 @@ PutRect (
}
}
+STATIC
+VOID
+DrawCircle (
+ IN GRAPHICS_CONTEXT *Graphics,
+ IN UINTN X0,
+ IN UINTN Y0,
+ IN UINTN R,
+ GRAPHICS_PIXEL_COLOR *Color
+)
+{
+ UINT32 *Buffer;
+ UINT32 Ucolor;
+ UINT32 Icolor;
+ UINT32 I, J;
+
+ ASSERT (X0 >= 0 && X0 < Graphics->Width);
+ ASSERT (Y0 >= 0 && Y0 < Graphics->Height);
+ ASSERT (R > 0);
+ ASSERT ((X0 + R) < Graphics->Width && X0 >= R);
+ ASSERT ((Y0 + R) < Graphics->Height && Y0 >= R);
+
+ Ucolor = *(UINT32 *)Color;
+ Icolor = GET_ICOLOR(Graphics, Ucolor);
+ Buffer = Graphics->BackBuffer + (Y0 - R) * Graphics->Pitch;
+
+ for (J = (Y0 - R); J <= (Y0 + R); J++) {
+ for (I = (X0 - R); I <= (X0 + R); I++) {
+ if ((J - Y0) * (J - Y0) + (I - X0) * (I - X0) <= (R * R)) {
+ Buffer[I] = Icolor;
+ }
+ }
+ Buffer += Graphics->Pitch;
+ }
+}
+
/**
Draws a character to the screen