From 823fceeebdf4da0b2f66b8fadaa0d074c4235dcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marvin=20H=C3=A4user?= <8659494+mhaeuser@users.noreply.github.com> Date: Sat, 1 May 2021 17:16:56 +0200 Subject: [PATCH] OpenCanopy: Require minimum cursor size --- Platform/OpenCanopy/GuiApp.c | 13 +++++++++++++ Platform/OpenCanopy/GuiApp.h | 5 +++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/Platform/OpenCanopy/GuiApp.c b/Platform/OpenCanopy/GuiApp.c index a83074af..60b4c5e8 100644 --- a/Platform/OpenCanopy/GuiApp.c +++ b/Platform/OpenCanopy/GuiApp.c @@ -445,6 +445,19 @@ InternalContextConstruct ( ICON_GENERIC_HDD < ICON_NUM_MANDATORY, "The base icon should must be cleaned up explicitly." ); + } else if (Index == ICON_CURSOR) { + if (Context->Icons[ICON_CURSOR][ICON_TYPE_BASE].Width < MIN_CURSOR_DIMENSION * Context->Scale + || Context->Icons[ICON_CURSOR][ICON_TYPE_BASE].Height < MIN_CURSOR_DIMENSION * Context->Scale) { + DEBUG (( + DEBUG_INFO, + "OCUI: Expected at least %dx%d for cursor, actual %dx%d\n", + MIN_CURSOR_DIMENSION * Context->Scale, + MIN_CURSOR_DIMENSION * Context->Scale, + Context->Icons[ICON_CURSOR][ICON_TYPE_BASE].Width, + Context->Icons[ICON_CURSOR][ICON_TYPE_BASE].Height + )); + Status = EFI_UNSUPPORTED; + } } } else { ZeroMem (&Context->Icons[Index], sizeof (Context->Icons[Index])); diff --git a/Platform/OpenCanopy/GuiApp.h b/Platform/OpenCanopy/GuiApp.h index 78e20643..9143558a 100644 --- a/Platform/OpenCanopy/GuiApp.h +++ b/Platform/OpenCanopy/GuiApp.h @@ -13,10 +13,11 @@ #include -#define MAX_CURSOR_DIMENSION 144U - #define BOOT_CURSOR_OFFSET 4U +#define MAX_CURSOR_DIMENSION 144U +#define MIN_CURSOR_DIMENSION BOOT_CURSOR_OFFSET + #define BOOT_ENTRY_DIMENSION 144U #define BOOT_ENTRY_ICON_DIMENSION APPLE_DISK_ICON_DIMENSION #define BOOT_ENTRY_ICON_SPACE ((BOOT_ENTRY_DIMENSION - BOOT_ENTRY_ICON_DIMENSION) / 2)