mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-11-10 09:40:53 +01:00
refactoring DrawText and Pixels
Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
parent
fbfc206a41
commit
f70c4e14d2
@ -804,7 +804,7 @@ struct RT_VARIABLES {
|
||||
CHAR16 *Name;
|
||||
EFI_GUID VarGuid;
|
||||
};
|
||||
|
||||
//no more used?
|
||||
typedef struct CUSTOM_LOADER_ENTRY CUSTOM_LOADER_ENTRY;
|
||||
struct CUSTOM_LOADER_ENTRY {
|
||||
CUSTOM_LOADER_ENTRY *Next;
|
||||
@ -827,8 +827,12 @@ struct CUSTOM_LOADER_ENTRY {
|
||||
UINT8 KernelScan;
|
||||
UINT8 CustomBoot;
|
||||
EG_IMAGE *CustomLogo;
|
||||
EG_PIXEL *BootBgColor;
|
||||
KERNEL_AND_KEXT_PATCHES KernelAndKextPatches; //zzzz
|
||||
#if USE_XTHEME
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL BootBgColor;
|
||||
#else
|
||||
EG_PIXEL *BootBgColor; //why it is array? It is one value!
|
||||
#endif
|
||||
KERNEL_AND_KEXT_PATCHES KernelAndKextPatches;
|
||||
};
|
||||
|
||||
typedef struct CUSTOM_LEGACY_ENTRY CUSTOM_LEGACY_ENTRY;
|
||||
|
@ -96,7 +96,7 @@ EG_IMAGE *Buttons[4] = {NULL, NULL, NULL, NULL};
|
||||
INTN row0TileSize = 144;
|
||||
INTN row1TileSize = 64;
|
||||
#endif
|
||||
EG_PIXEL SelectionBackgroundPixel = { 0xef, 0xef, 0xef, 0xff }; //non-trasparent
|
||||
//EG_PIXEL SelectionBackgroundPixel = { 0xef, 0xef, 0xef, 0xff }; //define in lib.h
|
||||
const INTN BCSMargin = 11;
|
||||
BOOLEAN DayLight;
|
||||
|
||||
@ -1002,10 +1002,13 @@ CUSTOM_LOADER_ENTRY
|
||||
if (Entry->DriveImagePath) {
|
||||
DuplicateEntry->DriveImagePath = EfiStrDuplicate (Entry->DriveImagePath);
|
||||
}
|
||||
|
||||
#if USE_XTHEME
|
||||
DuplicateEntry->BootBgColor = Entry->BootBgColor;
|
||||
#else
|
||||
if (Entry->BootBgColor) {
|
||||
DuplicateEntry->BootBgColor = (__typeof__(DuplicateEntry->BootBgColor))AllocateCopyPool (sizeof(EG_PIXEL), Entry->BootBgColor);
|
||||
DuplicateEntry->BootBgColor = (__typeof__(DuplicateEntry->BootBgColor))AllocateCopyPool (sizeof(Entry->BootBgColor), Entry->BootBgColor);
|
||||
}
|
||||
#endif
|
||||
|
||||
DuplicateEntry->Image = Entry->Image;
|
||||
DuplicateEntry->DriveImage = Entry->DriveImage;
|
||||
@ -2105,11 +2108,19 @@ FillinCustomEntry (
|
||||
if (Prop != NULL && Prop->type == kTagTypeString) {
|
||||
UINTN Color;
|
||||
Color = AsciiStrHexToUintn (Prop->string);
|
||||
Entry->BootBgColor = (__typeof__(Entry->BootBgColor))AllocateZeroPool (sizeof(EG_PIXEL));
|
||||
|
||||
#if USE_XTHEME
|
||||
Entry->BootBgColor.Red = (Color >> 24) & 0xFF;
|
||||
Entry->BootBgColor.Green = (Color >> 16) & 0xFF;
|
||||
Entry->BootBgColor.Blue = (Color >> 8) & 0xFF;
|
||||
Entry->BootBgColor.Reserved = (Color >> 0) & 0xFF;
|
||||
#else
|
||||
Entry->BootBgColor = (__typeof__(Entry->BootBgColor))AllocateZeroPool (sizeof(Entry->BootBgColor));
|
||||
Entry->BootBgColor->r = (Color >> 24) & 0xFF;
|
||||
Entry->BootBgColor->g = (Color >> 16) & 0xFF;
|
||||
Entry->BootBgColor->b = (Color >> 8) & 0xFF;
|
||||
Entry->BootBgColor->a = (Color >> 0) & 0xFF;
|
||||
#endif
|
||||
}
|
||||
|
||||
// Hidden Property, Values:
|
||||
|
@ -149,7 +149,8 @@ StartupSoundPlay(EFI_FILE *Dir, CONST CHAR16* SoundFile)
|
||||
DBG(" sound channels=%d bits=%d freq=%d\n", WaveData.Format->Channels, WaveData.Format->BitsPerSample, WaveData.Format->SamplesPerSec);
|
||||
|
||||
if (!WaveData.SamplesLength || !OutputVolume) {
|
||||
DBG("nothing to play\n");
|
||||
// DBG("nothing to play\n");
|
||||
Status = EFI_NOT_FOUND;
|
||||
goto DONE_ERROR;
|
||||
}
|
||||
|
||||
@ -162,7 +163,7 @@ StartupSoundPlay(EFI_FILE *Dir, CONST CHAR16* SoundFile)
|
||||
INT16 *Ptr = (INT16*)WaveData.Samples;
|
||||
if (!Ptr) {
|
||||
Status = EFI_NOT_FOUND;
|
||||
DBG("not found wave data\n");
|
||||
// DBG("not found wave data\n");
|
||||
goto DONE_ERROR;
|
||||
}
|
||||
TempData = (__typeof__(TempData))AllocateZeroPool(Len * sizeof(INT16));
|
||||
@ -187,8 +188,8 @@ StartupSoundPlay(EFI_FILE *Dir, CONST CHAR16* SoundFile)
|
||||
}
|
||||
|
||||
if (!AudioIo) {
|
||||
Status = EFI_NOT_FOUND;
|
||||
DBG("not found AudioIo to play\n");
|
||||
Status = EFI_DEVICE_ERROR;
|
||||
// DBG("not found AudioIo to play\n");
|
||||
goto DONE_ERROR;
|
||||
}
|
||||
|
||||
@ -222,7 +223,7 @@ StartupSoundPlay(EFI_FILE *Dir, CONST CHAR16* SoundFile)
|
||||
|
||||
DONE_ERROR:
|
||||
if (FileData && SoundFile) { //dont free embedded sound
|
||||
DBG("free sound\n");
|
||||
// DBG("free sound\n");
|
||||
FreePool(FileData);
|
||||
}
|
||||
DBG("sound play end with status=%s\n", strerror(Status));
|
||||
|
@ -729,7 +729,7 @@ CONST CHAR16 *CustomBootModeToStr(IN UINT8 Mode)
|
||||
|
||||
EFI_STATUS InitBootScreen(IN LOADER_ENTRY *Entry)
|
||||
{
|
||||
EG_PIXEL *backgroundPixel = Entry->BootBgColor;
|
||||
EG_PIXEL *backgroundPixel = (EG_PIXEL *)&Entry->BootBgColor;
|
||||
EG_IMAGE *logo = NULL;
|
||||
INTN screenWidth, screenHeight;
|
||||
UINT8 customBoot = Entry->CustomBoot;
|
||||
|
@ -404,6 +404,24 @@ STATIC EFI_STATUS GetOSXVolumeName(LOADER_ENTRY *Entry)
|
||||
}
|
||||
return Status;
|
||||
}
|
||||
#if USE_XTHEME
|
||||
STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
|
||||
IN CONST CHAR16 *LoaderOptions,
|
||||
IN CONST CHAR16 *FullTitle,
|
||||
IN CONST CHAR16 *LoaderTitle,
|
||||
IN REFIT_VOLUME *Volume,
|
||||
IN EG_IMAGE *Image,
|
||||
IN EG_IMAGE *DriveImage,
|
||||
IN UINT8 OSType,
|
||||
IN UINT8 Flags,
|
||||
IN CHAR16 Hotkey,
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL BootBgColor,
|
||||
IN UINT8 CustomBoot,
|
||||
IN EG_IMAGE *CustomLogo,
|
||||
IN KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
IN BOOLEAN CustomEntry)
|
||||
|
||||
#else
|
||||
|
||||
STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
|
||||
IN CONST CHAR16 *LoaderOptions,
|
||||
@ -420,6 +438,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
|
||||
IN EG_IMAGE *CustomLogo,
|
||||
IN KERNEL_AND_KEXT_PATCHES *Patches,
|
||||
IN BOOLEAN CustomEntry)
|
||||
#endif
|
||||
{
|
||||
EFI_DEVICE_PATH *LoaderDevicePath;
|
||||
CONST CHAR16 *LoaderDevicePathString;
|
||||
@ -729,6 +748,7 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
|
||||
// DBG(" Show badge as OSImage.");
|
||||
}
|
||||
}
|
||||
Entry->BootBgColor = BootBgColor;
|
||||
#else
|
||||
if (GlobalConfig.HideBadges & HDBADGES_SHOW) {
|
||||
if (GlobalConfig.HideBadges & HDBADGES_SWAP) {
|
||||
@ -739,11 +759,12 @@ STATIC LOADER_ENTRY *CreateLoaderEntry(IN CONST CHAR16 *LoaderPath,
|
||||
// DBG(" Show badge as OSImage.");
|
||||
}
|
||||
}
|
||||
#endif
|
||||
if (BootBgColor != NULL) {
|
||||
Entry->BootBgColor = BootBgColor;
|
||||
Entry->BootBgColor = BootBgColor; //copy pointer
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
Entry->KernelAndKextPatches = ((Patches == NULL) ? (KERNEL_AND_KEXT_PATCHES *)(((UINTN)&gSettings) + OFFSET_OF(SETTINGS_DATA, KernelAndKextPatches)) : Patches);
|
||||
#ifdef DUMP_KERNEL_KEXT_PATCHES
|
||||
DumpKernelAndKextPatches(Entry->KernelAndKextPatches);
|
||||
@ -1032,8 +1053,11 @@ STATIC BOOLEAN AddLoaderEntry(IN CONST CHAR16 *LoaderPath, IN CONST CHAR16 *Load
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Entry = CreateLoaderEntry(LoaderPath, LoaderOptions, NULL, LoaderTitle, Volume, Image, NULL, OSType, Flags, 0, NULL, CUSTOM_BOOT_DISABLED, NULL, NULL, FALSE);
|
||||
#if USE_XTHEME
|
||||
Entry = CreateLoaderEntry(LoaderPath, LoaderOptions, NULL, LoaderTitle, Volume, Image, NULL, OSType, Flags, 0, MenuBackgroundPixel, CUSTOM_BOOT_DISABLED, NULL, NULL, FALSE);
|
||||
#else
|
||||
Entry = CreateLoaderEntry(LoaderPath, LoaderOptions, NULL, LoaderTitle, Volume, Image, NULL, OSType, Flags, 0, NULL, CUSTOM_BOOT_DISABLED, NULL, NULL, FALSE);
|
||||
#endif
|
||||
if (Entry != NULL) {
|
||||
if ((Entry->LoaderType == OSTYPE_OSX) ||
|
||||
(Entry->LoaderType == OSTYPE_OSX_INSTALLER ) ||
|
||||
|
@ -79,7 +79,10 @@ public:
|
||||
INTN TimeoutSeconds;
|
||||
#if USE_XTHEME
|
||||
XStringW TimeoutText;
|
||||
XStringW ThemeName;
|
||||
XStringW ThemeName; //?
|
||||
EG_RECT OldTextBufferRect;
|
||||
XImage OldTextBufferImage;
|
||||
BOOLEAN isBootScreen;
|
||||
#else
|
||||
CONST CHAR16 *TimeoutText;
|
||||
CONST CHAR16 *Theme;
|
||||
@ -96,6 +99,9 @@ public:
|
||||
UINTN mItemID;
|
||||
SCROLL_STATE ScrollState;
|
||||
BOOLEAN ScrollEnabled;
|
||||
#if USE_XTHEME
|
||||
INTN TextStyle;
|
||||
#endif
|
||||
// MENU_STYLE_FUNC StyleFunc;
|
||||
|
||||
//TODO scroll positions should depends on REFIT_SCREEN?
|
||||
@ -117,8 +123,9 @@ public:
|
||||
#if USE_XTHEME
|
||||
REFIT_MENU_SCREEN()
|
||||
: ID(0), Title(), TitleImage(),
|
||||
TimeoutSeconds(0), TimeoutText(), ThemeName(), AnimeRun(0),
|
||||
Once(0), LastDraw(0), CurrentFrame(0),
|
||||
TimeoutSeconds(0), TimeoutText(), ThemeName(),
|
||||
OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false),
|
||||
AnimeRun(0), Once(0), LastDraw(0), CurrentFrame(0),
|
||||
Frames(0), FrameTime(0),
|
||||
Film(0), mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||
{};
|
||||
@ -136,8 +143,9 @@ public:
|
||||
#if USE_XTHEME
|
||||
REFIT_MENU_SCREEN(UINTN ID, XStringW Title, XStringW TimeoutText)
|
||||
: ID(ID), Title(Title), TitleImage(),
|
||||
TimeoutSeconds(0), TimeoutText(TimeoutText), ThemeName(), AnimeRun(0),
|
||||
Once(0), LastDraw(0), CurrentFrame(0),
|
||||
TimeoutSeconds(0), TimeoutText(TimeoutText), ThemeName(),
|
||||
OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false),
|
||||
AnimeRun(0), Once(0), LastDraw(0), CurrentFrame(0),
|
||||
Frames(0), FrameTime(0),
|
||||
Film(0), mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||
{};
|
||||
@ -164,8 +172,9 @@ public:
|
||||
#if USE_XTHEME
|
||||
REFIT_MENU_SCREEN(UINTN ID, XStringW Title, XStringW TimeoutText, REFIT_ABSTRACT_MENU_ENTRY* entry1, REFIT_ABSTRACT_MENU_ENTRY* entry2)
|
||||
: ID(ID), Title(Title), TitleImage(),
|
||||
TimeoutSeconds(0), TimeoutText(TimeoutText), ThemeName(), AnimeRun(0),
|
||||
Once(0), LastDraw(0), CurrentFrame(0),
|
||||
TimeoutSeconds(0), TimeoutText(TimeoutText), ThemeName(),
|
||||
OldTextBufferRect(), OldTextBufferImage(), isBootScreen(false),
|
||||
AnimeRun(0), Once(0), LastDraw(0), CurrentFrame(0),
|
||||
Frames(0), FrameTime(0),
|
||||
Film(0), mAction(ActionNone), mItemID(0)//, mPointer(NULL) //, StyleFunc(&REFIT_MENU_SCREEN::TextMenuStyle)
|
||||
{
|
||||
@ -210,6 +219,13 @@ public:
|
||||
UINTN InputDialog(IN MENU_STYLE_FUNC StyleFunc);
|
||||
|
||||
VOID DrawMainMenuLabel(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos);
|
||||
#if USE_XTHEME
|
||||
INTN DrawTextXY(IN const XStringW& Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign);
|
||||
void EraseTextXY();
|
||||
VOID DrawTextCorner(UINTN TextC, UINT8 Align);
|
||||
VOID DrawMenuText(IN XStringW& Text, IN INTN SelectedWidth, IN INTN XPos, IN INTN YPos, IN INTN Cursor);
|
||||
#endif
|
||||
VOID DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign);
|
||||
VOID CountItems();
|
||||
VOID InitAnime();
|
||||
BOOLEAN GetAnime();
|
||||
|
@ -349,14 +349,26 @@ class REFIT_ABSTRACT_MENU_ENTRY
|
||||
UINT8 LoaderType;
|
||||
CHAR8 *OSVersion;
|
||||
CHAR8 *BuildVersion;
|
||||
EG_PIXEL *BootBgColor;
|
||||
#if USE_XTHEME
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL BootBgColor;
|
||||
#else
|
||||
EG_PIXEL *BootBgColor; //why it is array? It is one value!
|
||||
#endif
|
||||
|
||||
|
||||
UINT8 CustomBoot;
|
||||
EG_IMAGE *CustomLogo;
|
||||
KERNEL_AND_KEXT_PATCHES *KernelAndKextPatches;
|
||||
CONST CHAR16 *Settings;
|
||||
|
||||
LOADER_ENTRY()
|
||||
: REFIT_MENU_ITEM_BOOTNUM(), VolName(0), DevicePath(0), Flags(0), LoaderType(0), OSVersion(0), BuildVersion(0), BootBgColor(0), CustomBoot(0), CustomLogo(0), KernelAndKextPatches(0), Settings(0)
|
||||
: REFIT_MENU_ITEM_BOOTNUM(), VolName(0), DevicePath(0), Flags(0), LoaderType(0), OSVersion(0), BuildVersion(0),
|
||||
#if USE_XTHEME
|
||||
BootBgColor({0,0,0,0}),
|
||||
#else
|
||||
BootBgColor(0),
|
||||
#endif
|
||||
CustomBoot(0), CustomLogo(0), KernelAndKextPatches(0), Settings(0)
|
||||
{};
|
||||
LOADER_ENTRY* getPartiallyDuplicatedEntry() const;
|
||||
virtual LOADER_ENTRY* getLOADER_ENTRY() { return this; };
|
||||
|
@ -1005,7 +1005,7 @@ VOID testSVG()
|
||||
#endif
|
||||
#if TEST_SVG_IMAGE
|
||||
NSVGrasterizer* rast = nsvgCreateRasterizer();
|
||||
EG_IMAGE *NewImage;
|
||||
// EG_IMAGE *NewImage;
|
||||
NSVGimage *SVGimage;
|
||||
float Scale, ScaleX, ScaleY;
|
||||
|
||||
@ -1028,7 +1028,11 @@ VOID testSVG()
|
||||
}
|
||||
*/
|
||||
// Rasterize
|
||||
NewImage = egCreateFilledImage(Width, Height, TRUE, &MenuBackgroundPixel);
|
||||
#if USE_XTHEME
|
||||
XImage NewImage(Width, Height);
|
||||
#else
|
||||
EG_IMAGE *NewImage = egCreateFilledImage(Width, Height, TRUE, &MenuBackgroundPixel);
|
||||
#endif
|
||||
if (SVGimage->width <= 0) SVGimage->width = (float)Width;
|
||||
if (SVGimage->height <= 0) SVGimage->height = (float)Height;
|
||||
|
||||
@ -1038,23 +1042,26 @@ VOID testSVG()
|
||||
float tx = 0; //-SVGimage->realBounds[0] * Scale;
|
||||
float ty = 0; //-SVGimage->realBounds[1] * Scale;
|
||||
DBG("timing rasterize start tx=%f ty=%f\n", tx, ty);
|
||||
#if USE_XTHEME
|
||||
|
||||
nsvgRasterize(rast, SVGimage, tx,ty,Scale,Scale, (UINT8*)NewImage.GetPixelPtr(0,0), (int)Width, (int)Height, (int)Width*4);
|
||||
DBG("timing rasterize end\n");
|
||||
NewImage.Draw((UGAWidth - Width) / 2,
|
||||
(UGAHeight - Height) / 2);
|
||||
#else
|
||||
nsvgRasterize(rast, SVGimage, tx,ty,Scale,Scale, (UINT8*)NewImage->PixelData, (int)Width, (int)Height, (int)Width*4);
|
||||
DBG("timing rasterize end\n");
|
||||
//now show it!
|
||||
#if 1 //test XImage
|
||||
|
||||
XImage NewX(NewImage);
|
||||
NewX.Draw((UGAWidth - Width) / 2,
|
||||
(UGAHeight - Height) / 2);
|
||||
#else
|
||||
BltImageAlpha(NewImage,
|
||||
(UGAWidth - Width) / 2,
|
||||
(UGAHeight - Height) / 2,
|
||||
&MenuBackgroundPixel,
|
||||
16);
|
||||
egFreeImage(NewImage);
|
||||
|
||||
#endif //test XImage
|
||||
FreePool(FileData);
|
||||
FileData = NULL;
|
||||
egFreeImage(NewImage);
|
||||
//
|
||||
// nsvg__deleteParser(p);
|
||||
nsvgDeleteRasterizer(rast);
|
||||
|
||||
|
@ -15,6 +15,7 @@
|
||||
#define DBG(...) DebugLog(DEBUG_XIMAGE, __VA_ARGS__)
|
||||
#endif
|
||||
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL NullColor = {0,0,0,0};
|
||||
|
||||
XImage::XImage()
|
||||
{
|
||||
@ -64,7 +65,7 @@ XImage& XImage::operator= (const XImage& other)
|
||||
return *this;
|
||||
}
|
||||
|
||||
UINT8 Smooth(const UINT8* p, int a01, int a10, int a21, int a12, int dx, int dy, float scale)
|
||||
UINT8 XImage::Smooth(const UINT8* p, int a01, int a10, int a21, int a12, int dx, int dy, float scale)
|
||||
{
|
||||
return (UINT8)((*(p + a01) * (scale - dx) * 3.f + *(p + a10) * (scale - dy) * 3.f + *(p + a21) * dx * 3.f +
|
||||
*(p + a12) * dy * 3.f + *(p) * 2.f *scale) / (scale * 8.f));
|
||||
@ -370,6 +371,7 @@ EFI_STATUS XImage::FromSVG(const CHAR8 *SVGData, float scale)
|
||||
|
||||
NSVGrasterizer* rast = nsvgCreateRasterizer();
|
||||
if (!rast) return EFI_UNSUPPORTED;
|
||||
//we have to copy input data because nanosvg wants to change it
|
||||
char *input = (__typeof__(input))AllocateCopyPool(AsciiStrSize(SVGData), SVGData);
|
||||
if (!input) return EFI_DEVICE_ERROR;
|
||||
|
||||
@ -398,6 +400,7 @@ EFI_STATUS XImage::FromSVG(const CHAR8 *SVGData, float scale)
|
||||
* the rect will be clipped if it intersects the screen edge
|
||||
*
|
||||
* be careful about alpha. This procedure can produce alpha = 0 which means full transparent
|
||||
* No! Anuway alpha should be corrected to 0xFF
|
||||
*/
|
||||
void XImage::GetArea(const EG_RECT& Rect)
|
||||
{
|
||||
@ -448,6 +451,12 @@ void XImage::GetArea(INTN x, INTN y, UINTN W, UINTN H)
|
||||
EfiUgaVideoToBltBuffer,
|
||||
x, y, 0, 0, Width, Height, 0); //Width*sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
||||
}
|
||||
//fix alpha
|
||||
UINTN ImageSize = (Width * Height);
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL* Pixel = GetPixelPtr(0,0);
|
||||
for (UINTN i = 0; i < ImageSize; ++i) {
|
||||
(Pixel++)->Reserved = 0xFF;
|
||||
}
|
||||
}
|
||||
|
||||
void XImage::DrawWithoutCompose(INTN x, INTN y, UINTN width, UINTN height)
|
||||
@ -602,6 +611,11 @@ EFI_STATUS XImage::LoadXImage(EFI_FILE *BaseDir, const XStringW& IconName)
|
||||
|
||||
//EnsureImageSize should create new object with new sizes
|
||||
//while compose uses old object
|
||||
void XImage::EnsureImageSize(IN UINTN NewWidth, IN UINTN NewHeight)
|
||||
{
|
||||
|
||||
EnsureImageSize(NewWidth, NewHeight, NullColor);
|
||||
}
|
||||
void XImage::EnsureImageSize(IN UINTN NewWidth, IN UINTN NewHeight, IN CONST EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color)
|
||||
{
|
||||
if (NewWidth == Width && NewHeight == Height)
|
||||
|
@ -106,8 +106,10 @@ public:
|
||||
EFI_STATUS LoadXImage(EFI_FILE *Dir, const char* IconName);
|
||||
EFI_STATUS LoadIcns(IN EFI_FILE *Dir, IN CONST CHAR16 *FileName, IN UINTN PixelSize);
|
||||
void EnsureImageSize(IN UINTN Width, IN UINTN Height, IN CONST EFI_GRAPHICS_OUTPUT_BLT_PIXEL& Color);
|
||||
void EnsureImageSize(IN UINTN NewWidth, IN UINTN NewHeight);
|
||||
void DummyImage(IN UINTN PixelSize);
|
||||
|
||||
protected:
|
||||
UINT8 Smooth(const UINT8* p, int a01, int a10, int a21, int a12, int dx, int dy, float scale);
|
||||
};
|
||||
|
||||
#endif //__XSTRINGW_H__
|
||||
|
@ -8,6 +8,7 @@ extern "C" {
|
||||
|
||||
#include "libegint.h"
|
||||
#include "../refit/screen.h"
|
||||
#include "../refit/lib.h"
|
||||
|
||||
#include "XTheme.h"
|
||||
|
||||
@ -47,6 +48,7 @@ extern EG_RECT ScrollbarOldPointerPlace;
|
||||
extern EG_RECT ScrollbarNewPointerPlace;
|
||||
extern INTN ScrollbarYMovement;
|
||||
|
||||
//extern EFI_GRAPHICS_OUTPUT_BLT_PIXEL SelectionBackgroundPixel;
|
||||
|
||||
|
||||
CONST CHAR8* IconsNames[] = {
|
||||
@ -352,7 +354,7 @@ void XTheme::ClearScreen() //and restore background and banner
|
||||
if (BanHeight < 2) {
|
||||
BanHeight = ((UGAHeight - (int)(LayoutHeight * Scale)) >> 1);
|
||||
}
|
||||
egClearScreen(&DarkBackgroundPixel);
|
||||
egClearScreen(&MenuBackgroundPixel);
|
||||
if (!(HideUIFlags & HIDEUI_FLAG_BANNER)) {
|
||||
//Banner image prepared before
|
||||
if (!Banner.isEmpty()) {
|
||||
@ -392,12 +394,12 @@ void XTheme::ClearScreen() //and restore background and banner
|
||||
|
||||
if (Background.isEmpty()) {
|
||||
Background = XImage(UGAWidth, UGAHeight);
|
||||
Background.Fill((EFI_GRAPHICS_OUTPUT_BLT_PIXEL&)BlueBackgroundPixel);
|
||||
Background.Fill(BlueBackgroundPixel);
|
||||
}
|
||||
if (!BigBack.isEmpty()) {
|
||||
switch (BackgroundScale) {
|
||||
case imScale:
|
||||
DBG("back copy scaled\n");
|
||||
// DBG("back copy scaled\n");
|
||||
Background.CopyScaled(BigBack, Scale);
|
||||
break;
|
||||
case imCrop:
|
||||
@ -429,7 +431,7 @@ void XTheme::ClearScreen() //and restore background and banner
|
||||
x, y, Background.GetWidth(), BigBack.GetWidth());
|
||||
// DBG("crop to x,y: %lld, %lld\n", x, y);
|
||||
// Background.CopyRect(BigBack, x, y);
|
||||
DBG("back copy cropped\n");
|
||||
// DBG("back copy cropped\n");
|
||||
break;
|
||||
}
|
||||
case imTile:
|
||||
@ -442,14 +444,14 @@ void XTheme::ClearScreen() //and restore background and banner
|
||||
*p1++ = BigBack.GetPixel((i + x) % BigBack.GetWidth(), (j + y) % BigBack.GetHeight());
|
||||
}
|
||||
}
|
||||
DBG("back copy tiled\n");
|
||||
// DBG("back copy tiled\n");
|
||||
break;
|
||||
}
|
||||
case imNone:
|
||||
default:
|
||||
// already scaled
|
||||
Background = BigBack;
|
||||
DBG("back copy equal\n");
|
||||
// DBG("back copy equal\n");
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -468,10 +470,10 @@ void XTheme::InitSelection() //for PNG theme
|
||||
if (!AllowGraphicsMode)
|
||||
return;
|
||||
//used to fill TextBuffer if selected
|
||||
SelectionBackgroundPixel.r = (SelectionColor >> 24) & 0xFF;
|
||||
SelectionBackgroundPixel.g = (SelectionColor >> 16) & 0xFF;
|
||||
SelectionBackgroundPixel.b = (SelectionColor >> 8) & 0xFF;
|
||||
SelectionBackgroundPixel.a = (SelectionColor >> 0) & 0xFF;
|
||||
SelectionBackgroundPixel.Red = (SelectionColor >> 24) & 0xFF;
|
||||
SelectionBackgroundPixel.Green = (SelectionColor >> 16) & 0xFF;
|
||||
SelectionBackgroundPixel.Blue = (SelectionColor >> 8) & 0xFF;
|
||||
SelectionBackgroundPixel.Reserved = (SelectionColor >> 0) & 0xFF;
|
||||
|
||||
if (!SelectionImages[0].isEmpty()) { //already presents
|
||||
return;
|
||||
@ -511,7 +513,7 @@ void XTheme::InitSelection() //for PNG theme
|
||||
SelectionImages[0].FromPNG(ACCESS_EMB_DATA(emb_dark_selection_big), ACCESS_EMB_SIZE(emb_dark_selection_big));
|
||||
}
|
||||
// SelectionImages[0]->HasAlpha = FALSE; // support transparensy for selection icons
|
||||
CopyMem(&BlueBackgroundPixel, &StdBackgroundPixel, sizeof(EG_PIXEL));
|
||||
CopyMem(&BlueBackgroundPixel, &StdBackgroundPixel, sizeof(EFI_GRAPHICS_OUTPUT_BLT_PIXEL));
|
||||
if (SelectionImages[0].isEmpty()) {
|
||||
SelectionImages[2].setEmpty();
|
||||
return;
|
||||
@ -537,14 +539,14 @@ void XTheme::InitSelection() //for PNG theme
|
||||
// SelectionImages[4] = egCreateFilledImage(ScaledIndicatorSize, ScaledIndicatorSize,
|
||||
// TRUE, &StdBackgroundPixel);
|
||||
SelectionImages[4] = XImage(ScaledIndicatorSize, ScaledIndicatorSize);
|
||||
SelectionImages[4].Fill((EFI_GRAPHICS_OUTPUT_BLT_PIXEL&)StdBackgroundPixel);
|
||||
SelectionImages[4].Fill(StdBackgroundPixel);
|
||||
|
||||
|
||||
}
|
||||
// SelectionImages[5] = egCreateFilledImage(ScaledIndicatorSize, ScaledIndicatorSize,
|
||||
// TRUE, &MenuBackgroundPixel);
|
||||
SelectionImages[5] = XImage(ScaledIndicatorSize, ScaledIndicatorSize);
|
||||
SelectionImages[5].Fill((EFI_GRAPHICS_OUTPUT_BLT_PIXEL&)MenuBackgroundPixel);
|
||||
SelectionImages[5].Fill(MenuBackgroundPixel);
|
||||
|
||||
}
|
||||
|
||||
|
@ -102,6 +102,8 @@ public:
|
||||
XImage UpButtonImage;
|
||||
XImage DownButtonImage;
|
||||
|
||||
EG_RECT BannerPlace; //TODO exclude BanHeight = BannerPlace.Height
|
||||
|
||||
//fill the theme
|
||||
const XImage& GetIcon(const XString& Name); //get by name
|
||||
const XImage& GetIcon(const char* Name);
|
||||
|
@ -609,6 +609,7 @@ EG_IMAGE * egLoadIcon(IN EFI_FILE_HANDLE BaseDir, IN CONST CHAR16 *FileName, IN
|
||||
//
|
||||
|
||||
// take part of other procedures, not needed
|
||||
//used in RunGenericMenu-> used in Anime
|
||||
VOID egRestrictImageArea(IN EG_IMAGE *Image,
|
||||
IN INTN AreaPosX, IN INTN AreaPosY,
|
||||
IN OUT INTN *AreaWidth, IN OUT INTN *AreaHeight)
|
||||
@ -630,7 +631,7 @@ VOID egRestrictImageArea(IN EG_IMAGE *Image,
|
||||
}
|
||||
}
|
||||
|
||||
//will be replaced by
|
||||
//TODO will be replaced by
|
||||
// CompImage.Fill(Color)
|
||||
VOID egFillImage(IN OUT EG_IMAGE *CompImage, IN EG_PIXEL *Color)
|
||||
{
|
||||
@ -651,8 +652,9 @@ VOID egFillImage(IN OUT EG_IMAGE *CompImage, IN EG_PIXEL *Color)
|
||||
}
|
||||
}
|
||||
|
||||
//will be replaced by
|
||||
//TODO will be replaced by
|
||||
// CompImage.FillArea(Color, Rect)
|
||||
// used in Anime
|
||||
VOID egFillImageArea(IN OUT EG_IMAGE *CompImage,
|
||||
IN INTN AreaPosX, IN INTN AreaPosY,
|
||||
IN INTN AreaWidth, IN INTN AreaHeight,
|
||||
@ -685,7 +687,7 @@ VOID egFillImageArea(IN OUT EG_IMAGE *CompImage,
|
||||
}
|
||||
}
|
||||
|
||||
//will be replaced by
|
||||
//TODO will be replaced by
|
||||
// CompBase.CopyRect(TopBase, XPos, YPos);
|
||||
|
||||
VOID egRawCopy(IN OUT EG_PIXEL *CompBasePtr, IN EG_PIXEL *TopBasePtr,
|
||||
@ -803,7 +805,7 @@ VOID egRawComposeOnFlat(IN OUT EG_PIXEL *CompBasePtr, IN EG_PIXEL *TopBasePtr,
|
||||
}
|
||||
}
|
||||
|
||||
//will be replaced by
|
||||
//TODO will be replaced by
|
||||
// CompImage.Compose(IN XImage& TopImage, IN INTN PosX, IN INTN PosY)
|
||||
VOID egComposeImage(IN OUT EG_IMAGE *CompImage, IN EG_IMAGE *TopImage, IN INTN PosX, IN INTN PosY)
|
||||
{
|
||||
@ -818,9 +820,15 @@ VOID egComposeImage(IN OUT EG_IMAGE *CompImage, IN EG_IMAGE *TopImage, IN INTN P
|
||||
|
||||
// compose
|
||||
if (CompWidth > 0) {
|
||||
if (CompImage->HasAlpha && !BackgroundImage) {
|
||||
CompImage->HasAlpha = FALSE;
|
||||
#if USE_XTHEME
|
||||
if (CompImage->HasAlpha && ThemeX.Background.isEmpty()) {
|
||||
CompImage->HasAlpha = FALSE;
|
||||
}
|
||||
#else
|
||||
if (CompImage->HasAlpha && !BackgroundImage) {
|
||||
CompImage->HasAlpha = FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (TopImage->HasAlpha) {
|
||||
if (CompImage->HasAlpha) { //aaaa
|
||||
@ -839,7 +847,7 @@ VOID egComposeImage(IN OUT EG_IMAGE *CompImage, IN EG_IMAGE *TopImage, IN INTN P
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if !USE_XTHEME
|
||||
EG_IMAGE * egEnsureImageSize(IN EG_IMAGE *Image, IN INTN Width, IN INTN Height, IN EG_PIXEL *Color)
|
||||
{
|
||||
EG_IMAGE *NewImage;
|
||||
@ -859,7 +867,7 @@ EG_IMAGE * egEnsureImageSize(IN EG_IMAGE *Image, IN INTN Width, IN INTN Height,
|
||||
|
||||
return NewImage;
|
||||
}
|
||||
|
||||
#endif
|
||||
//
|
||||
// misc internal functions
|
||||
//
|
||||
|
@ -496,8 +496,13 @@ VOID egFillImageArea(IN OUT EG_IMAGE *CompImage,
|
||||
VOID egComposeImage(IN OUT EG_IMAGE *CompImage, IN EG_IMAGE *TopImage, IN INTN PosX, IN INTN PosY);
|
||||
VOID PrepareFont(VOID);
|
||||
VOID egMeasureText(IN CONST CHAR16 *Text, OUT INTN *Width, OUT INTN *Height);
|
||||
|
||||
#if USE_XTHEME
|
||||
VOID egClearScreen(IN void *Color);
|
||||
#else
|
||||
VOID egClearScreen(IN EG_PIXEL *Color);
|
||||
#endif
|
||||
|
||||
|
||||
//VOID egDrawImage(IN EG_IMAGE *Image, IN INTN ScreenPosX, IN INTN ScreenPosY);
|
||||
// will be replaced by XImage.Draw(ScreenPosX, ScreenPosY, 1.f); assuming Area* = 0
|
||||
VOID egDrawImageArea(IN EG_IMAGE *Image,
|
||||
|
@ -514,31 +514,52 @@ VOID egSetGraphicsModeEnabled(IN BOOLEAN Enable)
|
||||
//
|
||||
// Drawing to the screen
|
||||
//
|
||||
#if USE_XTHEME
|
||||
VOID egClearScreen(IN void *Color)
|
||||
{
|
||||
if (!egHasGraphics)
|
||||
return;
|
||||
|
||||
if (GraphicsOutput != NULL) {
|
||||
// EFI_GRAPHICS_OUTPUT_BLT_PIXEL and EFI_UGA_PIXEL have the same
|
||||
// layout, and the header from TianoCore actually defines them
|
||||
// to be the same type.
|
||||
GraphicsOutput->Blt(GraphicsOutput, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)Color, EfiBltVideoFill,
|
||||
0, 0, 0, 0, egScreenWidth, egScreenHeight, 0);
|
||||
} else if (UgaDraw != NULL) {
|
||||
UgaDraw->Blt(UgaDraw, (EFI_UGA_PIXEL*)Color, EfiUgaVideoFill,
|
||||
0, 0, 0, 0, egScreenWidth, egScreenHeight, 0);
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
VOID egClearScreen(IN EG_PIXEL *Color)
|
||||
{
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL FillColor;
|
||||
|
||||
if (!egHasGraphics)
|
||||
return;
|
||||
|
||||
FillColor.Red = Color->r;
|
||||
FillColor.Green = Color->g;
|
||||
FillColor.Blue = Color->b;
|
||||
FillColor.Reserved = 0;
|
||||
|
||||
if (GraphicsOutput != NULL) {
|
||||
// EFI_GRAPHICS_OUTPUT_BLT_PIXEL and EFI_UGA_PIXEL have the same
|
||||
// layout, and the header from TianoCore actually defines them
|
||||
// to be the same type.
|
||||
GraphicsOutput->Blt(GraphicsOutput, &FillColor, EfiBltVideoFill,
|
||||
0, 0, 0, 0, egScreenWidth, egScreenHeight, 0);
|
||||
} else if (UgaDraw != NULL) {
|
||||
UgaDraw->Blt(UgaDraw, (EFI_UGA_PIXEL*)&FillColor, EfiUgaVideoFill,
|
||||
0, 0, 0, 0, egScreenWidth, egScreenHeight, 0);
|
||||
}
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL FillColor;
|
||||
|
||||
if (!egHasGraphics)
|
||||
return;
|
||||
|
||||
FillColor.Red = Color->r;
|
||||
FillColor.Green = Color->g;
|
||||
FillColor.Blue = Color->b;
|
||||
FillColor.Reserved = 0;
|
||||
|
||||
if (GraphicsOutput != NULL) {
|
||||
// EFI_GRAPHICS_OUTPUT_BLT_PIXEL and EFI_UGA_PIXEL have the same
|
||||
// layout, and the header from TianoCore actually defines them
|
||||
// to be the same type.
|
||||
GraphicsOutput->Blt(GraphicsOutput, &FillColor, EfiBltVideoFill,
|
||||
0, 0, 0, 0, egScreenWidth, egScreenHeight, 0);
|
||||
} else if (UgaDraw != NULL) {
|
||||
UgaDraw->Blt(UgaDraw, (EFI_UGA_PIXEL*)&FillColor, EfiUgaVideoFill,
|
||||
0, 0, 0, 0, egScreenWidth, egScreenHeight, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
VOID egDrawImageArea(IN EG_IMAGE *Image,
|
||||
IN INTN AreaPosX, IN INTN AreaPosY,
|
||||
IN INTN AreaWidth, IN INTN AreaHeight,
|
||||
|
@ -239,7 +239,12 @@ VOID PrepareFont()
|
||||
|
||||
// load the font
|
||||
if (FontImage == NULL){
|
||||
DBG("load font image type %d\n", GlobalConfig.Font);
|
||||
#if USE_XTHEME
|
||||
DBG("load font image type %d\n", ThemeX.Font);
|
||||
#else
|
||||
DBG("load font image type %d\n", GlobalConfig.Font);
|
||||
#endif
|
||||
|
||||
FontImage = egLoadFontImage(TRUE, 16, 16); //anyway success
|
||||
}
|
||||
|
||||
@ -257,6 +262,8 @@ VOID PrepareFont()
|
||||
}
|
||||
}
|
||||
}
|
||||
DBG("Font %d prepared WxH=%lldx%lld CharWidth=%lld\n", ThemeX.Font, FontWidth, FontHeight, ThemeX.CharWidth);
|
||||
|
||||
#else
|
||||
if (GlobalConfig.Font == FONT_GRAY) {
|
||||
//invert the font. embedded is dark
|
||||
@ -270,10 +277,11 @@ VOID PrepareFont()
|
||||
}
|
||||
}
|
||||
}
|
||||
DBG("Font %d prepared WxH=%lldx%lld CharWidth=%lld\n", GlobalConfig.Font, FontWidth, FontHeight, GlobalConfig.CharWidth);
|
||||
|
||||
#endif
|
||||
|
||||
// TextHeight = FontHeight + TEXT_YMARGIN * 2;
|
||||
DBG("Font %d prepared WxH=%lldx%lld CharWidth=%lld\n", GlobalConfig.Font, FontWidth, FontHeight, GlobalConfig.CharWidth);
|
||||
} else {
|
||||
DBG("Failed to load font\n");
|
||||
}
|
||||
|
@ -513,8 +513,20 @@ extern INTN row0TileSize;
|
||||
extern INTN row1TileSize;
|
||||
#endif
|
||||
extern const INTN BCSMargin;
|
||||
#if USE_XTHEME
|
||||
extern EFI_GRAPHICS_OUTPUT_BLT_PIXEL StdBackgroundPixel;
|
||||
extern EFI_GRAPHICS_OUTPUT_BLT_PIXEL MenuBackgroundPixel;
|
||||
extern EFI_GRAPHICS_OUTPUT_BLT_PIXEL InputBackgroundPixel;
|
||||
extern EFI_GRAPHICS_OUTPUT_BLT_PIXEL BlueBackgroundPixel;
|
||||
//extern EFI_GRAPHICS_OUTPUT_BLT_PIXEL DarkBackgroundPixel;
|
||||
extern EFI_GRAPHICS_OUTPUT_BLT_PIXEL SelectionBackgroundPixel;
|
||||
extern EFI_GRAPHICS_OUTPUT_BLT_PIXEL DarkEmbeddedBackgroundPixel;
|
||||
extern EFI_GRAPHICS_OUTPUT_BLT_PIXEL DarkSelectionPixel;
|
||||
extern EFI_GRAPHICS_OUTPUT_BLT_PIXEL WhitePixel;
|
||||
extern EFI_GRAPHICS_OUTPUT_BLT_PIXEL BlackPixel;
|
||||
|
||||
#if !USE_XTHEME
|
||||
|
||||
#else
|
||||
extern INTN LayoutBannerOffset;
|
||||
extern INTN LayoutButtonOffset;
|
||||
extern INTN LayoutTextOffset;
|
||||
@ -529,11 +541,12 @@ extern INTN UGAWidth;
|
||||
extern INTN UGAHeight;
|
||||
extern BOOLEAN AllowGraphicsMode;
|
||||
|
||||
#if !USE_XTHEME
|
||||
extern EG_PIXEL StdBackgroundPixel;
|
||||
extern EG_PIXEL MenuBackgroundPixel;
|
||||
extern EG_PIXEL InputBackgroundPixel;
|
||||
extern EG_PIXEL BlueBackgroundPixel;
|
||||
extern EG_PIXEL DarkBackgroundPixel;
|
||||
//extern EG_PIXEL DarkBackgroundPixel;
|
||||
extern EG_PIXEL SelectionBackgroundPixel;
|
||||
extern EG_PIXEL DarkEmbeddedBackgroundPixel;
|
||||
extern EG_PIXEL DarkSelectionPixel;
|
||||
@ -542,7 +555,7 @@ extern EG_PIXEL BlackPixel;
|
||||
|
||||
extern EG_RECT BannerPlace;
|
||||
extern EG_IMAGE *BackgroundImage;
|
||||
|
||||
#endif
|
||||
|
||||
#if REFIT_DEBUG > 0
|
||||
VOID DebugPause(VOID);
|
||||
|
@ -533,7 +533,7 @@ NullConOutOutputString(IN EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL *This, IN CONST CHAR16
|
||||
//
|
||||
// EFI OS loader functions
|
||||
//
|
||||
EG_PIXEL DarkBackgroundPixel = { 0x0, 0x0, 0x0, 0xFF };
|
||||
//EG_PIXEL DarkBackgroundPixel = { 0x0, 0x0, 0x0, 0xFF };
|
||||
|
||||
VOID CheckEmptyFB()
|
||||
{
|
||||
@ -645,8 +645,12 @@ static VOID StartLoader(IN LOADER_ENTRY *Entry)
|
||||
DBG("Image is not loaded, status=%s\n", strerror(Status));
|
||||
return; // no reason to continue if loading image failed
|
||||
}
|
||||
#if USE_XTHEME
|
||||
egClearScreen(&Entry->BootBgColor); //if not set then it is already MenuBackgroundPixel
|
||||
#else
|
||||
egClearScreen(Entry->BootBgColor ? Entry->BootBgColor : &MenuBackgroundPixel);
|
||||
#endif
|
||||
|
||||
egClearScreen(Entry->BootBgColor ? Entry->BootBgColor : &DarkBackgroundPixel);
|
||||
// KillMouse();
|
||||
|
||||
// if (Entry->LoaderType == OSTYPE_OSX) {
|
||||
@ -1021,14 +1025,17 @@ static VOID StartLegacy(IN LEGACY_ENTRY *Entry)
|
||||
RemoveStartupDiskVolume();
|
||||
}
|
||||
|
||||
egClearScreen(&DarkBackgroundPixel);
|
||||
BeginExternalScreen(TRUE/*, L"Booting Legacy OS"*/);
|
||||
|
||||
#if USE_XTHEME
|
||||
egClearScreen(&MenuBackgroundPixel);
|
||||
BeginExternalScreen(TRUE/*, L"Booting Legacy OS"*/);
|
||||
XImage BootLogoX;
|
||||
BootLogoX.LoadXImage(ThemeDir, Entry->Volume->LegacyOS->IconName);
|
||||
BootLogoX.Draw((UGAWidth - BootLogoX.GetWidth()) >> 1,
|
||||
(UGAHeight - BootLogoX.GetHeight()) >> 1);
|
||||
#else
|
||||
egClearScreen(&MenuBackgroundPixel);
|
||||
BeginExternalScreen(TRUE/*, L"Booting Legacy OS"*/);
|
||||
EG_IMAGE *BootLogoImage = LoadOSIcon(Entry->Volume->LegacyOS->IconName, L"legacy", 128, TRUE, TRUE);
|
||||
if (BootLogoImage != NULL) {
|
||||
BltImageAlpha(BootLogoImage,
|
||||
@ -1073,7 +1080,7 @@ static VOID StartLegacy(IN LEGACY_ENTRY *Entry)
|
||||
static VOID StartTool(IN REFIT_MENU_ENTRY_LOADER_TOOL *Entry)
|
||||
{
|
||||
DBG("Start Tool: %ls\n", Entry->LoaderPath);
|
||||
egClearScreen(&DarkBackgroundPixel);
|
||||
egClearScreen(&MenuBackgroundPixel);
|
||||
// assumes "Start <title>" as assigned below
|
||||
BeginExternalScreen(OSFLAG_ISSET(Entry->Flags, OSFLAG_USEGRAPHICS)/*, &Entry->Title[6]*/); // Shouldn't we check that length of Title is at least 6 ?
|
||||
StartEFIImage(Entry->DevicePath, Entry->LoadOptions, Basename(Entry->LoaderPath), Basename(Entry->LoaderPath), NULL, NULL);
|
||||
@ -2022,7 +2029,10 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
BOOLEAN UniteConfigs = FALSE;
|
||||
EFI_TIME Now;
|
||||
BOOLEAN HaveDefaultVolume;
|
||||
#if !USE_XTHEME
|
||||
#if USE_XTHEME
|
||||
REFIT_MENU_SCREEN BootScreen;
|
||||
BootScreen.isBootScreen = true; //other screens will be constructed as false
|
||||
#else
|
||||
CHAR16 *FirstMessage;
|
||||
#endif
|
||||
// CHAR16 *InputBuffer; //, *Y;
|
||||
@ -2085,7 +2095,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
#endif
|
||||
|
||||
construct_globals_objects(); // do this after SelfLoadedImage is initialized
|
||||
all_tests();
|
||||
// all_tests();
|
||||
|
||||
//dumping SETTING structure
|
||||
// if you change something in Platform.h, please uncomment and test that all offsets
|
||||
@ -2322,8 +2332,8 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
if (!GlobalConfig.NoEarlyProgress && !GlobalConfig.FastBoot && GlobalConfig.Timeout>0) {
|
||||
#if USE_XTHEME
|
||||
XStringW Message = SWPrintf(" Welcome to Clover %ls ", gFirmwareRevision);
|
||||
DrawTextXY(Message, (UGAWidth >> 1), UGAHeight >> 1, X_IS_CENTER);
|
||||
DrawTextXY(L"... testing hardware ..."_XSW, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
|
||||
BootScreen.DrawTextXY(Message, (UGAWidth >> 1), UGAHeight >> 1, X_IS_CENTER);
|
||||
BootScreen.DrawTextXY(L"... testing hardware ..."_XSW, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
|
||||
#else
|
||||
FirstMessage = PoolPrint(L" Welcome to Clover %s ", gFirmwareRevision);
|
||||
DrawTextXY(FirstMessage, (UGAWidth >> 1), UGAHeight >> 1, X_IS_CENTER);
|
||||
@ -2393,7 +2403,8 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
if (!GlobalConfig.NoEarlyProgress && !GlobalConfig.FastBoot && GlobalConfig.Timeout>0) {
|
||||
#if USE_XTHEME
|
||||
XStringW Message = SWPrintf("... user settings ...");
|
||||
DrawTextXY(Message, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
|
||||
BootScreen.EraseTextXY();
|
||||
BootScreen.DrawTextXY(Message, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
|
||||
#else
|
||||
FirstMessage = PoolPrint(L"... user settings ...");
|
||||
// i = (UGAWidth - StrLen(FirstMessage) * GlobalConfig.CharWidth) >> 1;
|
||||
@ -2470,7 +2481,8 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
if (!GlobalConfig.NoEarlyProgress && !GlobalConfig.FastBoot && GlobalConfig.Timeout>0) {
|
||||
#if USE_XTHEME
|
||||
XStringW Message = SWPrintf("... scan entries ...");
|
||||
DrawTextXY(Message, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
|
||||
BootScreen.EraseTextXY();
|
||||
BootScreen.DrawTextXY(Message, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
|
||||
#else
|
||||
FirstMessage = PoolPrint(L"... scan entries ...");
|
||||
DrawTextXY(FirstMessage, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
|
||||
@ -2662,8 +2674,9 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
// font already changed and this message very quirky, clear line here
|
||||
if (!GlobalConfig.NoEarlyProgress && !GlobalConfig.FastBoot && GlobalConfig.Timeout>0) {
|
||||
#if USE_XTHEME
|
||||
XStringW Message = L" "_XSW;
|
||||
DrawTextXY(Message, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
|
||||
// XStringW Message = L" "_XSW;
|
||||
BootScreen.EraseTextXY();
|
||||
// DrawTextXY(Message, (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
|
||||
#else
|
||||
DrawTextXY(L" ", (UGAWidth >> 1), (UGAHeight >> 1) + 20, X_IS_CENTER);
|
||||
#endif
|
||||
@ -2678,7 +2691,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
#endif
|
||||
|
||||
DefaultIndex = FindDefaultEntry();
|
||||
DBG("DefaultIndex=%lld and MainMenu.Entries.size()=%llu\n", DefaultIndex, MainMenu.Entries.size());
|
||||
// DBG("DefaultIndex=%lld and MainMenu.Entries.size()=%llu\n", DefaultIndex, MainMenu.Entries.size());
|
||||
if ((DefaultIndex >= 0) && (DefaultIndex < (INTN)MainMenu.Entries.size())) {
|
||||
DefaultEntry = &MainMenu.Entries[DefaultIndex];
|
||||
} else {
|
||||
@ -2715,7 +2728,7 @@ RefitMain (IN EFI_HANDLE ImageHandle,
|
||||
MainMenu.AnimeRun = MainAnime;
|
||||
MenuExit = MainMenu.RunMainMenu(DefaultIndex, &ChosenEntry);
|
||||
}
|
||||
DBG("exit from MainMenu %llu\n", MenuExit); //MENU_EXIT_ENTER=(1) MENU_EXIT_DETAILS=3
|
||||
// DBG("exit from MainMenu %llu\n", MenuExit); //MENU_EXIT_ENTER=(1) MENU_EXIT_DETAILS=3
|
||||
// disable default boot - have sense only in the first run
|
||||
GlobalConfig.Timeout = -1;
|
||||
if ((DefaultEntry != NULL) && (MenuExit == MENU_EXIT_TIMEOUT)) {
|
||||
|
@ -209,8 +209,9 @@ INTN OldChosenDsdt;
|
||||
UINTN OldChosenAudio;
|
||||
UINT8 DefaultAudioVolume = 70;
|
||||
//INTN NewChosenTheme;
|
||||
INTN TextStyle; //why global?
|
||||
|
||||
#if !USE_XTHEME
|
||||
INTN TextStyle; //why global? It will be class SCREEN member
|
||||
#endif
|
||||
BOOLEAN mGuiReady = FALSE;
|
||||
|
||||
|
||||
@ -3132,7 +3133,7 @@ VOID REFIT_MENU_SCREEN::TextMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
|
||||
|
||||
|
||||
#if USE_XTHEME
|
||||
INTN DrawTextXY(IN const XStringW& Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign)
|
||||
INTN REFIT_MENU_SCREEN::DrawTextXY(IN const XStringW& Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign)
|
||||
{
|
||||
INTN TextWidth = 0;
|
||||
INTN XText = 0;
|
||||
@ -3144,6 +3145,8 @@ INTN DrawTextXY(IN const XStringW& Text, IN INTN XPos, IN INTN YPos, IN UINT8 XA
|
||||
if (Text.isEmpty()) {
|
||||
return 0;
|
||||
}
|
||||
//TODO assume using embedded font for BootScreen
|
||||
//messages must be TextXYStyle = 1 if it is provided by theme
|
||||
if (!textFace[1].valid) {
|
||||
if (textFace[2].valid) {
|
||||
TextXYStyle = 2;
|
||||
@ -3151,7 +3154,12 @@ INTN DrawTextXY(IN const XStringW& Text, IN INTN XPos, IN INTN YPos, IN UINT8 XA
|
||||
TextXYStyle = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* here we want to know how many place is needed for the graphical text
|
||||
* the procedure worked for fixed width font but the problem appears with proportional fonts
|
||||
* as well we not know yet the font using but egRenderText calculate later real width
|
||||
* so make a place to be large enoungh
|
||||
*/
|
||||
egMeasureText(Text.data(), &TextWidth, NULL);
|
||||
|
||||
if (XAlign == X_IS_LEFT) {
|
||||
@ -3159,7 +3167,7 @@ INTN DrawTextXY(IN const XStringW& Text, IN INTN XPos, IN INTN YPos, IN UINT8 XA
|
||||
XText = XPos;
|
||||
}
|
||||
|
||||
if (ThemeX.TypeSVG) {
|
||||
if (!isBootScreen && ThemeX.TypeSVG) {
|
||||
TextWidth += TextHeight * 2; //give more place for buffer
|
||||
if (!textFace[TextXYStyle].valid) {
|
||||
DBG("no vaid text face for message!\n");
|
||||
@ -3173,21 +3181,39 @@ INTN DrawTextXY(IN const XStringW& Text, IN INTN XPos, IN INTN YPos, IN UINT8 XA
|
||||
|
||||
// TextBufferXY = egCreateFilledImage(TextWidth, Height, TRUE, &MenuBackgroundPixel);
|
||||
TextBufferXY.setSizeInPixels(TextWidth, Height);
|
||||
TextBufferXY.Fill(&MenuBackgroundPixel);
|
||||
TextBufferXY.Fill(MenuBackgroundPixel);
|
||||
|
||||
// render the text
|
||||
TextWidth = egRenderText(Text, &TextBufferXY, 0, 0, 0xFFFF, TextXYStyle);
|
||||
INTN TextWidth2 = egRenderText(Text, &TextBufferXY, 0, 0, 0xFFFF, TextXYStyle);
|
||||
/* there is real text width but we already have an array with Width = TextWidth
|
||||
*/
|
||||
TextBufferXY.EnsureImageSize(TextWidth2, Height); //assume color = MenuBackgroundPixel
|
||||
|
||||
if (XAlign != X_IS_LEFT) {
|
||||
// shift 64 is prohibited
|
||||
XText = XPos - (TextWidth >> XAlign); //X_IS_CENTER = 1
|
||||
XText = XPos - (TextWidth2 >> XAlign); //X_IS_CENTER = 1
|
||||
}
|
||||
|
||||
OldTextBufferRect.XPos = XText;
|
||||
OldTextBufferRect.YPos = YPos;
|
||||
OldTextBufferRect.Width = TextWidth2;
|
||||
OldTextBufferRect.Height = Height;
|
||||
|
||||
OldTextBufferImage.GetArea(OldTextBufferRect);
|
||||
//GetArea may change sizes
|
||||
OldTextBufferRect.Width = OldTextBufferImage.GetWidth();
|
||||
OldTextBufferRect.Height = OldTextBufferImage.GetHeight();
|
||||
|
||||
// DBG("draw text %ls\n", Text);
|
||||
// DBG("pos=%d width=%d xtext=%d Height=%d Y=%d\n", XPos, TextWidth, XText, Height, YPos);
|
||||
// BltImageAlpha(TextBufferXY, XText, YPos, &MenuBackgroundPixel, 16);
|
||||
// egFreeImage(TextBufferXY);
|
||||
TextBufferXY.Draw(XText, YPos);
|
||||
return TextWidth;
|
||||
// TextBufferXY.Draw(XText, YPos);
|
||||
TextBufferXY.DrawWithoutCompose(XText, YPos);
|
||||
return TextWidth2;
|
||||
}
|
||||
|
||||
void REFIT_MENU_SCREEN::EraseTextXY()
|
||||
{
|
||||
OldTextBufferImage.Draw(OldTextBufferRect.XPos, OldTextBufferRect.YPos);
|
||||
}
|
||||
#else
|
||||
|
||||
@ -3251,7 +3277,7 @@ INTN DrawTextXY(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAli
|
||||
* Helper function to draw text for Boot Camp Style.
|
||||
* @author: Needy
|
||||
*/
|
||||
VOID DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign)
|
||||
VOID REFIT_MENU_SCREEN::DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign)
|
||||
{
|
||||
// check if text was provided
|
||||
if (!Text) {
|
||||
@ -3339,14 +3365,14 @@ VOID DrawBCSText(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAl
|
||||
}
|
||||
|
||||
#if USE_XTHEME
|
||||
VOID DrawMenuText(IN XStringW& Text, IN INTN SelectedWidth, IN INTN XPos, IN INTN YPos, IN INTN Cursor)
|
||||
VOID REFIT_MENU_SCREEN::DrawMenuText(IN XStringW& Text, IN INTN SelectedWidth, IN INTN XPos, IN INTN YPos, IN INTN Cursor)
|
||||
{
|
||||
XImage TextBufferX(UGAWidth-XPos, TextHeight);
|
||||
|
||||
if (Cursor != 0xFFFF) {
|
||||
TextBufferX.Fill(&MenuBackgroundPixel);
|
||||
TextBufferX.Fill(MenuBackgroundPixel);
|
||||
} else {
|
||||
TextBufferX.Fill(&InputBackgroundPixel);
|
||||
TextBufferX.Fill(InputBackgroundPixel);
|
||||
}
|
||||
|
||||
|
||||
@ -3355,12 +3381,12 @@ VOID DrawMenuText(IN XStringW& Text, IN INTN SelectedWidth, IN INTN XPos, IN INT
|
||||
EG_RECT TextRect;
|
||||
TextRect.Width = SelectedWidth;
|
||||
TextRect.Height = TextHeight;
|
||||
TextBufferX.FillArea(&SelectionBackgroundPixel, TextRect);
|
||||
TextBufferX.FillArea(SelectionBackgroundPixel, TextRect);
|
||||
}
|
||||
|
||||
// render the text
|
||||
if (ThemeX.TypeSVG) {
|
||||
//clovy - text veltically centred on Height
|
||||
//clovy - text vertically centred on Height
|
||||
egRenderText(Text, &TextBufferX, 0,
|
||||
(INTN)((TextHeight - (textFace[TextStyle].size * ThemeX.Scale)) / 2),
|
||||
Cursor, TextStyle);
|
||||
@ -3758,6 +3784,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
|
||||
if (InfoLines.size() > 0) {
|
||||
// DrawMenuText(NULL, 0, 0, 0, 0);
|
||||
//EraseTextXY(); //but we should make it complementare to DrawMenuText
|
||||
for (UINTN i = 0; i < InfoLines.size(); i++) {
|
||||
DrawMenuText(InfoLines[i], 0, EntriesPosX, EntriesPosY, 0xFFFF);
|
||||
EntriesPosY += TextHeight;
|
||||
@ -3774,11 +3801,11 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
|
||||
case MENU_FUNCTION_PAINT_ALL:
|
||||
// DrawMenuText(NULL, 0, 0, 0, 0); //should clean every line to avoid artefacts
|
||||
DBG("PAINT_ALL: EntriesPosY=%lld MaxVisible=%lld\n", EntriesPosY, ScrollState.MaxVisible);
|
||||
DBG("DownButton.Height=%lld TextHeight=%lld\n", DownButton.Height, TextHeight);
|
||||
// DBG("PAINT_ALL: EntriesPosY=%lld MaxVisible=%lld\n", EntriesPosY, ScrollState.MaxVisible);
|
||||
// DBG("DownButton.Height=%lld TextHeight=%lld\n", DownButton.Height, TextHeight);
|
||||
t2 = EntriesPosY + (ScrollState.MaxVisible + 1) * TextHeight - DownButton.Height;
|
||||
t1 = EntriesPosX + TextHeight + MenuWidth + (INTN)((TEXT_XMARGIN + 16) * ThemeX.Scale);
|
||||
DBG("PAINT_ALL: %lld %lld\n", t1, t2);
|
||||
// DBG("PAINT_ALL: %lld %lld\n", t1, t2);
|
||||
SetBar(t1, EntriesPosY, t2, &ScrollState); //823 302 554
|
||||
|
||||
// blackosx swapped this around so drawing of selection comes before drawing scrollbar.
|
||||
@ -3834,10 +3861,11 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
}
|
||||
} else if (Entry->getREFIT_MENU_CHECKBIT()) {
|
||||
// DrawMenuText(XStringW().takeValueFrom(" "), 0, EntriesPosX, Entry->Place.YPos, 0xFFFF); //clean the place
|
||||
DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? (MenuWidth) : 0,
|
||||
ThemeX.FillRectAreaOfScreen(ctrlTextX, Entry->Place.YPos, MenuWidth, TextHeight);
|
||||
DrawMenuText(ResultString, (i == ScrollState.CurrentSelection) ? (MenuWidth) : 0,
|
||||
ctrlTextX,
|
||||
Entry->Place.YPos, 0xFFFF);
|
||||
ThemeX.Buttons[(((REFIT_INPUT_DIALOG*)(Entry))->Item->IValue & Entry->Row)?3:2].Draw(ctrlX, ctrlY);
|
||||
ThemeX.Buttons[(((REFIT_INPUT_DIALOG*)(Entry))->Item->IValue & Entry->Row)?3:2].Draw(ctrlX, ctrlY);
|
||||
} else if (Entry->getREFIT_MENU_SWITCH()) {
|
||||
if (Entry->getREFIT_MENU_SWITCH()->Item->IValue == 3) {
|
||||
//OldChosenItem = OldChosenTheme;
|
||||
@ -3898,7 +3926,7 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
|
||||
DrawMenuText(ResultString, 0,
|
||||
ctrlTextX,
|
||||
EntryL->Place.YPos, 0xFFFF);
|
||||
ThemeX.Buttons[(inputDialogEntry->Item->BValue)?3:2].Draw(ctrlX, EntryL->Place.YPos + PlaceCentre);
|
||||
ThemeX.Buttons[(inputDialogEntry->Item->BValue)?3:2].Draw(ctrlX, EntryL->Place.YPos + PlaceCentre);
|
||||
// DBG("se:X=%d, Y=%d, ImageY=%d\n", EntriesPosX + (INTN)(TEXT_XMARGIN * GlobalConfig.Scale),
|
||||
// EntryL->Place.YPos, EntryL->Place.YPos + PlaceCentre);
|
||||
} else {
|
||||
@ -4657,7 +4685,7 @@ VOID REFIT_MENU_SCREEN::CountItems()
|
||||
}
|
||||
}
|
||||
#if USE_XTHEME
|
||||
VOID DrawTextCorner(UINTN TextC, UINT8 Align)
|
||||
VOID REFIT_MENU_SCREEN::DrawTextCorner(UINTN TextC, UINT8 Align)
|
||||
{
|
||||
INTN Xpos;
|
||||
// CHAR16 *Text = NULL;
|
||||
@ -4843,7 +4871,7 @@ VOID REFIT_MENU_SCREEN::MainMenuVerticalStyle(IN UINTN Function, IN CONST CHAR16
|
||||
// Update FilmPlace only if not set by InitAnime
|
||||
if (FilmPlace.Width == 0 || FilmPlace.Height == 0) {
|
||||
// CopyMem(&FilmPlace, &BannerPlace, sizeof(BannerPlace));
|
||||
FilmPlace = BannerPlace;
|
||||
FilmPlace = ThemeX.BannerPlace;
|
||||
}
|
||||
|
||||
ThemeX.InitBar();
|
||||
@ -5169,7 +5197,7 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
|
||||
// Update FilmPlace only if not set by InitAnime
|
||||
if (FilmPlace.Width == 0 || FilmPlace.Height == 0) {
|
||||
// CopyMem(&FilmPlace, &BannerPlace, sizeof(BannerPlace));
|
||||
FilmPlace = BannerPlace;
|
||||
FilmPlace = ThemeX.BannerPlace;
|
||||
}
|
||||
|
||||
//DBG("main menu inited\n");
|
||||
|
@ -10,7 +10,8 @@
|
||||
VOID OptionsMenu(OUT REFIT_ABSTRACT_MENU_ENTRY **ChosenEntry);
|
||||
VOID FreeScrollBar(VOID);
|
||||
#if USE_XTHEME
|
||||
INTN DrawTextXY(IN const XStringW& Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign);
|
||||
//it will be REFIT_SCREEN MEMBER, others as well?
|
||||
//INTN DrawTextXY(IN const XStringW& Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign);
|
||||
VOID DrawMenuText(IN const XStringW& Text, IN INTN SelectedWidth, IN INTN XPos, IN INTN YPos, IN INTN Cursor);
|
||||
#else
|
||||
INTN DrawTextXY(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos, IN UINT8 XAlign);
|
||||
|
@ -80,6 +80,18 @@ INTN UGAHeight;
|
||||
BOOLEAN AllowGraphicsMode;
|
||||
|
||||
EG_RECT BannerPlace; // default ctor called, so it's zero
|
||||
#if USE_XTHEME
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL StdBackgroundPixel = { 0xbf, 0xbf, 0xbf, 0xff};
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL MenuBackgroundPixel = { 0x00, 0x00, 0x00, 0x00};
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL InputBackgroundPixel = { 0xcf, 0xcf, 0xcf, 0x80};
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL BlueBackgroundPixel = { 0x7f, 0x0f, 0x0f, 0xff};
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL EmbeddedBackgroundPixel = { 0xaa, 0xaa, 0xaa, 0xff};
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL DarkSelectionPixel = { 66, 66, 66, 0xff};
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL DarkEmbeddedBackgroundPixel = { 0x33, 0x33, 0x33, 0xff};
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL WhitePixel = { 0xff, 0xff, 0xff, 0xff};
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL BlackPixel = { 0x00, 0x00, 0x00, 0xff};
|
||||
EFI_GRAPHICS_OUTPUT_BLT_PIXEL SelectionBackgroundPixel = { 0xef, 0xef, 0xef, 0xff };
|
||||
#else
|
||||
|
||||
EG_PIXEL StdBackgroundPixel = { 0xbf, 0xbf, 0xbf, 0xff};
|
||||
EG_PIXEL MenuBackgroundPixel = { 0x00, 0x00, 0x00, 0x00};
|
||||
@ -90,10 +102,12 @@ EG_PIXEL DarkSelectionPixel = { 66, 66, 66, 0xff};
|
||||
EG_PIXEL DarkEmbeddedBackgroundPixel = { 0x33, 0x33, 0x33, 0xff};
|
||||
EG_PIXEL WhitePixel = { 0xff, 0xff, 0xff, 0xff};
|
||||
EG_PIXEL BlackPixel = { 0x00, 0x00, 0x00, 0xff};
|
||||
EG_PIXEL SelectionBackgroundPixel = { 0xef, 0xef, 0xef, 0xff };
|
||||
|
||||
EG_IMAGE *BackgroundImage = NULL;
|
||||
EG_IMAGE *Banner = NULL;
|
||||
EG_IMAGE *BigBack = NULL;
|
||||
#endif
|
||||
|
||||
static BOOLEAN GraphicsScreenDirty;
|
||||
|
||||
@ -334,7 +348,7 @@ VOID SwitchToGraphicsAndClear(VOID) //called from MENU_FUNCTION_INIT
|
||||
{
|
||||
SwitchToGraphics();
|
||||
#if USE_XTHEME
|
||||
DBG("clear screen and draw back\n");
|
||||
// DBG("clear screen and draw back\n");
|
||||
ThemeX.ClearScreen();
|
||||
#else
|
||||
if (GraphicsScreenDirty) { //Invented in rEFIt 15 years ago
|
||||
@ -553,24 +567,45 @@ VOID BltImageAlpha(IN EG_IMAGE *Image, IN INTN XPos, IN INTN YPos, IN EG_PIXEL *
|
||||
}
|
||||
// DBG("w=%d, h=%d\n", Width, Height);
|
||||
// compose on background
|
||||
#if USE_XTHEME
|
||||
CompImage = egCreateFilledImage(Width, Height, !ThemeX.Background.isEmpty(), BackgroundPixel); //no matter
|
||||
#else
|
||||
CompImage = egCreateFilledImage(Width, Height, (BackgroundImage != NULL), BackgroundPixel);
|
||||
#endif
|
||||
|
||||
egComposeImage(CompImage, NewImage, 0, 0);
|
||||
if (NewImage) {
|
||||
egFreeImage(NewImage);
|
||||
}
|
||||
#if USE_XTHEME
|
||||
if (ThemeX.Background.isEmpty()) {
|
||||
egDrawImageArea(CompImage, 0, 0, 0, 0, XPos, YPos);
|
||||
egFreeImage(CompImage);
|
||||
return;
|
||||
}
|
||||
#else
|
||||
if (!BackgroundImage) {
|
||||
egDrawImageArea(CompImage, 0, 0, 0, 0, XPos, YPos);
|
||||
egFreeImage(CompImage);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
NewImage = egCreateImage(Width, Height, FALSE);
|
||||
if (!NewImage) return;
|
||||
// DBG("draw on background\n");
|
||||
#if USE_XTHEME
|
||||
egRawCopy(NewImage->PixelData,
|
||||
(EG_PIXEL*)ThemeX.Background.GetPixelPtr(0,0) + YPos * ThemeX.Background.GetWidth() + XPos,
|
||||
Width, Height,
|
||||
Width,
|
||||
ThemeX.Background.GetWidth());
|
||||
#else
|
||||
egRawCopy(NewImage->PixelData,
|
||||
BackgroundImage->PixelData + YPos * BackgroundImage->Width + XPos,
|
||||
Width, Height,
|
||||
Width,
|
||||
BackgroundImage->Width);
|
||||
#endif
|
||||
egComposeImage(NewImage, CompImage, 0, 0);
|
||||
egFreeImage(CompImage);
|
||||
|
||||
@ -934,7 +969,7 @@ VOID REFIT_MENU_SCREEN::UpdateAnime()
|
||||
Now = AsmReadTsc();
|
||||
if (LastDraw == 0) {
|
||||
//first start, we should save background into last frame
|
||||
egFillImageArea(AnimeImage, 0, 0, AnimeImage->Width, AnimeImage->Height, &MenuBackgroundPixel);
|
||||
egFillImageArea(AnimeImage, 0, 0, AnimeImage->Width, AnimeImage->Height, (EG_PIXEL*)&MenuBackgroundPixel);
|
||||
egTakeImage(Film[Frames],
|
||||
x, y,
|
||||
Film[Frames]->Width,
|
||||
|
Loading…
Reference in New Issue
Block a user