summaryrefslogtreecommitdiff
path: root/src/video/sdl2_v.cpp
diff options
context:
space:
mode:
authorPatric Stout <truebrain@openttd.org>2021-02-11 11:19:05 +0100
committerPatric Stout <github@truebrain.nl>2021-02-11 20:23:53 +0100
commit2e1535389ac97c28ff2a4ea4fc82d057ba98aeed (patch)
treefb01ebf1b934190166a363f8a606c247cbefba24 /src/video/sdl2_v.cpp
parent2bbef6b5cf86dac53461e10c5720a05c579304d3 (diff)
downloadopenttd-2e1535389ac97c28ff2a4ea4fc82d057ba98aeed.tar.xz
Codechange: [SDL2] Don't use globals if we can do with locals
Diffstat (limited to 'src/video/sdl2_v.cpp')
-rw-r--r--src/video/sdl2_v.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/video/sdl2_v.cpp b/src/video/sdl2_v.cpp
index 798f40a59..49e8b4207 100644
--- a/src/video/sdl2_v.cpp
+++ b/src/video/sdl2_v.cpp
@@ -58,10 +58,6 @@ static bool _cursor_new_in_window = false;
static SDL_Rect _dirty_rects[MAX_DIRTY_RECTS];
static int _num_dirty_rects;
-/* Size of window */
-static int _window_size_w;
-static int _window_size_h;
-
void VideoDriver_SDL::MakeDirty(int left, int top, int width, int height)
{
if (_num_dirty_rects < MAX_DIRTY_RECTS) {
@@ -929,9 +925,11 @@ bool VideoDriver_SDL::ToggleFullscreen(bool fullscreen)
std::unique_lock<std::recursive_mutex> lock;
if (_draw_mutex != nullptr) lock = std::unique_lock<std::recursive_mutex>(*_draw_mutex);
+ int w, h;
+
/* Remember current window size */
if (fullscreen) {
- SDL_GetWindowSize(_sdl_window, &_window_size_w, &_window_size_h);
+ SDL_GetWindowSize(_sdl_window, &w, &h);
/* Find fullscreen window size */
SDL_DisplayMode dm;
@@ -947,7 +945,7 @@ bool VideoDriver_SDL::ToggleFullscreen(bool fullscreen)
if (ret == 0) {
/* Switching resolution succeeded, set fullscreen value of window. */
_fullscreen = fullscreen;
- if (!fullscreen) SDL_SetWindowSize(_sdl_window, _window_size_w, _window_size_h);
+ if (!fullscreen) SDL_SetWindowSize(_sdl_window, w, h);
} else {
DEBUG(driver, 0, "SDL_SetWindowFullscreen() failed: %s", SDL_GetError());
}