mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-10 09:40:53 +01:00
Get SelectionImage to work.
This commit is contained in:
parent
ddccb001e6
commit
418b4f4cc3
@ -2074,7 +2074,7 @@ AddCard (
|
||||
|
||||
EG_IMAGE
|
||||
*egDecodePNG (
|
||||
IN UINT8 *FileData,
|
||||
IN const UINT8 *FileData,
|
||||
IN UINTN FileDataLength,
|
||||
IN BOOLEAN WantAlpha
|
||||
);
|
||||
|
@ -112,7 +112,8 @@ const XStringW& XStringW::takeValueFrom(const wchar_t* S, xsize count)
|
||||
|
||||
const XStringW& XStringW::takeValueFrom(const wchar_t* S)
|
||||
{
|
||||
return takeValueFrom(S, wcslen(S));
|
||||
if ( S ) return takeValueFrom(S, wcslen(S));
|
||||
Init(0);
|
||||
}
|
||||
|
||||
const XStringW& XStringW::takeValueFrom(const char* S)
|
||||
|
@ -472,19 +472,23 @@ EFI_STATUS XTheme::ParseSVGXTheme(CONST CHAR8* buffer)
|
||||
|
||||
// --- Make other icons
|
||||
|
||||
Icons.Empty();
|
||||
for (INTN i = BUILTIN_ICON_FUNC_ABOUT; i < BUILTIN_CHECKBOX_CHECKED; ++i) {
|
||||
if (i == BUILTIN_ICON_BANNER) {
|
||||
continue;
|
||||
}
|
||||
Icon NewIcon(i); //initialize with embedded but further replace by loaded
|
||||
ParseSVGXIcon(mainParser, i, NewIcon.Name, Scale, &NewIcon.Image);
|
||||
ParseSVGXIcon(mainParser, i, NewIcon.Name + "_night", Scale, &NewIcon.ImageNight);
|
||||
Icons.AddCopy(NewIcon);
|
||||
Icon* NewIcon = new Icon(i); //initialize with embedded but further replace by loaded
|
||||
ParseSVGXIcon(mainParser, i, NewIcon->Name, Scale, &NewIcon->Image);
|
||||
ParseSVGXIcon(mainParser, i, NewIcon->Name + "_night", Scale, &NewIcon->ImageNight);
|
||||
Icons.AddReference(NewIcon, true);
|
||||
}
|
||||
|
||||
//selections
|
||||
SelectionImages[0] = GetIcon(BUILTIN_SELECTION_BIG);
|
||||
SelectionImages[2] = GetIcon(BUILTIN_SELECTION_SMALL);
|
||||
//for (int i=0 ; i<6 ; i++ ) {
|
||||
//SelectionImages[i].Draw(i*200, 0);
|
||||
//}
|
||||
|
||||
//selection for bootcamp style
|
||||
Status = EFI_NOT_FOUND;
|
||||
|
@ -225,11 +225,11 @@ const XImage& XTheme::GetIcon(INTN Id)
|
||||
}
|
||||
return NullIcon;
|
||||
}
|
||||
|
||||
void XTheme::AddIcon(Icon& NewIcon)
|
||||
{
|
||||
Icons.AddCopy(NewIcon);
|
||||
}
|
||||
//
|
||||
//void XTheme::AddIcon(Icon& NewIcon)
|
||||
//{
|
||||
// Icons.AddCopy(NewIcon);
|
||||
//}
|
||||
|
||||
//if ImageNight is not set then Image should be used
|
||||
#define DEC_BUILTIN_ICON(id, ico) { \
|
||||
@ -340,9 +340,10 @@ Icon::Icon(INTN Index) : Image(0), ImageNight(0)
|
||||
|
||||
void XTheme::FillByEmbedded()
|
||||
{
|
||||
Icons.Empty();
|
||||
for (INTN i = 0; i < BUILTIN_ICON_COUNT; ++i) {
|
||||
Icon NewIcon(i);
|
||||
Icons.AddCopy(NewIcon);
|
||||
Icon* NewIcon = new Icon(i);
|
||||
Icons.AddReference(NewIcon, true);
|
||||
}
|
||||
//radio buttons will be inited by InitSelection()
|
||||
}
|
||||
@ -614,11 +615,12 @@ void XTheme::InitSelection() //for PNG theme
|
||||
//use this only for PNG theme
|
||||
void XTheme::FillByDir() //assume ThemeDir is defined by InitTheme() procedure
|
||||
{
|
||||
Icons.Empty();
|
||||
for (INTN i = 0; i <= BUILTIN_CHECKBOX_CHECKED; ++i) {
|
||||
Icon NewIcon(i); //initialize with embedded but further replace by loaded
|
||||
NewIcon.Image.LoadXImage(ThemeDir, IconsNames[i]);
|
||||
NewIcon.ImageNight.LoadXImage(ThemeDir, SWPrintf("%s_night", IconsNames[i]));
|
||||
Icons.AddCopy(NewIcon);
|
||||
Icon* NewIcon = new Icon(i); //initialize with embedded but further replace by loaded
|
||||
NewIcon->Image.LoadXImage(ThemeDir, IconsNames[i]);
|
||||
NewIcon->ImageNight.LoadXImage(ThemeDir, SWPrintf("%s_night", IconsNames[i]));
|
||||
Icons.AddReference(NewIcon, true);
|
||||
}
|
||||
|
||||
InitSelection(); //initialize selections, buttons
|
||||
|
@ -22,6 +22,9 @@ public:
|
||||
Icon(INTN Id);
|
||||
~Icon();
|
||||
|
||||
// Default are not valid, as usual. We delete them. If needed, proper ones can be created
|
||||
Icon(const Icon&) = delete;
|
||||
Icon& operator=(const Icon&) = delete;
|
||||
};
|
||||
|
||||
class XTheme
|
||||
@ -115,7 +118,7 @@ public:
|
||||
const XImage& GetIcon(const CHAR16* Name);
|
||||
const XImage& GetIcon(INTN Id); //get by id
|
||||
|
||||
void AddIcon(Icon& NewIcon); //return EFI_STATUS?
|
||||
// void AddIcon(Icon& NewIcon); //return EFI_STATUS?
|
||||
void FillByEmbedded();
|
||||
void FillByDir();
|
||||
EFI_STATUS GetThemeTagSettings (void* DictPointer);
|
||||
|
@ -872,7 +872,7 @@ EG_IMAGE * egEnsureImageSize(IN EG_IMAGE *Image, IN INTN Width, IN INTN Height,
|
||||
// misc internal functions
|
||||
//
|
||||
|
||||
EG_IMAGE * egDecodePNG(IN UINT8 *FileData, IN UINTN FileDataLength, IN BOOLEAN WantAlpha) {
|
||||
EG_IMAGE * egDecodePNG(IN const UINT8 *FileData, IN UINTN FileDataLength, IN BOOLEAN WantAlpha) {
|
||||
EG_IMAGE *NewImage = NULL;
|
||||
UINTN Error, i, ImageSize;
|
||||
size_t Width, Height;
|
||||
|
@ -176,7 +176,7 @@ VOID egRawComposeOnFlat(IN OUT EG_PIXEL *CompBasePtr, IN EG_PIXEL *TopBasePtr,
|
||||
//EG_IMAGE * egDecodeBMP(IN UINT8 *FileData, IN UINTN FileDataLength, IN UINTN IconSize, IN BOOLEAN WantAlpha);
|
||||
EG_IMAGE * egDecodeICNS(IN UINT8 *FileData, IN UINTN FileDataLength, IN UINTN IconSize, IN BOOLEAN WantAlpha);
|
||||
|
||||
EG_IMAGE * egDecodePNG(IN UINT8 *FileData, IN UINTN FileDataLength, IN BOOLEAN WantAlpha);
|
||||
EG_IMAGE * egDecodePNG(IN const UINT8 *FileData, IN UINTN FileDataLength, IN BOOLEAN WantAlpha);
|
||||
|
||||
|
||||
//VOID egEncodeBMP(IN EG_IMAGE *Image, OUT UINT8 **FileData, OUT UINTN *FileDataLength);
|
||||
|
Loading…
Reference in New Issue
Block a user