summarylogtreecommitdiffstats
path: root/git-cab509c.patch
blob: a48416598850d87f4048d4f990edb7539e3b9261 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
From cab509c4d20f0e5e57099d24792a853a7adaa326 Mon Sep 17 00:00:00 2001
From: Edoardo Prezioso <edo88@email.it>
Date: Thu, 8 Jan 2015 01:39:29 +0100
Subject: [PATCH] Various improvements to SDL2 video code.

- Ported the missing resolutions from zdoom.
- Remove unneeded code which was removed also from zdoom.
- Uncomment DOUBLEBUFFER GL attribute. It was present in the old SDL_SetVideoMode call code, so why not.
---
 src/posix/sdl/sdlglvideo.cpp | 60 ++++++++++++++++++--------------------------
 src/posix/sdl/sdlglvideo.h   |  1 -
 2 files changed, 25 insertions(+), 36 deletions(-)

diff --git a/src/posix/sdl/sdlglvideo.cpp b/src/posix/sdl/sdlglvideo.cpp
index 9331c0f..54506b8 100644
--- a/src/posix/sdl/sdlglvideo.cpp
+++ b/src/posix/sdl/sdlglvideo.cpp
@@ -77,6 +77,7 @@ static MiniModeInfo WinModes[] =
 	{ 720, 480 },	// 16:10
 	{ 720, 540 },
 	{ 800, 450 },	// 16:9
+	{ 800, 480 },
 	{ 800, 500 },	// 16:10
 	{ 800, 600 },
 	{ 848, 480 },	// 16:9
@@ -91,23 +92,33 @@ static MiniModeInfo WinModes[] =
 	{ 1152, 720 },	// 16:10
 	{ 1152, 864 },
 	{ 1280, 720 },	// 16:9
+	{ 1280, 854 },
 	{ 1280, 800 },	// 16:10
 	{ 1280, 960 },
-	{ 1344, 756 },  // 16:9
+	{ 1280, 1024 },	// 5:4
 	{ 1360, 768 },	// 16:9
+	{ 1366, 768 },
 	{ 1400, 787 },	// 16:9
 	{ 1400, 875 },	// 16:10
-	{ 1440, 900 },
 	{ 1400, 1050 },
+	{ 1440, 900 },
+	{ 1440, 960 },
+	{ 1440, 1080 },
 	{ 1600, 900 },	// 16:9
 	{ 1600, 1000 },	// 16:10
 	{ 1600, 1200 },
-	{ 1680, 1050 }, // 16:10
-	{ 1920, 1080 }, // 16:9
-	{ 1920, 1200 }, // 16:10
-	{ 2054, 1536 },
-	{ 2560, 1440 },  // 16:9
-	{ 2880, 1800 }  // 16:10
+	{ 1920, 1080 },
+	{ 1920, 1200 },
+	{ 2048, 1536 },
+	{ 2560, 1440 },
+	{ 2560, 1600 },
+	{ 2560, 2048 },
+	{ 2880, 1800 },
+	{ 3200, 1800 },
+	{ 3840, 2160 },
+	{ 3840, 2400 },
+	{ 4096, 2160 },
+	{ 5120, 2880 }
 };
 
 // CODE --------------------------------------------------------------------
@@ -115,7 +126,6 @@ static MiniModeInfo WinModes[] =
 SDLGLVideo::SDLGLVideo (int parm)
 {
 	IteratorBits = 0;
-	IteratorFS = false;
     if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) {
         fprintf( stderr, "Video initialization failed: %s\n",
              SDL_GetError( ) );
@@ -135,38 +145,18 @@ void SDLGLVideo::StartModeIterator (int bits, bool fs)
 {
 	IteratorMode = 0;
 	IteratorBits = bits;
-	IteratorFS = fs;
 }
 
 bool SDLGLVideo::NextMode (int *width, int *height, bool *letterbox)
 {
 	if (IteratorBits != 8)
 		return false;
-	
-	if (!IteratorFS)
-	{
-		if ((unsigned)IteratorMode < sizeof(WinModes)/sizeof(WinModes[0]))
-		{
-			*width = WinModes[IteratorMode].Width;
-			*height = WinModes[IteratorMode].Height;
-			++IteratorMode;
-			return true;
-		}
-	}
-	else
-	{
-		SDL_DisplayMode mode = {}, oldmode = {};
-		if(IteratorMode != 0)
-			SDL_GetDisplayMode(vid_adapter, IteratorMode-1, &oldmode);
-		do
-		{
-			if (SDL_GetDisplayMode(vid_adapter, IteratorMode, &mode) != 0)
-				return false;
-			++IteratorMode;
-		} while(mode.w == oldmode.w && mode.h == oldmode.h);
 
-		*width = mode.w;
-		*height = mode.h;
+	if ((unsigned)IteratorMode < sizeof(WinModes)/sizeof(WinModes[0]))
+	{
+		*width = WinModes[IteratorMode].Width;
+		*height = WinModes[IteratorMode].Height;
+		++IteratorMode;
 		return true;
 	}
 	return false;
@@ -294,7 +284,7 @@ bool SDLGLVideo::SetupPixelFormat(bool allowsoftware, int multisample)
 	SDL_GL_SetAttribute( SDL_GL_ALPHA_SIZE,  8 );
 	SDL_GL_SetAttribute( SDL_GL_DEPTH_SIZE,  24 );
 	SDL_GL_SetAttribute( SDL_GL_STENCIL_SIZE,  8 );
-//		SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER,  1 );
+	SDL_GL_SetAttribute( SDL_GL_DOUBLEBUFFER,  1 );
 	if (multisample > 0) {
 		SDL_GL_SetAttribute( SDL_GL_MULTISAMPLEBUFFERS, 1 );
 		SDL_GL_SetAttribute( SDL_GL_MULTISAMPLESAMPLES, multisample );
diff --git a/src/posix/sdl/sdlglvideo.h b/src/posix/sdl/sdlglvideo.h
index 3867be6..c2be3ba 100644
--- a/src/posix/sdl/sdlglvideo.h
+++ b/src/posix/sdl/sdlglvideo.h
@@ -32,7 +32,6 @@ class SDLGLVideo : public IVideo
 private:
 	int IteratorMode;
 	int IteratorBits;
-	bool IteratorFS;
 };
 class SDLGLFB : public DFrameBuffer
 {
-- 
2.3.2