MCPcopy Create free account
hub / github.com/CloverHackyColor/CloverBootloader / InitAnime

Method InitAnime

rEFIt_UEFI/refit/screen.cpp:422–475  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

420}
421
422VOID REFIT_MENU_SCREEN::InitAnime()
423{
424 if (gThemeChanged) {
425 FilmC = nullptr;
426 }
427 if (FilmC == nullptr) {
428// DBG("Screen %lld inited without anime\n", ID);
429// FilmC->AnimeRun = FALSE;
430 return;
431 }
432// DBG("=== Debug Film ===\n");
433// DBG("FilmX=%lld\n", FilmC->FilmX);
434// DBG("ID=%lld\n", FilmC->GetIndex());
435// DBG("RunOnce=%d\n", FilmC->RunOnce?1:0);
436// DBG("NumFrames=%lld\n", FilmC->NumFrames);
437// DBG("FrameTime=%lld\n", FilmC->FrameTime);
438// DBG("Path=%ls\n", FilmC->Path.wc_str());
439// DBG("LastFrame=%lld\n\n", FilmC->LastFrameID());
440
441 XImage FirstFrame = FilmC->GetImage(FilmC->LastFrameID()); //can not be absent
442 INTN CWidth = FirstFrame.GetWidth();
443 INTN CHeight = FirstFrame.GetHeight();
444 if ((FilmC->FilmX >=0) && (FilmC->FilmX <=100) &&
445 (FilmC->FilmY >=0) && (FilmC->FilmY <=100)) { //default is 0xFFFF
446 // Check if screen size being used is different from theme origination size.
447 // If yes, then recalculate the animation placement % value.
448 // This is necessary because screen can be a different size, but anim is not scaled.
449 FilmC->FilmPlace.XPos = HybridRepositioning(FilmC->ScreenEdgeHorizontal, FilmC->FilmX, CWidth, UGAWidth, ThemeX.ThemeDesignWidth );
450 FilmC->FilmPlace.YPos = HybridRepositioning(FilmC->ScreenEdgeVertical, FilmC->FilmY, CHeight, UGAHeight, ThemeX.ThemeDesignHeight);
451
452 // Does the user want to fine tune the placement?
453 FilmC->FilmPlace.XPos = CalculateNudgePosition(FilmC->FilmPlace.XPos, FilmC->NudgeX, CWidth, UGAWidth);
454 FilmC->FilmPlace.YPos = CalculateNudgePosition(FilmC->FilmPlace.YPos, FilmC->NudgeY, CHeight, UGAHeight);
455
456 FilmC->FilmPlace.Width = CWidth;
457 FilmC->FilmPlace.Height = CHeight;
458// DBG("recalculated Film position [%lld, %lld]\n", FilmC->FilmPlace.XPos, FilmC->FilmPlace.YPos);
459 } else {
460 // We are here if there is no anime, or if we use oldstyle placement values
461 // For both these cases, FilmPlace will be set after banner/menutitle positions are known
462 FilmC->FilmPlace = ThemeX.BannerPlace;
463 if (CWidth > 0 && CHeight > 0) {
464 // Retained for legacy themes without new anim placement options.
465 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;
466 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;
467 }
468 }
469 if (FilmC->NumFrames != 0) {
470 DBG(" Anime seems OK, init it\n");
471 FilmC->AnimeRun = TRUE;
472 FilmC->Reset();
473 FilmC->LastDraw = 0;
474 }
475}
476
477//
478// Sets next/previous available screen resolution, according to specified offset

Callers

nothing calls this directly

Calls 6

HybridRepositioningFunction · 0.85
CalculateNudgePositionFunction · 0.85
LastFrameIDMethod · 0.80
GetWidthMethod · 0.80
GetHeightMethod · 0.80
ResetMethod · 0.80

Tested by

no test coverage detected