aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/surfacesdl
diff options
context:
space:
mode:
authorColin Snover2017-08-27 22:21:05 -0500
committerColin Snover2017-10-07 12:30:29 -0500
commitebe6c40a6abb2789349c2b6471eef24ac270ab94 (patch)
treea54844f3eadc19e0cb168879466da165843d7c9f /backends/graphics/surfacesdl
parent83436e685fe5c0fd05fa49c8e85386a1115dee58 (diff)
downloadscummvm-rg350-ebe6c40a6abb2789349c2b6471eef24ac270ab94.tar.gz
scummvm-rg350-ebe6c40a6abb2789349c2b6471eef24ac270ab94.tar.bz2
scummvm-rg350-ebe6c40a6abb2789349c2b6471eef24ac270ab94.zip
SDL: Do not reset window size when engines update rendering surface
This change allows: * Engines to update their target rendering surface/size and pixel format with the backend multiple times during gameplay; * Users to resize the ScummVM window without having it reset size/position every time an engine updates its target surface format; * Conversions/scaling to continue to run efficiently in hardware, instead of requiring engines to pick their maximum possible output format once and upscale inefficiently in software; * The window to reset size once when an engine calls to set its initial output size, and to reset again once ScummVM returns to the launcher. This is relevant for at least SCI32 and DreamWeb engines, which perform graphics mode switches during games.
Diffstat (limited to 'backends/graphics/surfacesdl')
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 983b71ab28..cd7e11b32d 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -784,9 +784,14 @@ void SurfaceSdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFo
}
#endif
- // Avoid redundant res changes
+#if !SDL_VERSION_ATLEAST(2, 0, 0)
+ // Avoid redundant res changes, only in SDL1. In SDL2, redundancies may not
+ // actually be redundant if ScummVM is switching between game engines and
+ // the screen dimensions are being reinitialized, since window resizing is
+ // supposed to reset when this happens
if ((int)w == _videoMode.screenWidth && (int)h == _videoMode.screenHeight)
return;
+#endif
_videoMode.screenWidth = w;
_videoMode.screenHeight = h;
@@ -2797,7 +2802,7 @@ SDL_Surface *SurfaceSdlGraphicsManager::SDL_SetVideoMode(int width, int height,
createWindowFlags |= SDL_WINDOW_FULLSCREEN_DESKTOP;
}
- if (!_window->createOrUpdateWindow(width, height, createWindowFlags)) {
+ if (!createOrUpdateWindow(width, height, createWindowFlags)) {
return nullptr;
}