[Scummvm-cvs-logs] scummvm master -> b8dcd9a25eb27ef40aa5535fc83879d20db7e10c

lordhoto lordhoto at gmail.com
Fri Aug 12 04:11:30 CEST 2011


This automated email contains information about 2 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
a77c29327e OPENGLSDL: Do not change requested window size on resize.
b8dcd9a25e OPENGL: Fix aspect ratio correction behavior.


Commit: a77c29327e8e4c06c3b45dac16b96198a120fefe
    https://github.com/scummvm/scummvm/commit/a77c29327e8e4c06c3b45dac16b96198a120fefe
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-08-11T18:46:32-07:00

Commit Message:
OPENGLSDL: Do not change requested window size on resize.

This should help fix a lock up on window managers, which will try to force the
ScummVM window to a certain size, by just requesting the same size over and
over again.

Now we get black borders even in windowed mode when the aspect of the window
does not match the aspect of the game screen (and we are not in "normal" mode),
but that is usually the same in video players too, so shouldn't be too bad.

Changed paths:
    backends/graphics/openglsdl/openglsdl-graphics.cpp



diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index 8ea9576..d281081 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -640,10 +640,7 @@ void OpenGLSdlGraphicsManager::notifyResize(const uint width, const uint height)
 			_videoMode.hardwareWidth = width;
 			_videoMode.hardwareHeight = height;
 
-			if (_videoMode.mode != OpenGL::GFX_ORIGINAL) {
-				_screenResized = true;
-				calculateDisplaySize(_videoMode.hardwareWidth, _videoMode.hardwareHeight);
-			}
+			_screenResized = true;
 
 			int scale = MIN(_videoMode.hardwareWidth / _videoMode.screenWidth,
 			                _videoMode.hardwareHeight / _videoMode.screenHeight);
@@ -653,10 +650,6 @@ void OpenGLSdlGraphicsManager::notifyResize(const uint width, const uint height)
 				setScale(MAX(MIN(scale, 3), 1));
 			}
 
-			if (_videoMode.mode == OpenGL::GFX_ORIGINAL) {
-				calculateDisplaySize(_videoMode.hardwareWidth, _videoMode.hardwareHeight);
-			}
-
 			_transactionDetails.sizeChanged = true;
 		endGFXTransaction();
 #ifdef USE_OSD


Commit: b8dcd9a25eb27ef40aa5535fc83879d20db7e10c
    https://github.com/scummvm/scummvm/commit/b8dcd9a25eb27ef40aa5535fc83879d20db7e10c
Author: Johannes Schickel (lordhoto at scummvm.org)
Date: 2011-08-11T19:06:54-07:00

Commit Message:
OPENGL: Fix aspect ratio correction behavior.

Now only 320x200 and 640x400 will result in aspect ratio correction to be used
if the user requested it. This should fix some strechting in Myst/Riven.

Changed paths:
    backends/graphics/opengl/opengl-graphics.cpp
    backends/graphics/opengl/opengl-graphics.h
    backends/graphics/openglsdl/openglsdl-graphics.cpp



diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 57c2378..40ef17e 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -1245,12 +1245,16 @@ void OpenGLGraphicsManager::toggleAntialiasing() {
 	_transactionDetails.filterChanged = true;
 }
 
-uint OpenGLGraphicsManager::getAspectRatio() {
+uint OpenGLGraphicsManager::getAspectRatio() const {
 	// In case we enable aspect ratio correction we force a 4/3 ratio.
+	// But just for 320x200 and 640x400 games, since other games do not need
+	// this.
 	// TODO: This makes OpenGL Normal behave like OpenGL Conserve, when aspect
 	// ratio correction is enabled, but it's better than the previous 4/3 mode
 	// mess at least...
-	if (_videoMode.aspectRatioCorrection)
+	if (_videoMode.aspectRatioCorrection
+	    && ((_videoMode.screenWidth == 320 && _videoMode.screenHeight == 200)
+	    || (_videoMode.screenWidth == 640 && _videoMode.screenHeight == 400)))
 		return 13333;
 	else if (_videoMode.mode == OpenGL::GFX_NORMAL)
 		return _videoMode.hardwareWidth * 10000 / _videoMode.hardwareHeight;
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index 8a110b2..42cfbac 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -214,10 +214,7 @@ protected:
 	virtual void calculateDisplaySize(int &width, int &height);
 	virtual void refreshDisplaySize();
 
-	/**
-	 * Returns the current target aspect ratio x 10000
-	 */
-	virtual uint getAspectRatio();
+	uint getAspectRatio() const;
 
 	bool _formatBGR;
 
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index d281081..8451573 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -313,14 +313,17 @@ bool OpenGLSdlGraphicsManager::loadGFXMode() {
 		_videoMode.overlayWidth = _videoMode.hardwareWidth = _videoMode.screenWidth * scaleFactor;
 		_videoMode.overlayHeight = _videoMode.hardwareHeight = _videoMode.screenHeight * scaleFactor;
 
-		int screenAspectRatio = _videoMode.screenWidth * 10000 / _videoMode.screenHeight;
-		int desiredAspectRatio = getAspectRatio();
-
-		// Do not downscale dimensions, only enlarge them if needed
-		if (screenAspectRatio > desiredAspectRatio)
-			_videoMode.hardwareHeight = (_videoMode.overlayWidth * 10000  + 5000) / desiredAspectRatio;
-		else if (screenAspectRatio < desiredAspectRatio)
-			_videoMode.hardwareWidth = (_videoMode.overlayHeight * desiredAspectRatio + 5000) / 10000;
+		// The only modes where we need to adapt the aspect ratio are 320x200
+		// and 640x400. That is since our aspect ratio correction in fact is
+		// only used to ensure that the original pixel size aspect for these
+		// modes is used.
+		// (Non-square pixels on old monitors vs square pixel on new ones).
+		if (_videoMode.aspectRatioCorrection
+		    && ((_videoMode.screenWidth == 320 && _videoMode.screenHeight == 200)
+		    || (_videoMode.screenWidth == 640 && _videoMode.screenHeight == 400)))
+			_videoMode.overlayHeight = _videoMode.hardwareHeight = 240 * scaleFactor;
+		else
+			_videoMode.overlayHeight = _videoMode.hardwareHeight = _videoMode.screenHeight * scaleFactor;
 	}
 
 	_screenResized = false;






More information about the Scummvm-git-logs mailing list