From d39bbc23f331bb1d60adb01a0d36989dbccbe116 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Sun, 28 Feb 2016 18:07:40 +1100 Subject: [PATCH 1/2] Reapply 86746aaaf094ece1540d143c8d58c8f9e551e243 This reduces flickering in the editor --- src/editor/map/context_manager.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/editor/map/context_manager.cpp b/src/editor/map/context_manager.cpp index 8c45d27d5e70..f0cfaeae990d 100644 --- a/src/editor/map/context_manager.cpp +++ b/src/editor/map/context_manager.cpp @@ -175,7 +175,8 @@ void context_manager::refresh_all() gui_.rebuild_all(); get_map_context().set_needs_terrain_rebuild(false); gui_.create_buttons(); - gui_.redraw_everything(); + gui_.invalidate_all(); + gui_.draw(false); get_map_context().clear_changed_locations(); gui_.recalculate_minimap(); } From 716ffa524b2071525c19cddd0a2e0a36ff1a1d50 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Sun, 28 Feb 2016 18:08:36 +1100 Subject: [PATCH 2/2] Remove unnecessary calls to CVideo::flip() (and one call to CVideo::delay()) --- src/game_launcher.cpp | 2 -- src/help/help.cpp | 5 ----- src/hotkey/hotkey_preferences_display.cpp | 4 +--- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/game_launcher.cpp b/src/game_launcher.cpp index e0f64e65251c..fb6bf3a3623a 100644 --- a/src/game_launcher.cpp +++ b/src/game_launcher.cpp @@ -1068,8 +1068,6 @@ void game_launcher::show_preferences() { preferences::show_preferences_dialog(video(), game_config_manager::get()->game_config()); - - video().flip(); } void game_launcher::launch_game(RELOAD_GAME_DATA reload) diff --git a/src/help/help.cpp b/src/help/help.cpp index 341f5e11c30b..d01fb2f27b4d 100644 --- a/src/help/help.cpp +++ b/src/help/help.cpp @@ -118,7 +118,6 @@ help_manager::~help_manager() void show_help(CVideo& video, const std::string& show_topic, int xloc, int yloc) { show_help(video, toplevel, show_topic, xloc, yloc); - video.flip(); } /** @@ -130,7 +129,6 @@ void show_unit_help(CVideo& video, const std::string& show_topic, bool has_varia { show_help(video, toplevel, hidden_symbol(hidden) + (has_variations ? ".." : "") + unit_prefix + show_topic, xloc, yloc); - video.flip(); } /** @@ -141,7 +139,6 @@ void show_unit_help(CVideo& video, const std::string& show_topic, bool has_varia void show_terrain_help(CVideo& video, const std::string& show_topic, bool hidden, int xloc, int yloc) { show_help(video, toplevel, hidden_symbol(hidden) + terrain_prefix + show_topic, xloc, yloc); - video.flip(); } @@ -152,7 +149,6 @@ void show_terrain_help(CVideo& video, const std::string& show_topic, bool hidden void show_variation_help(CVideo& video, const std::string& unit, const std::string &variation, bool hidden, int xloc, int yloc) { show_help(video, toplevel, hidden_symbol(hidden) + variation_prefix + unit + "_" + variation, xloc, yloc); - video.flip(); } /** @@ -221,7 +217,6 @@ void show_help(CVideo& video, const section &toplevel_sec, } hb.set_dirty(true); events::raise_draw_event(); - video.flip(); CKey key; for (;;) { events::pump(); diff --git a/src/hotkey/hotkey_preferences_display.cpp b/src/hotkey/hotkey_preferences_display.cpp index 3d99b9a09409..44999779fcfb 100644 --- a/src/hotkey/hotkey_preferences_display.cpp +++ b/src/hotkey/hotkey_preferences_display.cpp @@ -616,14 +616,12 @@ void hotkey_preferences_dialog::show_binding_dialog( #if SDL_VERSION_ATLEAST(2,0,0) events::peek_for_resize(); #endif - video_.flip(); - CVideo::delay(10); + } while (event.type != SDL_KEYUP && event.type != SDL_JOYBUTTONUP && event.type != SDL_JOYHATMOTION && event.type != SDL_MOUSEBUTTONUP); restorer.restore(); - video_.flip(); // only if not cancelled. if (!(keycode == SDLK_ESCAPE && (mod & any_mod) == 0)) {