aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--backends/sdl/graphics.cpp14
-rw-r--r--backends/sdl/sdl-common.h1
2 files changed, 15 insertions, 0 deletions
diff --git a/backends/sdl/graphics.cpp b/backends/sdl/graphics.cpp
index 23b84460c6..f97e489e64 100644
--- a/backends/sdl/graphics.cpp
+++ b/backends/sdl/graphics.cpp
@@ -73,9 +73,21 @@ void OSystem_SDL::beginGFXTransaction(void) {
_transactionDetails.needHotswap = false;
_transactionDetails.needUpdatescreen = false;
_transactionDetails.needUnload = false;
+
+ _transactionDetails.normal1xScaler = false;
}
void OSystem_SDL::endGFXTransaction(void) {
+ // for each engine we run initCommonGFX() as first thing in the transaction
+ // and initSize() is called later. If user runs launcher at 320x200 with
+ // 2x overlay, setting to Nomral1x sclaler in that case will be suppressed
+ // and backend is forced to 2x
+ //
+ // This leads to bad results such as 1280x960 window for 640x480 engines.
+ // To prevent that we rerun setGraphicsMode() if there was 1x scaler request
+ if (_transactionDetails.normal1xScaler)
+ setGraphicsMode(GFX_NORMAL);
+
assert (_transactionMode == kTransactionActive);
_transactionMode = kTransactionCommit;
@@ -169,6 +181,8 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
return false;
}
+ _transactionDetails.normal1xScaler = (mode == GFX_NORMAL);
+
// Do not let switch to lesser than overlay size resolutions
if (_screenWidth * newScaleFactor < _overlayWidth) {
if (_scaleFactor == 1) { // Force 2x mode
diff --git a/backends/sdl/sdl-common.h b/backends/sdl/sdl-common.h
index 51bde1c457..57e7625b93 100644
--- a/backends/sdl/sdl-common.h
+++ b/backends/sdl/sdl-common.h
@@ -237,6 +237,7 @@ protected:
bool needUpdatescreen;
bool needUnload;
bool needToggle;
+ bool normal1xScaler;
};
TransactionDetails _transactionDetails;