mirror of
https://github.com/CloverHackyColor/CloverBootloader.git
synced 2024-12-25 16:37:42 +01:00
some screen operations for xtheme
Signed-off-by: Sergey Isakov <isakov-sl@bk.ru>
This commit is contained in:
parent
81f2b91b15
commit
0eb9528089
@ -78,16 +78,19 @@ public:
|
|||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
XImage Background; //Background and Banner will not be in array as they live own life
|
XImage Background; //Background and Banner will not be in array as they live own life
|
||||||
XImage BigBack; //not sure is needed
|
XImage BigBack; //it size is not equal to screen size will be scaled or cropped
|
||||||
XImage Banner; //same as logo in the array
|
XImage Banner; //same as logo in the array, make a link?
|
||||||
|
|
||||||
|
//fill the theme
|
||||||
XImage& GetIcon(XStringW& Name, BOOLEAN Night); //get by name
|
XImage& GetIcon(XStringW& Name, BOOLEAN Night); //get by name
|
||||||
XImage& GetIcon(INTN Id, BOOLEAN Night); //get by id
|
XImage& GetIcon(INTN Id, BOOLEAN Night); //get by id
|
||||||
|
|
||||||
void AddIcon(Icon& NewIcon); //return EFI_STATUS?
|
void AddIcon(Icon& NewIcon); //return EFI_STATUS?
|
||||||
|
|
||||||
void FillByEmbedded();
|
void FillByEmbedded();
|
||||||
VOID ClearScreen();
|
|
||||||
|
//screen operations
|
||||||
|
void ClearScreen();
|
||||||
|
VOID FillRectAreaOfScreen(IN INTN XPos, IN INTN YPos, IN INTN Width, IN INTN Height);
|
||||||
|
|
||||||
XTheme(); //default constructor
|
XTheme(); //default constructor
|
||||||
~XTheme();
|
~XTheme();
|
||||||
|
@ -3830,7 +3830,7 @@ VOID DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN
|
|||||||
} else {
|
} else {
|
||||||
MainImage = Entry->Image;
|
MainImage = Entry->Image;
|
||||||
}
|
}
|
||||||
|
//this should be inited by the Theme
|
||||||
if (!MainImage) {
|
if (!MainImage) {
|
||||||
if (!IsEmbeddedTheme()) {
|
if (!IsEmbeddedTheme()) {
|
||||||
MainImage = egLoadIcon(ThemeDir, GetIconsExt(L"icons\\os_mac", L"icns"), Scale << 3);
|
MainImage = egLoadIcon(ThemeDir, GetIconsExt(L"icons\\os_mac", L"icns"), Scale << 3);
|
||||||
@ -3843,14 +3843,40 @@ VOID DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// DBG("Entry title=%s; Width=%d\n", Entry->Title, MainImage->Width);
|
// DBG("Entry title=%s; Width=%d\n", Entry->Title, MainImage->Width);
|
||||||
|
#if USE_XTHEME
|
||||||
|
float fScale;
|
||||||
|
if (TypeSVG) {
|
||||||
|
fScale = (selected ? 1.f : -1.f);
|
||||||
|
} else {
|
||||||
|
fScale = ((Entry->Row == 0) ? (MainEntriesSize/128.f * (selected ? 1.f : -1.f)): 1.f) ;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
if (GlobalConfig.TypeSVG) {
|
if (GlobalConfig.TypeSVG) {
|
||||||
Scale = 16 * (selected ? 1 : -1);
|
Scale = 16 * (selected ? 1 : -1);
|
||||||
} else {
|
} else {
|
||||||
Scale = ((Entry->Row == 0) ? (Scale * (selected ? 1 : -1)): 16) ;
|
Scale = ((Entry->Row == 0) ? (Scale * (selected ? 1 : -1)): 16) ;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
if (Entry->Row == 0) {
|
if (Entry->Row == 0) {
|
||||||
BadgeImage = Entry->getBadgeImage();
|
BadgeImage = Entry->getBadgeImage();
|
||||||
} //else null
|
} //else null
|
||||||
|
#if USE_XTHEME
|
||||||
|
INTN index = ((Entry->Row == 0) ? 0 : 2) + (selected ? 0 : 1);
|
||||||
|
XImage& TopImage = *SelectionImages[index];
|
||||||
|
|
||||||
|
if(SelectionOnTop) {
|
||||||
|
BaseImage.Draw(XPos, YPos, fScale);
|
||||||
|
BadgeImage.Draw(XPos, YPos, fScale);
|
||||||
|
TopImage.Draw(XPos, YPos, fScale);
|
||||||
|
} else {
|
||||||
|
TopImage.Draw(XPos, YPos, fScale);
|
||||||
|
BaseImage.Draw(XPos, YPos, fScale);
|
||||||
|
BadgeImage.Draw(XPos, YPos, fScale);
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
if (GlobalConfig.SelectionOnTop) {
|
if (GlobalConfig.SelectionOnTop) {
|
||||||
SelectionImages[0]->HasAlpha = TRUE;
|
SelectionImages[0]->HasAlpha = TRUE;
|
||||||
SelectionImages[2]->HasAlpha = TRUE;
|
SelectionImages[2]->HasAlpha = TRUE;
|
||||||
@ -3865,13 +3891,13 @@ VOID DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN
|
|||||||
BadgeImage,
|
BadgeImage,
|
||||||
XPos, YPos, Scale);
|
XPos, YPos, Scale);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
// draw BCS indicator
|
// draw BCS indicator
|
||||||
// Needy: if Labels (Titles) are hidden there is no point to draw the indicator
|
// Needy: if Labels (Titles) are hidden there is no point to draw the indicator
|
||||||
if (GlobalConfig.BootCampStyle && !(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL)) {
|
if (GlobalConfig.BootCampStyle && !(GlobalConfig.HideUIFlags & HIDEUI_FLAG_LABEL)) {
|
||||||
SelectionImages[4]->HasAlpha = TRUE;
|
SelectionImages[4]->HasAlpha = TRUE;
|
||||||
|
|
||||||
// inidcator is for row 0, main entries, only
|
// indicator is for row 0, main entries, only
|
||||||
if (Entry->Row == 0) {
|
if (Entry->Row == 0) {
|
||||||
BltImageAlpha(SelectionImages[4 + (selected ? 0 : 1)],
|
BltImageAlpha(SelectionImages[4 + (selected ? 0 : 1)],
|
||||||
XPos + (row0TileSize / 2) - (INTN)(INDICATOR_SIZE * 0.5f * GlobalConfig.Scale),
|
XPos + (row0TileSize / 2) - (INTN)(INDICATOR_SIZE * 0.5f * GlobalConfig.Scale),
|
||||||
@ -3890,7 +3916,16 @@ VOID DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOLEAN selected, INTN
|
|||||||
egFreeImage(MainImage);
|
egFreeImage(MainImage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
//the purpose of the procedure is restore Background in rect
|
||||||
|
//XAlign is always centre, Color is the Backgrounf fill
|
||||||
|
#if USE_XTHEME
|
||||||
|
VOID XTheme::FillRectAreaOfScreen(IN INTN XPos, IN INTN YPos, IN INTN Width, IN INTN Height)
|
||||||
|
{
|
||||||
|
XImage TmpBuffer(Width, Height);
|
||||||
|
TmpBuffer.CopyScaled(Background, 1.f);
|
||||||
|
TmpBuffer.Draw(XPos, YPos);
|
||||||
|
}
|
||||||
|
#else
|
||||||
VOID FillRectAreaOfScreen(IN INTN XPos, IN INTN YPos, IN INTN Width, IN INTN Height, IN EG_PIXEL *Color, IN UINT8 XAlign)
|
VOID FillRectAreaOfScreen(IN INTN XPos, IN INTN YPos, IN INTN Width, IN INTN Height, IN EG_PIXEL *Color, IN UINT8 XAlign)
|
||||||
{
|
{
|
||||||
EG_IMAGE *TmpBuffer = NULL;
|
EG_IMAGE *TmpBuffer = NULL;
|
||||||
@ -3911,6 +3946,7 @@ VOID FillRectAreaOfScreen(IN INTN XPos, IN INTN YPos, IN INTN Width, IN INTN Hei
|
|||||||
BltImage(TmpBuffer, X, YPos);
|
BltImage(TmpBuffer, X, YPos);
|
||||||
egFreeImage(TmpBuffer);
|
egFreeImage(TmpBuffer);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
VOID REFIT_MENU_SCREEN::DrawMainMenuLabel(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos)
|
VOID REFIT_MENU_SCREEN::DrawMainMenuLabel(IN CONST CHAR16 *Text, IN INTN XPos, IN INTN YPos)
|
||||||
{
|
{
|
||||||
|
@ -396,9 +396,13 @@ BOOLEAN CheckError(IN EFI_STATUS Status, IN CONST CHAR16 *where)
|
|||||||
VOID SwitchToGraphicsAndClear(VOID) //called from MENU_FUNCTION_INIT
|
VOID SwitchToGraphicsAndClear(VOID) //called from MENU_FUNCTION_INIT
|
||||||
{
|
{
|
||||||
SwitchToGraphics();
|
SwitchToGraphics();
|
||||||
if (GraphicsScreenDirty) {
|
#if USE_XTHEME
|
||||||
|
Theme.ClearScreen();
|
||||||
|
#else
|
||||||
|
if (GraphicsScreenDirty) { //Invented in rEFIt 15 years ago
|
||||||
BltClearScreen();
|
BltClearScreen();
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -408,10 +412,11 @@ typedef struct {
|
|||||||
INTN Width;
|
INTN Width;
|
||||||
INTN Height;
|
INTN Height;
|
||||||
} EG_RECT;
|
} EG_RECT;
|
||||||
|
//same as EgRect but INTN <-> UINTN
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if USE_XTHEME
|
#if USE_XTHEME
|
||||||
VOID XTheme::BltClearScreen()
|
VOID XTheme::ClearScreen()
|
||||||
{
|
{
|
||||||
if (BanHeight < 2) {
|
if (BanHeight < 2) {
|
||||||
BanHeight = ((UGAHeight - (int)(LayoutHeight * Scale)) >> 1);
|
BanHeight = ((UGAHeight - (int)(LayoutHeight * Scale)) >> 1);
|
||||||
@ -736,7 +741,8 @@ VOID BltImageAlpha(IN EG_IMAGE *Image, IN INTN XPos, IN INTN YPos, IN EG_PIXEL *
|
|||||||
egDrawImageArea(NewImage, 0, 0, 0, 0, XPos, YPos);
|
egDrawImageArea(NewImage, 0, 0, 0, 0, XPos, YPos);
|
||||||
egFreeImage(NewImage);
|
egFreeImage(NewImage);
|
||||||
}
|
}
|
||||||
|
//not used
|
||||||
|
/*
|
||||||
VOID BltImageComposite(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN INTN XPos, IN INTN YPos)
|
VOID BltImageComposite(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN INTN XPos, IN INTN YPos)
|
||||||
{
|
{
|
||||||
INTN TotalWidth, TotalHeight, CompWidth, CompHeight, OffsetX, OffsetY;
|
INTN TotalWidth, TotalHeight, CompWidth, CompHeight, OffsetX, OffsetY;
|
||||||
@ -768,7 +774,7 @@ VOID BltImageComposite(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN INTN XP
|
|||||||
egFreeImage(CompImage);
|
egFreeImage(CompImage);
|
||||||
GraphicsScreenDirty = TRUE;
|
GraphicsScreenDirty = TRUE;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/*
|
/*
|
||||||
--------------------------------------------------------------------
|
--------------------------------------------------------------------
|
||||||
Pos : Bottom -> Mid -> Top
|
Pos : Bottom -> Mid -> Top
|
||||||
@ -780,6 +786,21 @@ VOID BltImageComposite(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN INTN XP
|
|||||||
BaseImage = MainImage, TopImage = Selection
|
BaseImage = MainImage, TopImage = Selection
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#if USE_XTHEME
|
||||||
|
/*
|
||||||
|
// TopImage = SelectionImages[index]
|
||||||
|
// The procedure will be replaced by
|
||||||
|
if(SelectionOnTop) {
|
||||||
|
BaseImage.Draw(XPos, YPos, Scale/16.f);
|
||||||
|
BadgeImage.Draw(XPos, YPos, Scale/16.f);
|
||||||
|
TopImage.Draw(XPos, YPos, Scale/16.f);
|
||||||
|
} else {
|
||||||
|
TopImage.Draw(XPos, YPos, Scale/16.f);
|
||||||
|
BaseImage.Draw(XPos, YPos, Scale/16.f);
|
||||||
|
BadgeImage.Draw(XPos, YPos, Scale/16.f);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
#else
|
||||||
VOID BltImageCompositeBadge(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN EG_IMAGE *BadgeImage, IN INTN XPos, IN INTN YPos, INTN Scale)
|
VOID BltImageCompositeBadge(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN EG_IMAGE *BadgeImage, IN INTN XPos, IN INTN YPos, INTN Scale)
|
||||||
{
|
{
|
||||||
INTN TotalWidth, TotalHeight, CompWidth, CompHeight, OffsetX, OffsetY, OffsetXTmp, OffsetYTmp;
|
INTN TotalWidth, TotalHeight, CompWidth, CompHeight, OffsetX, OffsetY, OffsetXTmp, OffsetYTmp;
|
||||||
@ -901,6 +922,7 @@ VOID BltImageCompositeBadge(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN EG
|
|||||||
egFreeImage(NewTopImage);
|
egFreeImage(NewTopImage);
|
||||||
GraphicsScreenDirty = TRUE;
|
GraphicsScreenDirty = TRUE;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#define MAX_SIZE_ANIME 256
|
#define MAX_SIZE_ANIME 256
|
||||||
|
|
||||||
|
@ -20,6 +20,6 @@ VOID SwitchToGraphicsAndClear(VOID);
|
|||||||
VOID BltClearScreen();
|
VOID BltClearScreen();
|
||||||
VOID BltImage(IN EG_IMAGE *Image, IN INTN XPos, IN INTN YPos);
|
VOID BltImage(IN EG_IMAGE *Image, IN INTN XPos, IN INTN YPos);
|
||||||
VOID BltImageAlpha(IN EG_IMAGE *Image, IN INTN XPos, IN INTN YPos, IN EG_PIXEL *BackgroundPixel, INTN Scale);
|
VOID BltImageAlpha(IN EG_IMAGE *Image, IN INTN XPos, IN INTN YPos, IN EG_PIXEL *BackgroundPixel, INTN Scale);
|
||||||
VOID BltImageComposite(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN INTN XPos, IN INTN YPos);
|
//VOID BltImageComposite(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN INTN XPos, IN INTN YPos);
|
||||||
VOID BltImageCompositeBadge(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN EG_IMAGE *BadgeImage, IN INTN XPos, IN INTN YPos, INTN Scale);
|
VOID BltImageCompositeBadge(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN EG_IMAGE *BadgeImage, IN INTN XPos, IN INTN YPos, INTN Scale);
|
||||||
//VOID BltImageCompositeIndicator(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN INTN XPos, IN INTN YPos, INTN Scale);
|
//VOID BltImageCompositeIndicator(IN EG_IMAGE *BaseImage, IN EG_IMAGE *TopImage, IN INTN XPos, IN INTN YPos, INTN Scale);
|
||||||
|
Loading…
Reference in New Issue
Block a user