| 1 |
/* |
| 2 |
* Copyright (C) 2015-2018 Team Kodi |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#include "GUIWindowSplash.h" |
| 10 |
|
| 11 |
#include "Util.h" |
| 12 |
#include "guilib/GUIImage.h" |
| 13 |
#include "guilib/GUIWindowManager.h" |
| 14 |
#include "settings/AdvancedSettings.h" |
| 15 |
#include "settings/SettingsComponent.h" |
| 16 |
|
| 17 |
#include <memory> |
| 18 |
|
| 19 |
CGUIWindowSplash::CGUIWindowSplash(void) : CGUIWindow(WINDOW_SPLASH, ""), m_image(nullptr) |
| 20 |
{ |
| 21 |
m_loadType = LOAD_ON_GUI_INIT; |
| 22 |
} |
| 23 |
|
| 24 |
CGUIWindowSplash::~CGUIWindowSplash(void) = default; |
| 25 |
|
| 26 |
void CGUIWindowSplash::OnInitWindow() |
| 27 |
{ |
| 28 |
if (!CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_splashImage) |
| 29 |
return; |
| 30 |
|
| 31 |
m_image = std::make_unique<CGUIImage>( |
| 32 |
0, 0, .0f, .0f, |
| 33 |
static_cast<float>(CServiceBroker::GetWinSystem()->GetGfxContext().GetWidth()), |
| 34 |
static_cast<float>(CServiceBroker::GetWinSystem()->GetGfxContext().GetHeight()), |
| 35 |
CTextureInfo(CUtil::GetSplashPath())); |
| 36 |
m_image->SetAspectRatio(CAspectRatio::AR_SCALE); |
| 37 |
} |
| 38 |
|
| 39 |
void CGUIWindowSplash::Render() |
| 40 |
{ |
| 41 |
CServiceBroker::GetWinSystem()->GetGfxContext().SetRenderingResolution(CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo(), true); |
| 42 |
|
| 43 |
if (!m_image) |
| 44 |
return; |
| 45 |
|
| 46 |
m_image->SetWidth(CServiceBroker::GetWinSystem()->GetGfxContext().GetWidth()); |
| 47 |
m_image->SetHeight(CServiceBroker::GetWinSystem()->GetGfxContext().GetHeight()); |
| 48 |
m_image->AllocResources(); |
| 49 |
m_image->Render(); |
| 50 |
m_image->FreeResources(); |
| 51 |
} |