Correct case where anime calculation could become negative

This commit is contained in:
asava 2020-04-23 04:32:23 +03:00
parent d3da5e1a21
commit f8c1f08c13
3 changed files with 12 additions and 18 deletions

View File

@ -1592,11 +1592,11 @@ VOID REFIT_MENU_SCREEN::GraphicsMenuStyle(IN UINTN Function, IN CONST CHAR16 *Pa
TitleImage.Draw(FilmXPos, FilmYPos);
// update FilmPlace only if not set by InitAnime
if (FilmPlace.Width == 0 || FilmPlace.Height == 0) {
FilmPlace.XPos = FilmXPos;
FilmPlace.YPos = FilmYPos;
FilmPlace.Width = TitleImage.GetWidth();
FilmPlace.Height = TitleImage.GetHeight();
if (FilmC->FilmPlace.Width == 0 || FilmC->FilmPlace.Height == 0) {
FilmC->FilmPlace.XPos = FilmXPos;
FilmC->FilmPlace.YPos = FilmYPos;
FilmC->FilmPlace.Width = TitleImage.GetWidth();
FilmC->FilmPlace.Height = TitleImage.GetHeight();
}
}
@ -2170,8 +2170,8 @@ 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) {
FilmPlace = ThemeX.BannerPlace;
if (FilmC->FilmPlace.Width == 0 || FilmC->FilmPlace.Height == 0) {
FilmC->FilmPlace = ThemeX.BannerPlace;
}
ThemeX.InitBar(); //not sure
@ -2343,9 +2343,9 @@ VOID REFIT_MENU_SCREEN::MainMenuStyle(IN UINTN Function, IN CONST CHAR16 *ParamT
// ThemeX.InitSelection(); //not needed to do here
// Update FilmPlace only if not set by InitAnime
if (FilmPlace.Width == 0 || FilmPlace.Height == 0) {
if (FilmC->FilmPlace.Width == 0 || FilmC->FilmPlace.Height == 0) {
// CopyMem(&FilmPlace, &BannerPlace, sizeof(BannerPlace));
FilmPlace = ThemeX.BannerPlace;
FilmC->FilmPlace = ThemeX.BannerPlace;
}
//DBG("main menu inited\n");

View File

@ -92,7 +92,7 @@ public:
INTN CurrentFrame;
// INTN Frames; //there are FilmC properties
// UINTN FrameTime; //ms
EG_RECT FilmPlace;
// EG_RECT FilmPlace;
FILM *FilmC;
//XImage FilmPlaceImage;

View File

@ -461,14 +461,8 @@ VOID REFIT_MENU_SCREEN::InitAnime()
FilmC->FilmPlace = ThemeX.BannerPlace;
if (CWidth > 0 && CHeight > 0) {
// Retained for legacy themes without new anim placement options.
FilmC->FilmPlace.XPos += (FilmC->FilmPlace.Width - CWidth) / 2;
if (FilmC->FilmPlace.XPos < 0) {
FilmPlace.XPos = 0;
}
FilmC->FilmPlace.YPos += (FilmC->FilmPlace.Height - CHeight) / 2;
if (FilmC->FilmPlace.YPos < 0) {
FilmPlace.YPos = 0;
}
FilmC->FilmPlace.XPos = ((INTN)FilmC->FilmPlace.XPos * 2 > CWidth - (INTN)FilmC->FilmPlace.Width ) ? (UINTN)((INTN)FilmC->FilmPlace.XPos + ((INTN)FilmC->FilmPlace.Width - CWidth ) / 2) : 0;
FilmC->FilmPlace.YPos = ((INTN)FilmC->FilmPlace.YPos * 2 > CHeight - (INTN)FilmC->FilmPlace.Height) ? (UINTN)((INTN)FilmC->FilmPlace.YPos + ((INTN)FilmC->FilmPlace.Height - CHeight) / 2) : 0;
}
}
if (FilmC->NumFrames != 0) {