[Scummvm-cvs-logs] SF.net SVN: scummvm:[51492] scummvm/branches/gsoc2010-opengl
vgvgf at users.sourceforge.net
vgvgf at users.sourceforge.net
Fri Jul 30 05:06:58 CEST 2010
Revision: 51492
http://scummvm.svn.sourceforge.net/scummvm/?rev=51492&view=rev
Author: vgvgf
Date: 2010-07-30 03:06:57 +0000 (Fri, 30 Jul 2010)
Log Message:
-----------
OSYSTEM: Add resetGraphicsScale() method.
This fixes a hack for resetting the graphics scale to x1 when starting games that have a large screen size. The SDL graphics manager should now scale back to x1 without changing the current scaler in use, as well as the OpenGL graphics manager.
Modified Paths:
--------------
scummvm/branches/gsoc2010-opengl/backends/base-backend.cpp
scummvm/branches/gsoc2010-opengl/backends/base-backend.h
scummvm/branches/gsoc2010-opengl/backends/graphics/graphics.h
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
scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.h
scummvm/branches/gsoc2010-opengl/backends/modular-backend.cpp
scummvm/branches/gsoc2010-opengl/backends/modular-backend.h
scummvm/branches/gsoc2010-opengl/common/system.h
scummvm/branches/gsoc2010-opengl/engines/engine.cpp
Modified: scummvm/branches/gsoc2010-opengl/backends/base-backend.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/base-backend.cpp 2010-07-30 02:58:35 UTC (rev 51491)
+++ scummvm/branches/gsoc2010-opengl/backends/base-backend.cpp 2010-07-30 03:06:57 UTC (rev 51492)
@@ -92,3 +92,9 @@
s_audiocdManager = new DefaultAudioCDManager();
return (AudioCDManager *)s_audiocdManager;
}
+
+void BaseBackend::resetGraphicsScale() {
+ // As a hack, we use 0 here. Backends should override this method
+ // and provide their own.
+ setGraphicsMode(0);
+}
Modified: scummvm/branches/gsoc2010-opengl/backends/base-backend.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/base-backend.h 2010-07-30 02:58:35 UTC (rev 51491)
+++ scummvm/branches/gsoc2010-opengl/backends/base-backend.h 2010-07-30 03:06:57 UTC (rev 51492)
@@ -40,6 +40,8 @@
virtual Common::WriteStream *createConfigWriteStream();
virtual AudioCDManager *getAudioCDManager();
+
+ virtual void resetGraphicsScale();
};
Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/graphics.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/graphics.h 2010-07-30 02:58:35 UTC (rev 51491)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/graphics.h 2010-07-30 03:06:57 UTC (rev 51492)
@@ -45,6 +45,7 @@
virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const = 0;
virtual int getDefaultGraphicsMode() const = 0;
virtual bool setGraphicsMode(int mode) = 0;
+ virtual void resetGraphicsScale() = 0;
virtual int getGraphicsMode() const = 0;
#ifdef USE_RGB_COLOR
virtual Graphics::PixelFormat getScreenFormat() const = 0;
Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp 2010-07-30 02:58:35 UTC (rev 51491)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.cpp 2010-07-30 03:06:57 UTC (rev 51492)
@@ -168,6 +168,10 @@
return _videoMode.mode;
}
+void OpenGLGraphicsManager::resetGraphicsScale() {
+ setScale(1);
+}
+
#ifdef USE_RGB_COLOR
Graphics::PixelFormat OpenGLGraphicsManager::getScreenFormat() const {
Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h 2010-07-30 02:58:35 UTC (rev 51491)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/opengl/opengl-graphics.h 2010-07-30 03:06:57 UTC (rev 51492)
@@ -59,6 +59,7 @@
virtual int getDefaultGraphicsMode() const;
virtual bool setGraphicsMode(int mode);
virtual int getGraphicsMode() const;
+ virtual void resetGraphicsScale();
#ifdef USE_RGB_COLOR
virtual Graphics::PixelFormat getScreenFormat() const;
virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const = 0;
Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp 2010-07-30 02:58:35 UTC (rev 51491)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.cpp 2010-07-30 03:06:57 UTC (rev 51492)
@@ -248,6 +248,10 @@
return GFX_DOUBLESIZE;
}
+void SdlGraphicsManager::resetGraphicsScale() {
+ setGraphicsMode(s_gfxModeSwitchTable[_scalerType][0]);
+}
+
void SdlGraphicsManager::beginGFXTransaction() {
assert(_transactionMode == kTransactionNone);
Modified: scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.h 2010-07-30 02:58:35 UTC (rev 51491)
+++ scummvm/branches/gsoc2010-opengl/backends/graphics/sdl/sdl-graphics.h 2010-07-30 03:06:57 UTC (rev 51492)
@@ -86,6 +86,7 @@
virtual int getDefaultGraphicsMode() const;
virtual bool setGraphicsMode(int mode);
virtual int getGraphicsMode() const;
+ virtual void resetGraphicsScale();
#ifdef USE_RGB_COLOR
virtual Graphics::PixelFormat getScreenFormat() const { return _screenFormat; }
virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const;
Modified: scummvm/branches/gsoc2010-opengl/backends/modular-backend.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/modular-backend.cpp 2010-07-30 02:58:35 UTC (rev 51491)
+++ scummvm/branches/gsoc2010-opengl/backends/modular-backend.cpp 2010-07-30 03:06:57 UTC (rev 51492)
@@ -91,6 +91,10 @@
return _graphicsManager->getGraphicsMode();
}
+void ModularBackend::resetGraphicsScale() {
+ _graphicsManager->resetGraphicsScale();
+}
+
#ifdef USE_RGB_COLOR
Graphics::PixelFormat ModularBackend::getScreenFormat() const {
Modified: scummvm/branches/gsoc2010-opengl/backends/modular-backend.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/backends/modular-backend.h 2010-07-30 02:58:35 UTC (rev 51491)
+++ scummvm/branches/gsoc2010-opengl/backends/modular-backend.h 2010-07-30 03:06:57 UTC (rev 51492)
@@ -74,6 +74,7 @@
virtual int getDefaultGraphicsMode() const;
virtual bool setGraphicsMode(int mode);
virtual int getGraphicsMode() const;
+ virtual void resetGraphicsScale();
#ifdef USE_RGB_COLOR
virtual Graphics::PixelFormat getScreenFormat() const;
virtual Common::List<Graphics::PixelFormat> getSupportedFormats() const;
Modified: scummvm/branches/gsoc2010-opengl/common/system.h
===================================================================
--- scummvm/branches/gsoc2010-opengl/common/system.h 2010-07-30 02:58:35 UTC (rev 51491)
+++ scummvm/branches/gsoc2010-opengl/common/system.h 2010-07-30 03:06:57 UTC (rev 51492)
@@ -356,6 +356,13 @@
*/
virtual int getGraphicsMode() const = 0;
+ /**
+ * Sets the graphics scale factor to x1. Games with large screen sizes
+ * reset the scale to x1 so the screen will not be too big when starting
+ * the game.
+ */
+ virtual void resetGraphicsScale() = 0;
+
#ifdef USE_RGB_COLOR
/**
* Determine the pixel format currently in use for screen rendering.
Modified: scummvm/branches/gsoc2010-opengl/engines/engine.cpp
===================================================================
--- scummvm/branches/gsoc2010-opengl/engines/engine.cpp 2010-07-30 02:58:35 UTC (rev 51491)
+++ scummvm/branches/gsoc2010-opengl/engines/engine.cpp 2010-07-30 03:06:57 UTC (rev 51492)
@@ -154,10 +154,7 @@
// See if the game should default to 1x scaler
if (useDefaultGraphicsMode && defaultTo1XScaler) {
- // FIXME: As a hack, we use "1x" here. Would be nicer to use
- // getDefaultGraphicsMode() instead, but right now, we do not specify
- // whether that is a 1x scaler or not...
- g_system->setGraphicsMode("1x");
+ g_system->resetGraphicsScale();
} else {
// Override global scaler with any game-specific define
if (ConfMan.hasKey("gfx_mode")) {
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