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

vgvgf at users.sourceforge.net vgvgf at users.sourceforge.net
Fri Aug 6 23:39:54 CEST 2010


Revision: 51806
          http://scummvm.svn.sourceforge.net/scummvm/?rev=51806&view=rev
Author:   vgvgf
Date:     2010-08-06 21:39:54 +0000 (Fri, 06 Aug 2010)

Log Message:
-----------
OPENGL: Add 5/3 and 5/4 aspect ratio corrections.

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/openglsdl/openglsdl-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-06 21:21:39 UTC (rev 51805)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp	2010-08-06 21:39:54 UTC (rev 51806)
@@ -75,6 +75,10 @@
 		_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 @@
 		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 @@
 		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 @@
 		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 @@
 	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 @@
 	// Write pixel data to BMP
 	out.write(pixels, width * height * 3);
 
+	// Free allocated memory
 	delete[] pixels;
 
 	return true;

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h	2010-08-06 21:21:39 UTC (rev 51805)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h	2010-08-06 21:39:54 UTC (rev 51806)
@@ -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 @@
 		kAspectRatioConserve,
 		kAspectRatio4_3,
 		kAspectRatio16_9,
-		kAspectRatio16_10
+		kAspectRatio16_10,
+		kAspectRatio5_3,
+		kAspectRatio5_4
 	};
 
 	struct VideoState {

Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp	2010-08-06 21:21:39 UTC (rev 51805)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/openglsdl/openglsdl-graphics.cpp	2010-08-06 21:39:54 UTC (rev 51806)
@@ -333,9 +333,9 @@
 	
 		// 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.


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