diff --git a/src/display.cpp b/src/display.cpp index 10a47888866..532162d77dc 100644 --- a/src/display.cpp +++ b/src/display.cpp @@ -2603,7 +2603,7 @@ bool display::expose(const SDL_Rect& region) draw::fill(map_outside_area().intersect(region), fade_color_); } - LOG_DP << "display::expose " << region; + DBG_DP << "display::expose " << region; return true; // TODO: draw_manager - maybe don't flip yeah? } @@ -2630,17 +2630,25 @@ void display::update_render_textures() // Check that the front buffer size is correct. // Buffers are always resized together, so we only need to check one. point size = front_.get_raw_size(); - if (size.x == oarea.w && size.y == oarea.h) { + point dsize = front_.draw_size(); + bool raw_size_changed = size.x != oarea.w || size.y != oarea.h; + bool draw_size_changed = dsize.x != darea.w || dsize.y != darea.h; + if (!raw_size_changed && !draw_size_changed) { // buffers are fine return; } - // For now, just clobber and regenerate both textures. - LOG_DP << "updating display render buffers to " << oarea; - front_ = texture(oarea.w, oarea.h, SDL_TEXTUREACCESS_TARGET); - front_.set_draw_size(darea.w, darea.h); - back_ = texture(oarea.w, oarea.h, SDL_TEXTUREACCESS_TARGET); - back_.set_draw_size(darea.w, darea.h); + // TODO: draw_manager - these need to account for the logical offset + if(raw_size_changed) { + LOG_DP << "regenerating render buffers as " << oarea; + front_ = texture(oarea.w, oarea.h, SDL_TEXTUREACCESS_TARGET); + back_ = texture(oarea.w, oarea.h, SDL_TEXTUREACCESS_TARGET); + } + if(raw_size_changed || draw_size_changed) { + LOG_DP << "updating render buffer draw size to " << darea; + front_.set_draw_size(darea.w, darea.h); + back_.set_draw_size(darea.w, darea.h); + } // Fill entire texture with black, just in case for(int i = 0; i < 2; ++i) { diff --git a/src/gui/dialogs/preferences_dialog.cpp b/src/gui/dialogs/preferences_dialog.cpp index 377d22bee54..dc91a30d41b 100644 --- a/src/gui/dialogs/preferences_dialog.cpp +++ b/src/gui/dialogs/preferences_dialog.cpp @@ -18,6 +18,7 @@ #include "gui/dialogs/preferences_dialog.hpp" +#include "display.hpp" #include "events.hpp" #include "filesystem.hpp" #include "formatter.hpp" @@ -326,6 +327,11 @@ void preferences_dialog::apply_pixel_scale() // Update draw buffers, taking these into account. video::update_buffers(); + // Update game display, if active + if(::display* disp = display::get_singleton()) { + disp->queue_rerender(); + } + // Raise a window resize event so we can react to the change events::raise_resize_event(); } diff --git a/src/video.cpp b/src/video.cpp index 20fd7182d43..61411e1edf9 100644 --- a/src/video.cpp +++ b/src/video.cpp @@ -775,7 +775,7 @@ bool set_resolution(const point& resolution) void update_buffers(bool autoupdate) { - LOG_DP << "updating buffers"; + LOG_DP << "updating video buffers"; if(update_framebuffer() && autoupdate) { draw_manager::invalidate_all(); }