1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
|
/*
* Copyright (C) 2005-2018 Team Kodi
* This file is part of Kodi - https://kodi.tv
*
* SPDX-License-Identifier: GPL-2.0-or-later
* See LICENSES/README.md for more information.
*/
#include "RenderSystem.h"
#include "Util.h"
#include "guilib/GUIFontManager.h"
#include "guilib/GUIImage.h"
#include "guilib/GUILabelControl.h"
#include "settings/AdvancedSettings.h"
#include "settings/SettingsComponent.h"
CRenderSystemBase::CRenderSystemBase()
{
m_bRenderCreated = false;
m_bVSync = true;
m_maxTextureSize = 2048;
m_RenderVersionMajor = 0;
m_RenderVersionMinor = 0;
m_minDXTPitch = 0;
}
CRenderSystemBase::~CRenderSystemBase() = default;
void CRenderSystemBase::GetRenderVersion(unsigned int& major, unsigned int& minor) const
{
major = m_RenderVersionMajor;
minor = m_RenderVersionMinor;
}
bool CRenderSystemBase::SupportsNPOT(bool dxt) const
{
if (dxt)
return false;
return true;
}
bool CRenderSystemBase::SupportsStereo(RENDER_STEREO_MODE mode) const
{
switch(mode)
{
case RENDER_STEREO_MODE_OFF:
case RENDER_STEREO_MODE_SPLIT_HORIZONTAL:
case RENDER_STEREO_MODE_SPLIT_VERTICAL:
case RENDER_STEREO_MODE_MONO:
return true;
default:
return false;
}
}
void CRenderSystemBase::ShowSplash(const std::string& message)
{
if (!CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_splashImage && !(m_splashImage || !message.empty()))
return;
if (!m_splashImage)
{
m_splashImage = std::unique_ptr<CGUIImage>(new CGUIImage(0, 0, 0, 0, CServiceBroker::GetWinSystem()->GetGfxContext().GetWidth(),
CServiceBroker::GetWinSystem()->GetGfxContext().GetHeight(), CTextureInfo(CUtil::GetSplashPath())));
m_splashImage->SetAspectRatio(CAspectRatio::AR_SCALE);
}
CServiceBroker::GetWinSystem()->GetGfxContext().lock();
CServiceBroker::GetWinSystem()->GetGfxContext().Clear();
RESOLUTION_INFO res = CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo();
CServiceBroker::GetWinSystem()->GetGfxContext().SetRenderingResolution(res, true);
//render splash image
BeginRender();
m_splashImage->AllocResources();
m_splashImage->Render();
m_splashImage->FreeResources();
if (!message.empty())
{
if (!m_splashMessageLayout)
{
auto messageFont = g_fontManager.LoadTTF("__splash__", "arial.ttf", 0xFFFFFFFF, 0, 20, FONT_STYLE_NORMAL, false, 1.0f, 1.0f, &res);
if (messageFont)
m_splashMessageLayout = std::unique_ptr<CGUITextLayout>(new CGUITextLayout(messageFont, true, 0));
}
if (m_splashMessageLayout)
{
m_splashMessageLayout->Update(message, 1150, false, true);
float textWidth, textHeight;
m_splashMessageLayout->GetTextExtent(textWidth, textHeight);
int width = CServiceBroker::GetWinSystem()->GetGfxContext().GetWidth();
int height = CServiceBroker::GetWinSystem()->GetGfxContext().GetHeight();
float y = height - textHeight - 100;
m_splashMessageLayout->RenderOutline(width/2, y, 0, 0xFF000000, XBFONT_CENTER_X, width);
}
}
//show it on screen
EndRender();
CServiceBroker::GetWinSystem()->GetGfxContext().unlock();
CServiceBroker::GetWinSystem()->GetGfxContext().Flip(true, false);
}
|