Force a full redraw on resize events.

This fixes the worst of the resize-related artefacts during gameplay
by forcing a full redraw on every resize event. These changes will be
revisited as a part of #23934.
This commit is contained in:
Andreas Löf 2015-12-19 11:36:37 +13:00
parent 5c187a5185
commit 3240d4a2ef
3 changed files with 13 additions and 2 deletions

View file

@ -1446,7 +1446,7 @@ void twindow::signal_handler_sdl_video_resize(const event::tevent event,
const tpoint& new_size)
{
DBG_GUI_E << LOG_HEADER << ' ' << event << ".\n";
#if !SDL_VERSION_ATLEAST(2, 0, 0)
if(new_size.x < preferences::min_allowed_width()
|| new_size.y < preferences::min_allowed_height()) {
@ -1461,6 +1461,7 @@ void twindow::signal_handler_sdl_video_resize(const event::tevent event,
handled = true;
return;
}
#endif
if(!preferences::set_resolution(video_, new_size.x, new_size.y)) {

View file

@ -176,11 +176,13 @@ bool set_resolution(CVideo& video
int bpp = video.bppForMode(width, height, flags);
if(bpp != 0) {
video.setMode(width, height, bpp, flags);
//video.setMode(width, height, bpp, flags);
#if !SDL_VERSION_ATLEAST(2, 0, 0)
if(disp) {
disp->redraw_everything();
}
#endif
} else {
// grzywacz: is this even true?

View file

@ -30,6 +30,7 @@
#include "sdl/window.hpp"
#include "video.hpp"
#include "sdl/gpu.hpp"
#include "display.hpp"
#include <boost/foreach.hpp>
@ -47,11 +48,18 @@ namespace {
GPU_Target *render_target_;
}
void resize_monitor::process(events::pump_info &info) {
#if !SDL_VERSION_ATLEAST(2, 0, 0)
if(info.resize_dimensions.first >= preferences::min_allowed_width()
&& info.resize_dimensions.second >= preferences::min_allowed_height()
&& disallow_resize == 0) {
preferences::set_resolution(info.resize_dimensions);
}
#else
if(info.resize_dimensions.first > 0 &&
info.resize_dimensions.second > 0
&& display::get_singleton())
display::get_singleton()->redraw_everything();
#endif
}
resize_lock::resize_lock()