2 * Copyright (C) 2005-2018 Team Kodi
3 * This file is part of Kodi - https://kodi.tv
5 * SPDX-License-Identifier: GPL-2.0-or-later
6 * See LICENSES/README.md for more information.
9 #include "RenderSystem.h"
12 #include "guilib/GUIFontManager.h"
13 #include "guilib/GUIImage.h"
14 #include "guilib/GUILabelControl.h"
15 #include "settings/AdvancedSettings.h"
16 #include "settings/SettingsComponent.h"
20 CRenderSystemBase::CRenderSystemBase()
22 m_bRenderCreated
= false;
24 m_maxTextureSize
= 2048;
25 m_RenderVersionMajor
= 0;
26 m_RenderVersionMinor
= 0;
30 CRenderSystemBase::~CRenderSystemBase() = default;
32 void CRenderSystemBase::GetRenderVersion(unsigned int& major
, unsigned int& minor
) const
34 major
= m_RenderVersionMajor
;
35 minor
= m_RenderVersionMinor
;
38 bool CRenderSystemBase::SupportsNPOT(bool dxt
) const
46 bool CRenderSystemBase::SupportsStereo(RENDER_STEREO_MODE mode
) const
50 case RENDER_STEREO_MODE_OFF
:
51 case RENDER_STEREO_MODE_SPLIT_HORIZONTAL
:
52 case RENDER_STEREO_MODE_SPLIT_VERTICAL
:
53 case RENDER_STEREO_MODE_MONO
:
60 void CRenderSystemBase::ShowSplash(const std::string
& message
)
62 if (!CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_splashImage
&& !(m_splashImage
|| !message
.empty()))
67 m_splashImage
= std::make_unique
<CGUIImage
>(
69 static_cast<float>(CServiceBroker::GetWinSystem()->GetGfxContext().GetWidth()),
70 static_cast<float>(CServiceBroker::GetWinSystem()->GetGfxContext().GetHeight()),
71 CTextureInfo(CUtil::GetSplashPath()));
72 m_splashImage
->SetAspectRatio(CAspectRatio::AR_SCALE
);
75 CServiceBroker::GetWinSystem()->GetGfxContext().lock();
76 CServiceBroker::GetWinSystem()->GetGfxContext().Clear(0xff000000);
78 RESOLUTION_INFO res
= CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo();
79 CServiceBroker::GetWinSystem()->GetGfxContext().SetRenderingResolution(res
, true);
84 m_splashImage
->AllocResources();
85 m_splashImage
->Render();
86 m_splashImage
->FreeResources();
90 if (!m_splashMessageLayout
)
92 auto messageFont
= g_fontManager
.LoadTTF("__splash__", "arial.ttf", 0xFFFFFFFF, 0, 20, FONT_STYLE_NORMAL
, false, 1.0f
, 1.0f
, &res
);
94 m_splashMessageLayout
= std::make_unique
<CGUITextLayout
>(messageFont
, true, .0f
);
97 if (m_splashMessageLayout
)
99 m_splashMessageLayout
->Update(message
, 1150, false, true);
100 float textWidth
, textHeight
;
101 m_splashMessageLayout
->GetTextExtent(textWidth
, textHeight
);
103 int width
= CServiceBroker::GetWinSystem()->GetGfxContext().GetWidth();
104 int height
= CServiceBroker::GetWinSystem()->GetGfxContext().GetHeight();
105 float y
= height
- textHeight
- 100;
106 m_splashMessageLayout
->RenderOutline(width
/2, y
, 0, 0xFF000000, XBFONT_CENTER_X
, width
);
112 CServiceBroker::GetWinSystem()->GetGfxContext().unlock();
113 CServiceBroker::GetWinSystem()->GetGfxContext().Flip(true, false);