[videodb] remove unused seasons table from episode_view
[xbmc.git] / xbmc / rendering / RenderSystem.cpp
blob3baa8fecaa73347998d8b7661447f298ea03fe90
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 #include <memory>
20 CRenderSystemBase::CRenderSystemBase()
22 m_bRenderCreated = false;
23 m_bVSync = true;
24 m_maxTextureSize = 2048;
25 m_RenderVersionMajor = 0;
26 m_RenderVersionMinor = 0;
27 m_minDXTPitch = 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
40 if (dxt)
41 return false;
43 return true;
46 bool CRenderSystemBase::SupportsStereo(RENDER_STEREO_MODE mode) const
48 switch(mode)
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:
54 return true;
55 default:
56 return false;
60 void CRenderSystemBase::ShowSplash(const std::string& message)
62 if (!CServiceBroker::GetSettingsComponent()->GetAdvancedSettings()->m_splashImage && !(m_splashImage || !message.empty()))
63 return;
65 if (!m_splashImage)
67 m_splashImage = std::make_unique<CGUIImage>(
68 0, 0, .0f, .0f,
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);
81 //render splash image
82 BeginRender();
84 m_splashImage->AllocResources();
85 m_splashImage->Render();
86 m_splashImage->FreeResources();
88 if (!message.empty())
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);
93 if (messageFont)
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);
110 //show it on screen
111 EndRender();
112 CServiceBroker::GetWinSystem()->GetGfxContext().unlock();
113 CServiceBroker::GetWinSystem()->GetGfxContext().Flip(true, false);