[PVR][Estuary] Timer settings dialog: Show client name in timer type selection dialog...
[xbmc.git] / xbmc / rendering / RenderSystem.cpp
blob3f10562e7b57a1a9bebd0b263dace4de8df0a8ca
1 /*
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.
7 */
9 #include "RenderSystem.h"
11 #include "Util.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"
18 CRenderSystemBase::CRenderSystemBase()
20 m_bRenderCreated = false;
21 m_bVSync = true;
22 m_maxTextureSize = 2048;
23 m_RenderVersionMajor = 0;
24 m_RenderVersionMinor = 0;
25 m_minDXTPitch = 0;
28 CRenderSystemBase::~CRenderSystemBase() = default;
30 void CRenderSystemBase::GetRenderVersion(unsigned int& major, unsigned int& minor) const
32 major = m_RenderVersionMajor;
33 minor = m_RenderVersionMinor;
36 bool CRenderSystemBase::SupportsNPOT(bool dxt) const
38 if (dxt)
39 return false;
41 return true;
44 bool CRenderSystemBase::SupportsStereo(RENDER_STEREO_MODE mode) const
46 switch(mode)
48 case RENDER_STEREO_MODE_OFF:
49 case RENDER_STEREO_MODE_SPLIT_HORIZONTAL:
50 case RENDER_STEREO_MODE_SPLIT_VERTICAL:
51 case RENDER_STEREO_MODE_MONO:
52 return true;
53 default:
54 return false;
58 void CRenderSystemBase::ShowSplash(const std::string& message)
60 if (!CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_splashImage && !(m_splashImage || !message.empty()))
61 return;
63 if (!m_splashImage)
65 m_splashImage = std::unique_ptr<CGUIImage>(new CGUIImage(0, 0, 0, 0, CServiceBroker::GetWinSystem()->GetGfxContext().GetWidth(),
66 CServiceBroker::GetWinSystem()->GetGfxContext().GetHeight(), CTextureInfo(CUtil::GetSplashPath())));
67 m_splashImage->SetAspectRatio(CAspectRatio::AR_SCALE);
70 CServiceBroker::GetWinSystem()->GetGfxContext().lock();
71 CServiceBroker::GetWinSystem()->GetGfxContext().Clear();
73 RESOLUTION_INFO res = CServiceBroker::GetWinSystem()->GetGfxContext().GetResInfo();
74 CServiceBroker::GetWinSystem()->GetGfxContext().SetRenderingResolution(res, true);
76 //render splash image
77 BeginRender();
79 m_splashImage->AllocResources();
80 m_splashImage->Render();
81 m_splashImage->FreeResources();
83 if (!message.empty())
85 if (!m_splashMessageLayout)
87 auto messageFont = g_fontManager.LoadTTF("__splash__", "arial.ttf", 0xFFFFFFFF, 0, 20, FONT_STYLE_NORMAL, false, 1.0f, 1.0f, &res);
88 if (messageFont)
89 m_splashMessageLayout = std::unique_ptr<CGUITextLayout>(new CGUITextLayout(messageFont, true, 0));
92 if (m_splashMessageLayout)
94 m_splashMessageLayout->Update(message, 1150, false, true);
95 float textWidth, textHeight;
96 m_splashMessageLayout->GetTextExtent(textWidth, textHeight);
98 int width = CServiceBroker::GetWinSystem()->GetGfxContext().GetWidth();
99 int height = CServiceBroker::GetWinSystem()->GetGfxContext().GetHeight();
100 float y = height - textHeight - 100;
101 m_splashMessageLayout->RenderOutline(width/2, y, 0, 0xFF000000, XBFONT_CENTER_X, width);
105 //show it on screen
106 EndRender();
107 CServiceBroker::GetWinSystem()->GetGfxContext().unlock();
108 CServiceBroker::GetWinSystem()->GetGfxContext().Flip(true, false);