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.
This commit is contained in:
Andreas Löf 2016-03-05 17:15:40 +13:00
parent 08715b4229
commit b308df8c7e
8 changed files with 15 additions and 9 deletions

View file

@ -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;

View file

@ -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;
}

View file

@ -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);
}

View file

@ -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. */

View file

@ -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;

View file

@ -324,6 +324,6 @@ protected:
draw_layering(const bool auto_join=true);
virtual ~draw_layering();
};
void trigger_full_redraw();
}
#endif

View file

@ -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)
{

View file

@ -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;