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.
14 typedef int DisplayMode
;
15 #define DM_WINDOWED -1
16 #define DM_FULLSCREEN 0
22 RES_DESKTOP
= 16, // Desktop resolution
23 RES_CUSTOM
= 16 + 1, // First additional resolution
35 left
= top
= right
= bottom
= 0;
37 OVERSCAN(const OVERSCAN
& os
)
39 left
= os
.left
; top
= os
.top
;
40 right
= os
.right
; bottom
= os
.bottom
;
42 OVERSCAN
& operator=(const OVERSCAN
&) = default;
44 bool operator==(const OVERSCAN
& other
)
46 return left
== other
.left
&& right
== other
.right
&& top
== other
.top
&& bottom
== other
.bottom
;
48 bool operator!=(const OVERSCAN
& other
)
50 return left
!= other
.left
|| right
!= other
.right
|| top
!= other
.top
|| bottom
!= other
.bottom
;
61 EdgeInsets() = default;
62 EdgeInsets(float l
, float t
, float r
, float b
);
65 //! @brief Provide info of a resolution
66 struct RESOLUTION_INFO
68 //!< Screen overscan boundary
71 //!< Edge insets to scale the GUI to prevent the display notch from hiding a part of the GUI
74 //!< Specify if it is a fullscreen resolution, otherwise windowed
77 //!< Width GUI resolution (pixels), may differ from the screen value if GUI resolution limit, 3D is set or in HiDPI screens
80 //!< Height GUI resolution (pixels), may differ from the screen value if GUI resolution limit, 3D is set or in HiDPI screens
83 //!< Number of pixels of padding between stereoscopic frames
86 //!< Screen width (logical width in pixels)
89 //!< Screen height (logical height in pixels)
92 //!< The vertical subtitle baseline position, may be changed by Video calibration
95 //!< Properties of the resolution e.g. interlaced mode
98 //!< Pixel aspect ratio
104 //!< Resolution mode description
107 //!< Resolution output description
108 std::string strOutput
;
114 RESOLUTION_INFO(int width
= 1280, int height
= 720, float aspect
= 0, const std::string
&mode
= "");
115 float DisplayRatio() const;
116 RESOLUTION_INFO(const RESOLUTION_INFO
& res
);
117 RESOLUTION_INFO
& operator=(const RESOLUTION_INFO
&) = default;
120 class CResolutionUtils
123 static RESOLUTION
ChooseBestResolution(float fps
, int width
, int height
, bool is3D
);
124 static bool HasWhitelist();
125 static void PrintWhitelist();
128 * \brief Get the max allowed screen resolution, if fullscreen
129 * \param width [OUT] Max width resolution
130 * \param height [OUT] Max height resolution
132 static void GetMaxAllowedScreenResolution(unsigned int& width
, unsigned int& height
);
135 static void FindResolutionFromWhitelist(float fps
, int width
, int height
, bool is3D
, RESOLUTION
&resolution
);
136 static bool FindResolutionFromOverride(float fps
, int width
, bool is3D
, RESOLUTION
&resolution
, float& weight
, bool fallback
);
137 static float RefreshWeight(float refresh
, float fps
);