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