Correct positioning for legacy anime

This commit is contained in:
asava 2020-04-19 17:40:03 +03:00
parent 0ff64f4248
commit e62ca9a398

View File

@ -437,14 +437,14 @@ VOID REFIT_MENU_SCREEN::InitAnime()
// DBG("Path=%ls\n", FilmC->Path.wc_str());
// DBG("LastFrame=%lld\n\n", FilmC->LastFrameID());
XImage FirstFrame = FilmC->GetImage(FilmC->LastFrameID()); //can not be absent
INTN CWidth = FirstFrame.GetWidth();
INTN CHeight = FirstFrame.GetHeight();
if ((FilmC->FilmX >=0) && (FilmC->FilmX <=100) &&
(FilmC->FilmY >=0) && (FilmC->FilmY <=100)) { //default is 0xFFFF
// Check if screen size being used is different from theme origination size.
// If yes, then recalculate the animation placement % value.
// This is necessary because screen can be a different size, but anim is not scaled.
XImage FirstFrame = FilmC->GetImage(FilmC->LastFrameID()); //can not be absent
INTN CWidth = FirstFrame.GetWidth();
INTN CHeight = FirstFrame.GetHeight();
FilmC->FilmPlace.XPos = HybridRepositioning(FilmC->ScreenEdgeHorizontal, FilmC->FilmX, CWidth, UGAWidth, ThemeX.ThemeDesignWidth );
FilmC->FilmPlace.YPos = HybridRepositioning(FilmC->ScreenEdgeVertical, FilmC->FilmY, CHeight, UGAHeight, ThemeX.ThemeDesignHeight);
@ -459,6 +459,17 @@ VOID REFIT_MENU_SCREEN::InitAnime()
// We are here if there is no anime, or if we use oldstyle placement values
// For both these cases, FilmPlace will be set after banner/menutitle positions are known
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.XPos = 0;
}
}
}
if (FilmC->NumFrames != 0) {
DBG(" Anime seems OK, init it\n");