[cosmetics] update date in GPL header
[vuplus_xbmc] / xbmc / guilib / Resolution.h
1 /*
2 *      Copyright (C) 2005-2013 Team XBMC
3 *      http://www.xbmc.org
4 *
5 *  This Program is free software; you can redistribute it and/or modify
6 *  it under the terms of the GNU General Public License as published by
7 *  the Free Software Foundation; either version 2, or (at your option)
8 *  any later version.
9 *
10 *  This Program is distributed in the hope that it will be useful,
11 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 *  GNU General Public License for more details.
14 *
15 *  You should have received a copy of the GNU General Public License
16 *  along with XBMC; see the file COPYING.  If not, see
17 *  <http://www.gnu.org/licenses/>.
18 *
19 */
20
21 #pragma once
22
23 #include <stdint.h>
24 #include "utils/StdString.h"
25
26 typedef int DisplayMode;
27 #define DM_WINDOWED     -1
28 #define DM_FULLSCREEN1   0
29 #define DM_FULLSCREEN2   1
30 // DM_FULLSCREEN3        2
31 // etc.
32
33 enum RESOLUTION {
34   RES_INVALID        = -1,
35   RES_HDTV_1080i     =  0,
36   RES_HDTV_720pSBS   =  1,
37   RES_HDTV_720pTB    =  2,
38   RES_HDTV_1080pSBS  =  3,
39   RES_HDTV_1080pTB   =  4,
40   RES_HDTV_720p      =  5,
41   RES_HDTV_480p_4x3  =  6,
42   RES_HDTV_480p_16x9 =  7,
43   RES_NTSC_4x3       =  8,
44   RES_NTSC_16x9      =  9,
45   RES_PAL_4x3        = 10,
46   RES_PAL_16x9       = 11,
47   RES_PAL60_4x3      = 12,
48   RES_PAL60_16x9     = 13,
49   RES_AUTORES        = 14,
50   RES_WINDOW         = 15,
51   RES_DESKTOP        = 16,          // Desktop resolution for primary screen
52   RES_CUSTOM         = 16 + 1,      // Desktop resolution for screen #2
53 //                     ...
54 //                     12 + N - 1   // Desktop resolution for screen N
55 //                     12 + N       // First additional resolution, in a N screen configuration.
56 //                     12 + N + ... // Other resolutions, in any order
57 };
58
59 enum VSYNC {
60   VSYNC_DISABLED     =  0,
61   VSYNC_VIDEO        =  1,
62   VSYNC_ALWAYS       =  2,
63   VSYNC_DRIVER       =  3
64 };
65
66 struct OVERSCAN
67 {
68   int left;
69   int top;
70   int right;
71   int bottom;
72 public:
73   OVERSCAN()
74   {
75     left = top = right = bottom = 0;
76   }
77   OVERSCAN(const OVERSCAN& os)
78   {
79     left = os.left; top = os.top;
80     right = os.right; bottom = os.bottom;
81   }
82 };
83
84 struct RESOLUTION_INFO
85 {
86   OVERSCAN Overscan;
87   bool bFullScreen;
88   int iScreen;
89   int iWidth;
90   int iHeight;
91   int iScreenWidth;
92   int iScreenHeight;
93   int iSubtitles;
94   uint32_t dwFlags;
95   float fPixelRatio;
96   float fRefreshRate;
97   CStdString strMode;
98   CStdString strOutput;
99   CStdString strId;
100 public:
101   RESOLUTION_INFO(int width = 1280, int height = 720, float aspect = 0, const CStdString &mode = "")
102   {
103     iWidth = width;
104     iHeight = height;
105     iScreenWidth = width;
106     iScreenHeight = height;
107     fPixelRatio = aspect ? ((float)width)/height / aspect : 1.0f;
108     strMode = mode;
109     bFullScreen = true;
110     fRefreshRate = 0;
111     dwFlags = iSubtitles = iScreen = 0;
112   }
113   float DisplayRatio() const
114   {
115     return iWidth * fPixelRatio / iHeight;
116   }
117   RESOLUTION_INFO(const RESOLUTION_INFO& res)
118   {
119     Overscan = res.Overscan; bFullScreen = res.bFullScreen;
120     iScreen = res.iScreen; iWidth = res.iWidth; iHeight = res.iHeight;
121     iScreenWidth = res.iScreenWidth; iScreenHeight = res.iScreenHeight;
122     iSubtitles = res.iSubtitles; dwFlags = res.dwFlags;
123     fPixelRatio = res.fPixelRatio; fRefreshRate = res.fRefreshRate;
124     strMode = res.strMode; strOutput = res.strOutput; strId = res.strId;
125   }
126 };