From 16e3c549a06c2b10c07010c141b56c8234620b9a Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Sun, 21 Mar 2021 11:18:15 +0100 Subject: [PATCH] in SDL1, don't reopen the window needlessly --- basegraph.cpp | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/basegraph.cpp b/basegraph.cpp index a10c5dbf..44bef54f 100644 --- a/basegraph.cpp +++ b/basegraph.cpp @@ -1128,11 +1128,7 @@ EX bool want_vsync() { return vid.want_vsync; } -EX bool need_to_apply_screen_settings() { - if(vid.want_fullscreen != vid.full) - return true; - if(make_pair(vid.xres, vid.yres) != get_requested_resolution()) - return true; +EX bool need_to_reopen_window() { if(vid.want_antialias != vid.antialias) return true; if(vid.wantGL != vid.usingGL) @@ -1142,6 +1138,16 @@ EX bool need_to_apply_screen_settings() { return false; } +EX bool need_to_apply_screen_settings() { + if(need_to_reopen_window()) + return true; + if(vid.want_fullscreen != vid.full) + return true; + if(make_pair(vid.xres, vid.yres) != get_requested_resolution()) + return true; + return false; + } + EX void close_renderer() { #if CAP_SDL2 if(s_renderer) SDL_DestroyRenderer(s_renderer), s_renderer = nullptr; @@ -1173,7 +1179,8 @@ EX void apply_screen_settings() { #endif #if !CAP_SDL2 - SDL_QuitSubSystem(SDL_INIT_VIDEO); + if(need_to_reopen_window()) + SDL_QuitSubSystem(SDL_INIT_VIDEO); #endif graphics_on = false;