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

Function InitTheme

rEFIt_UEFI/Platform/Settings.cpp:3624–3828  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3622}
3623
3624EFI_STATUS
3625InitTheme(BOOLEAN UseThemeDefinedInNVRam)
3626{
3627 EFI_STATUS Status = EFI_NOT_FOUND;
3628 UINTN Size = 0;
3629 UINTN i;
3630 TagDict* ThemeDict = NULL;
3631 CHAR8 *ChosenTheme = NULL;
3632 UINTN Rnd;
3633 EFI_TIME Now;
3634
3635 gRT->GetTime(&Now, NULL);
3636 DbgHeader("InitXTheme");
3637 ThemeX.Init();
3638
3639 //initialize Daylight when we know timezone
3640 if (GlobalConfig.Timezone != 0xFF) { // 0xFF:default=timezone not set
3641 INT32 NowHour = Now.Hour + GlobalConfig.Timezone;
3642 if (NowHour < 0 ) NowHour += 24;
3643 if (NowHour >= 24 ) NowHour -= 24;
3644 ThemeX.Daylight = (NowHour > 8) && (NowHour < 20);
3645 } else {
3646 ThemeX.Daylight = TRUE; // when timezone is not set
3647 }
3648 if (ThemeX.Daylight) {
3649 DBG("use Daylight theme\n");
3650 } else {
3651 DBG("use night theme\n");
3652 }
3653
3654 for (i = 0; i < 3; i++) {
3655 // DBG("validate %d face\n", i);
3656 textFace[i].valid = FALSE;
3657 }
3658
3659 NSVGfontChain *fontChain = fontsDB;
3660 while (fontChain) {
3661 NSVGfont *font = fontChain->font;
3662 // DBG("free font %s\n", font->fontFamily);
3663 NSVGfontChain *nextChain = fontChain->next;
3664 if (font) {
3665 nsvg__deleteFont(font);
3666 fontChain->font = NULL;
3667 }
3668 FreePool(fontChain);
3669 fontChain = nextChain;
3670 }
3671 //as all font freed then free the chain
3672 fontsDB = NULL;
3673
3674 /*
3675 if (mainParser) {
3676 nsvg__deleteParser(mainParser);
3677 DBG("parser deleted\n");
3678 mainParser = NULL;
3679 }
3680 */
3681 ThemeX.FontImage.setEmpty();

Callers 2

RefitMainFunction · 0.85
QuerySecureBootUserFunction · 0.85

Calls 15

DbgHeaderFunction · 0.85
nsvg__deleteFontFunction · 0.85
GetNvramVariableFunction · 0.85
AsciiStrCmpFunction · 0.85
StartupSoundPlayFunction · 0.85
GetThemeTagSettingsMethod · 0.80
LoadThemeMethod · 0.80
FillByEmbeddedMethod · 0.80
dictPropertyForKeyMethod · 0.80
FillByDirMethod · 0.80
equalICMethod · 0.80
PrepareFontMethod · 0.80

Tested by

no test coverage detected