diff options
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.cpp | 20 | ||||
-rw-r--r-- | backends/graphics/opengl/opengl-graphics.h | 7 | ||||
-rw-r--r-- | backends/graphics/openglsdl/openglsdl-graphics.cpp | 4 |
3 files changed, 24 insertions, 7 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp index 600f280bc8..02e54ac8e4 100644 --- a/backends/graphics/opengl/opengl-graphics.cpp +++ b/backends/graphics/opengl/opengl-graphics.cpp @@ -75,6 +75,10 @@ OpenGLGraphicsManager::OpenGLGraphicsManager() _desiredAspectRatio = kAspectRatio16_9; else if (!scumm_stricmp(desiredAspectRatio.c_str(), "16/10")) _desiredAspectRatio = kAspectRatio16_10; + else if (!scumm_stricmp(desiredAspectRatio.c_str(), "5/3")) + _desiredAspectRatio = kAspectRatio5_3; + else if (!scumm_stricmp(desiredAspectRatio.c_str(), "5/4")) + _desiredAspectRatio = kAspectRatio5_4; #endif } @@ -1187,7 +1191,7 @@ void OpenGLGraphicsManager::setAspectRatioCorrection(int ratio) { if (ratio == -1) // If -1, switch to next mode #ifdef USE_ALL_ASR - _videoMode.aspectRatioCorrection = (_videoMode.aspectRatioCorrection + 1) % 5; + _videoMode.aspectRatioCorrection = (_videoMode.aspectRatioCorrection + 1) % 7; #else if (_videoMode.aspectRatioCorrection == kAspectRatioNone) _videoMode.aspectRatioCorrection = kAspectRatioConserve; @@ -1214,8 +1218,13 @@ Common::String OpenGLGraphicsManager::getAspectRatioName() { return "16/9"; case kAspectRatio16_10: return "16/10"; + case kAspectRatio5_3: + return "5/3"; + case kAspectRatio5_4: + return "5/4"; + default: + return ""; } - return ""; } uint OpenGLGraphicsManager::getAspectRatio() { @@ -1228,6 +1237,10 @@ uint OpenGLGraphicsManager::getAspectRatio() { return 17777; case kAspectRatio16_10: return 16000; + case kAspectRatio5_3: + return 16666; + case kAspectRatio5_4: + return 12500; default: return _videoMode.hardwareWidth * 10000 / _videoMode.hardwareHeight; } @@ -1297,7 +1310,7 @@ bool OpenGLGraphicsManager::saveScreenshot(const char *filename) { int width = _videoMode.hardwareWidth; int height = _videoMode.hardwareHeight; - // Allocate space for screenshot + // Allocate memory for screenshot uint8 *pixels = new uint8[width * height * 3]; // Get pixel data from OpenGL buffer @@ -1336,6 +1349,7 @@ bool OpenGLGraphicsManager::saveScreenshot(const char *filename) { // Write pixel data to BMP out.write(pixels, width * height * 3); + // Free allocated memory delete[] pixels; return true; diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h index a3d3483c74..2b0eff7394 100644 --- a/backends/graphics/opengl/opengl-graphics.h +++ b/backends/graphics/opengl/opengl-graphics.h @@ -33,7 +33,8 @@ // Uncomment this to enable the 'on screen display' code. #define USE_OSD 1 -// Uncomment this to enable all aspect ratio corrections (Will include 16/9 and 16/10) +// Uncomment this to enable all aspect ratio corrections +// (Will include 4/3, 16/9, 16/10, 5/3, 5/4) //#define USE_ALL_ASR 1 namespace OpenGL { @@ -149,7 +150,9 @@ protected: kAspectRatioConserve, kAspectRatio4_3, kAspectRatio16_9, - kAspectRatio16_10 + kAspectRatio16_10, + kAspectRatio5_3, + kAspectRatio5_4 }; struct VideoState { diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp index dddf73f3f8..2cfdffa5ac 100644 --- a/backends/graphics/openglsdl/openglsdl-graphics.cpp +++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp @@ -333,9 +333,9 @@ bool OpenGLSdlGraphicsManager::loadGFXMode() { // Do not downscale dimensions, only enlarge them if needed if (screenAspectRatio > desiredAspectRatio) - _videoMode.hardwareHeight = _videoMode.overlayWidth * 10000 / desiredAspectRatio; + _videoMode.hardwareHeight = (_videoMode.overlayWidth * 10000 + 5000) / desiredAspectRatio; else if (screenAspectRatio < desiredAspectRatio) - _videoMode.hardwareWidth = _videoMode.overlayHeight * desiredAspectRatio / 10000; + _videoMode.hardwareWidth = (_videoMode.overlayHeight * desiredAspectRatio + 5000) / 10000; // Only adjust the overlay height if it is bigger than original one. If // the width is modified it can break the overlay. |