xbmc
RenderContext.h
1 /*
2  * Copyright (C) 2017-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 #pragma once
10 
11 #include "games/GameTypes.h"
12 #include "utils/ColorUtils.h"
13 #include "utils/Geometry.h"
14 #include "windowing/Resolution.h"
15 
16 class CCriticalSection;
17 class CDisplaySettings;
18 class CGameSettings;
19 class CGraphicContext;
20 class CGUIComponent;
21 class CGUIShaderDX;
22 class CMediaSettings;
23 class CRenderSystemBase;
24 class CWinSystemBase;
25 class TransformMatrix;
26 
27 enum class GL_SHADER_METHOD
28 {
29  DEFAULT,
30  TEXTURE,
31  TEXTURE_NOALPHA,
32 };
33 
34 namespace KODI
35 {
36 namespace GAME
37 {
38 class CGameServices;
39 }
40 
41 namespace RETRO
42 {
44 {
45 public:
47  CWinSystemBase* windowing,
48  CGraphicContext& graphicsContext,
49  CDisplaySettings& displaySettings,
50  CMediaSettings& mediaSettings,
51  GAME::CGameServices& gameServices,
52  CGUIComponent* guiComponent);
53 
54  CRenderSystemBase* Rendering() { return m_rendering; }
55  CWinSystemBase* Windowing() { return m_windowing; }
56  CGraphicContext& GraphicsContext() { return m_graphicsContext; }
57  CGUIComponent* GUI() { return m_guiComponent; }
58 
59  // Rendering functions
60  void SetViewPort(const CRect& viewPort);
61  void GetViewPort(CRect& viewPort);
62  void SetScissors(const CRect& rect);
63  void ApplyStateBlock();
64  bool IsExtSupported(const char* extension);
65 
66  // OpenGL(ES) rendering functions
67  void EnableGUIShader(GL_SHADER_METHOD method);
68  void DisableGUIShader();
69  int GUIShaderGetPos();
70  int GUIShaderGetCoord0();
71  int GUIShaderGetUniCol();
72 
73  // DirectX rendering functions
74  CGUIShaderDX* GetGUIShader();
75 
76  // Windowing functions
77  bool UseLimitedColor();
78  bool DisplayHardwareScalingEnabled();
79  void UpdateDisplayHardwareScaling(const RESOLUTION_INFO& resInfo);
80 
81  // Graphics functions
82  int GetScreenWidth();
83  int GetScreenHeight();
84  const CRect& GetScissors();
85  CRect GetViewWindow();
86  void SetViewWindow(float left, float top, float right, float bottom);
87  void SetFullScreenVideo(bool bOnOff);
88  bool IsFullScreenVideo();
89  bool IsCalibrating();
90  RESOLUTION GetVideoResolution();
91  void Clear(UTILS::COLOR::Color color);
92  RESOLUTION_INFO GetResInfo();
93  void SetRenderingResolution(const RESOLUTION_INFO& res, bool needsScaling);
94  UTILS::COLOR::Color MergeAlpha(UTILS::COLOR::Color color);
95  void SetTransform(const TransformMatrix& matrix, float scaleX, float scaleY);
96  void RemoveTransform();
97  CRect StereoCorrection(const CRect& rect);
98  CCriticalSection& GraphicsMutex();
99 
100  // Display settings
101  RESOLUTION_INFO& GetResolutionInfo(RESOLUTION resolution);
102 
103  // Media settings
104  ::CGameSettings& GetGameSettings();
105  ::CGameSettings& GetDefaultGameSettings();
106 
107  // Agent functions
108  void StartAgentManager(GAME::GameClientPtr gameClient);
109  void StopAgentManager();
110 
111 private:
112  // Construction parameters
113  CRenderSystemBase* const m_rendering;
114  CWinSystemBase* const m_windowing;
115  CGraphicContext& m_graphicsContext;
116  CDisplaySettings& m_displaySettings;
117  CMediaSettings& m_mediaSettings;
118  GAME::CGameServices& m_gameServices;
119  CGUIComponent* const m_guiComponent;
120 };
121 } // namespace RETRO
122 } // namespace KODI
Definition: WinSystem.h:44
Definition: DisplaySettings.h:26
Definition: GameSettings.h:16
Definition: GameServices.h:37
Definition: RenderSystem.h:27
Definition: MediaSettings.h:36
Provide info of a resolution.
Definition: Resolution.h:66
Definition: TransformMatrix.h:25
Controller configuration window.
Definition: AudioDecoder.h:18
Definition: RenderContext.h:43
Definition: GUIShaderDX.h:36
Definition: GUIComponent.h:22
Definition: GraphicContext.h:60