repaired NonSelectedGray and inline badges

Signed-off-by: SergeySlice <sergey.slice@gmail.com>
This commit is contained in:
SergeySlice 2020-04-21 18:57:47 +03:00
parent 0e57155f2f
commit d91781b79e
3 changed files with 24 additions and 5 deletions

View File

@ -1870,8 +1870,14 @@ VOID REFIT_MENU_SCREEN::DrawMainMenuLabel(IN CONST XStringW& Text, IN INTN XPos,
(ThemeX.HideBadges & HDBADGES_INLINE) &&
(Entries[ScrollState.CurrentSelection].Row == 0)) {
// Display Inline Badge: small icon before the text
Entries[ScrollState.CurrentSelection].Image.Draw((XPos - (TextWidth >> 1) - (BadgeDim + 16)),
(YPos - ((BadgeDim - ThemeX.TextHeight) >> 1)));
XImage Back(BadgeDim, BadgeDim);
INTN X = XPos - (TextWidth >> 1) - (BadgeDim + 16);
INTN Y = YPos - ((BadgeDim - ThemeX.TextHeight) >> 1);
Back.CopyRect(ThemeX.Background, X, Y);
Back.Compose(0, 0, Entries[ScrollState.CurrentSelection].Image, false, BadgeDim/128.f);
// Entries[ScrollState.CurrentSelection].Image.Draw((XPos - (TextWidth >> 1) - (BadgeDim + 16)),
// (YPos - ((BadgeDim - ThemeX.TextHeight) >> 1)));
Back.DrawOnBack(X, Y, Back);
}
OldX = XPos;
@ -2016,12 +2022,13 @@ VOID REFIT_MENU_SCREEN::DrawMainMenuEntry(REFIT_ABSTRACT_MENU_ENTRY *Entry, BOOL
// DBG(" Comp=[%lld,%lld], offset=[%lld,%lld]\n", CompWidth, CompHeight, OffsetX, OffsetY);
float composeScale = (ThemeX.NonSelectedGrey && !selected)? -1.f: 1.f;
if(ThemeX.SelectionOnTop) {
//place main image in centre. It may be OS or Drive
Back.Compose(OffsetX, OffsetY, MainImage, false);
Back.Compose(OffsetX, OffsetY, MainImage, false, composeScale);
} else {
Back.Compose(OffsetTX, OffsetTY, TopImage, false); //selection first
Back.Compose(OffsetX, OffsetY, MainImage, false);
Back.Compose(OffsetX, OffsetY, MainImage, false, composeScale);
}
// DBG("compose size=%lld\n", CompWidth);
//the badge is already scaled?

View File

@ -261,6 +261,11 @@ void XImage::Compose(const EG_RECT& OutPlace, const EG_RECT& InPlace, const XIma
INTN PosY = InPlace.YPos;
INTN WArea = InPlace.Width;
INTN HArea = InPlace.Height;
bool gray = false;
if (TopScale < 0) {
gray = true;
TopScale = -TopScale;
}
XImage Top2;
if (TopScale != 0.f && TopScale != 1.f) {
Top2.setSizeInPixels((UINTN)(TopImage.GetWidth() * TopScale), (UINTN)(TopImage.GetHeight() * TopScale));
@ -306,6 +311,13 @@ void XImage::Compose(const EG_RECT& OutPlace, const EG_RECT& InPlace, const XIma
Temp = (CompPtr->Red * TempAlpha) + (Top.GetPixel(x + PosX, y + PosY).Red * TopAlpha);
CompPtr->Red = (UINT8)(Temp / FinalAlpha);
if (gray) {
Temp = ((UINT32)CompPtr->Blue + 2 * (UINT32)CompPtr->Red + 4 * (UINT32)CompPtr->Green) / 7;
CompPtr->Blue = (UINT8)Temp;
CompPtr->Red = (UINT8)Temp;
CompPtr->Green = (UINT8)Temp;
}
}
if (Lowest) {

View File

@ -248,7 +248,7 @@ void XTheme::Init()
BannerNudgeY = 0;
BanHeight = 0;
VerticalLayout = FALSE;
NonSelectedGrey = FALSE; //TODO what about SVG?
NonSelectedGrey = FALSE;
MainEntriesSize = 128;
TileXSpace = 8;
TileYSpace = 24;