[Scummvm-cvs-logs] SF.net SVN: scummvm:[51752] scummvm/branches/gsoc2010-opengl/backends/ graphics

vgvgf at users.sourceforge.net vgvgf at users.sourceforge.net
Thu Aug 5 08:20:44 CEST 2010


Revision: 51752
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51752&view=rev
Author:   vgvgf
Date:     2010-08-05 06:20:44 +0000 (Thu, 05 Aug 2010)

Log Message:
-----------
OPENGL: Improve aspect ratio correction mode selection.

Modified Paths:
--------------
    scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp
    scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h
    scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp	2010-08-05 05:27:55 UTC (rev 51751)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp	2010-08-05 06:20:44 UTC (rev 51752)
@@ -39,6 +39,9 @@
 #ifdef USE_OSD
 	_osdTexture(0), _osdAlpha(0), _osdFadeStartTime(0),
 #endif
+#ifndef USE_ALL_ASR
+	_desiredAspectRatio(kAspectRatio4_3),
+#endif
 	_gameTexture(0), _overlayTexture(0), _cursorTexture(0),
 	_screenChangeCount(0), _screenNeedsRedraw(false),
 	_shakePos(0),
@@ -65,6 +68,14 @@
 	
 	// Register the graphics manager as a event observer
 	g_system->getEventManager()->getEventDispatcher()->registerObserver(this, 2, false);
+
+#ifndef USE_ALL_ASR
+	Common::String desiredAspectRatio = ConfMan.get("desired_screen_aspect_ratio");
+	if (!scumm_stricmp(desiredAspectRatio.c_str(), "16/9"))
+		_desiredAspectRatio = kAspectRatio16_9;
+	else if (!scumm_stricmp(desiredAspectRatio.c_str(), "16/10"))
+		_desiredAspectRatio = kAspectRatio16_10;
+#endif
 }
 
 OpenGLGraphicsManager::~OpenGLGraphicsManager() {
@@ -1178,7 +1189,12 @@
 #ifdef USE_ALL_ASR
 			_videoMode.aspectRatioCorrection = (_videoMode.aspectRatioCorrection + 1) % 5;
 #else
-			_videoMode.aspectRatioCorrection = (_videoMode.aspectRatioCorrection + 1) % 3;
+			if (_videoMode.aspectRatioCorrection == kAspectRatioNone)
+				_videoMode.aspectRatioCorrection = kAspectRatioConserve;
+			else if (_videoMode.aspectRatioCorrection == kAspectRatioConserve)
+				_videoMode.aspectRatioCorrection = _desiredAspectRatio;
+			else
+				_videoMode.aspectRatioCorrection = kAspectRatioNone;
 #endif
 		else
 			_videoMode.aspectRatioCorrection = ratio;

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h	2010-08-05 05:27:55 UTC (rev 51751)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h	2010-08-05 06:20:44 UTC (rev 51752)
@@ -189,6 +189,10 @@
 	int _aspectWidth;
 	int _aspectHeight;
 
+#ifndef USE_ALL_ASR
+	int _desiredAspectRatio;
+#endif
+
 	/**
 	 * Sets the aspect ratio mode.
 	 * @mode the aspect ratio mode, if -1 it will switch to next mode.

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp	2010-08-05 05:27:55 UTC (rev 51751)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp	2010-08-05 06:20:44 UTC (rev 51752)
@@ -673,7 +673,6 @@
 			continue;
 		if (mode->h * kw != mode->w * kh)
 			continue;
-		//printf("%d %d\n", mode->w, mode->h);
 
 		uint metric = mode->w * mode->h - w * h;
 		if (metric > bestMetric)
@@ -687,7 +686,6 @@
 		warning("Unable to enforce the desired aspect ratio!");
 		return;
 	}
-	//printf("%d %d\n", bestMode->w, bestMode->h);
 	width = bestMode->w;
 	height = bestMode->h;
 }


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list