OpenCanopy: Require minimum cursor size

This commit is contained in:
Marvin Häuser 2021-05-01 17:16:56 +02:00
parent cfa3c74313
commit 823fceeebd
2 changed files with 16 additions and 2 deletions

View File

@ -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]));

View File

@ -13,10 +13,11 @@
#include <Library/OcBootManagementLib.h>
#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)