From b308df8c7eb3b3c767580f08a454a2967405646a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20L=C3=B6f?= Date: Sat, 5 Mar 2016 17:15:40 +1300 Subject: [PATCH] Make sure bigmap isn't overdrawn by in-game UI The storyscreen would trigger a full redraw-cycle partially through displaying bigmap. Due to the implementation of the storyscreen, this would cause it to have the background overdrawn and never updated. The fix implemented here is to remove layered-drawing functionality from the storyscreen and trigger a full redraw manually at the end of the story screen functionality. --- src/storyscreen/controller.cpp | 2 -- src/storyscreen/interface.cpp | 5 ++++- src/storyscreen/render.cpp | 3 ++- src/storyscreen/render.hpp | 2 +- src/video.cpp | 4 ++++ src/video.hpp | 2 +- src/widgets/widget.cpp | 4 ++-- src/widgets/widget.hpp | 2 +- 8 files changed, 15 insertions(+), 9 deletions(-) diff --git a/src/storyscreen/controller.cpp b/src/storyscreen/controller.cpp index 921fe46fa18..420334ae6f4 100644 --- a/src/storyscreen/controller.cpp +++ b/src/storyscreen/controller.cpp @@ -147,8 +147,6 @@ void controller::resolve_wml(const vconfig& cfg) STORY_RESULT controller::show(START_POSITION startpos) { - events::event_context story_context; - if(parts_.empty()) { LOG_NG << "no storyscreen parts to show\n"; return NEXT; diff --git a/src/storyscreen/interface.cpp b/src/storyscreen/interface.cpp index abe0bcd62e9..3e327b3bb03 100644 --- a/src/storyscreen/interface.cpp +++ b/src/storyscreen/interface.cpp @@ -37,6 +37,8 @@ static lg::log_domain log_engine("engine"); void show_story(display &disp, const std::string &scenario_name, const config::const_child_itors &story) { + events::event_context story_context; + int segment_count = 0; config::const_child_iterator itor = story.first; storyscreen::START_POSITION startpos = storyscreen::START_BEGINNING; @@ -62,8 +64,9 @@ void show_story(display &disp, const std::string &scenario_name, } break; case storyscreen::QUIT: - return; + break; } } + video2::trigger_full_redraw(); return; } diff --git a/src/storyscreen/render.cpp b/src/storyscreen/render.cpp index 2a2b3561744..5e842c95787 100644 --- a/src/storyscreen/render.cpp +++ b/src/storyscreen/render.cpp @@ -88,7 +88,7 @@ namespace storyscreen { part_ui::part_ui(part &p, display &disp, gui::button &next_button, gui::button &back_button, gui::button&play_button) - : video2::draw_layering(false) + : events::sdl_handler(false) , p_(p) , disp_(disp) , video_(disp.video()) @@ -382,6 +382,7 @@ bool part_ui::render_floating_images() const floating_image& fi = p_.get_floating_images()[fi_n]; if(!ri.image.null()) { + render_background(); sdl_blit(ri.image, NULL, video_.getSurface(), &ri.rect); update_rect(ri.rect); } diff --git a/src/storyscreen/render.hpp b/src/storyscreen/render.hpp index c40d22ca28c..16f42a01b87 100644 --- a/src/storyscreen/render.hpp +++ b/src/storyscreen/render.hpp @@ -41,7 +41,7 @@ namespace storyscreen { * assumed that the screen dimensions remain constant between the * constructor call, and the destruction of the objects. */ -class part_ui : public video2::draw_layering +class part_ui : public events::sdl_handler { public: /** Storyscreen result. */ diff --git a/src/video.cpp b/src/video.cpp index 2c93ff9e90c..5aec8f50e81 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -263,6 +263,10 @@ draw_layering::~draw_layering() { draw_layers.remove(this); + video2::trigger_full_redraw(); +} + +void trigger_full_redraw() { #if SDL_VERSION_ATLEAST(2, 0, 0) SDL_Event event; event.type = SDL_WINDOWEVENT; diff --git a/src/video.hpp b/src/video.hpp index 1d7f95cf7dd..7cc2fb28c5b 100644 --- a/src/video.hpp +++ b/src/video.hpp @@ -324,6 +324,6 @@ protected: draw_layering(const bool auto_join=true); virtual ~draw_layering(); }; - +void trigger_full_redraw(); } #endif diff --git a/src/widgets/widget.cpp b/src/widgets/widget.cpp index 18eae45cce0..f5cc291f785 100644 --- a/src/widgets/widget.cpp +++ b/src/widgets/widget.cpp @@ -33,7 +33,7 @@ namespace gui { bool widget::mouse_lock_ = false; widget::widget(const widget &o) - : video2::draw_layering(), focus_(o.focus_), video_(o.video_), restorer_(o.restorer_), rect_(o.rect_), + : events::sdl_handler(), focus_(o.focus_), video_(o.video_), restorer_(o.restorer_), rect_(o.rect_), needs_restore_(o.needs_restore_), state_(o.state_), hidden_override_(o.hidden_override_), enabled_(o.enabled_), clip_(o.clip_), clip_rect_(o.clip_rect_), volatile_(o.volatile_), help_text_(o.help_text_), tooltip_text_(o.tooltip_text_), help_string_(o.help_string_), id_(o.id_), mouse_lock_local_(o.mouse_lock_local_) @@ -41,7 +41,7 @@ widget::widget(const widget &o) } widget::widget(CVideo& video, const bool auto_join) - : video2::draw_layering(auto_join), focus_(true), video_(&video), rect_(EmptyRect), needs_restore_(false), + : events::sdl_handler(auto_join), focus_(true), video_(&video), rect_(EmptyRect), needs_restore_(false), state_(UNINIT), hidden_override_(false), enabled_(true), clip_(false), clip_rect_(EmptyRect), volatile_(false), help_string_(0), mouse_lock_local_(false) { diff --git a/src/widgets/widget.hpp b/src/widgets/widget.hpp index faf81c7bf2c..223c19156ba 100644 --- a/src/widgets/widget.hpp +++ b/src/widgets/widget.hpp @@ -23,7 +23,7 @@ class CVideo; namespace gui { -class widget : public video2::draw_layering +class widget : public events::sdl_handler { public: SDL_Rect const &location() const;