aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2013-10-21 01:03:29 +0200
committerJohannes Schickel2013-10-23 22:59:06 +0200
commitd34c9d5bcbbad9fdde59143d15d7e18bc82231c1 (patch)
treed4412f56a81d40818bb1f406ad69247f2044e950
parenta9cb67df081cd8da44720d9c0b924ed22f7a38b7 (diff)
downloadscummvm-rg350-d34c9d5bcbbad9fdde59143d15d7e18bc82231c1.tar.gz
scummvm-rg350-d34c9d5bcbbad9fdde59143d15d7e18bc82231c1.tar.bz2
scummvm-rg350-d34c9d5bcbbad9fdde59143d15d7e18bc82231c1.zip
SDL: Do not require a static graphics mode list in OpenGL and SurfaceSDL.
-rw-r--r--backends/graphics/opengl/opengl-graphics.cpp4
-rw-r--r--backends/graphics/opengl/opengl-graphics.h4
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp4
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.h1
-rw-r--r--backends/platform/sdl/sdl.cpp15
5 files changed, 10 insertions, 18 deletions
diff --git a/backends/graphics/opengl/opengl-graphics.cpp b/backends/graphics/opengl/opengl-graphics.cpp
index 00e8dc358e..9ad0e62f37 100644
--- a/backends/graphics/opengl/opengl-graphics.cpp
+++ b/backends/graphics/opengl/opengl-graphics.cpp
@@ -122,10 +122,6 @@ const OSystem::GraphicsMode glGraphicsModes[] = {
} // End of anonymous namespace
-const OSystem::GraphicsMode *OpenGLGraphicsManager::supportedGraphicsModes() {
- return glGraphicsModes;
-}
-
const OSystem::GraphicsMode *OpenGLGraphicsManager::getSupportedGraphicsModes() const {
return glGraphicsModes;
}
diff --git a/backends/graphics/opengl/opengl-graphics.h b/backends/graphics/opengl/opengl-graphics.h
index ebfe38fb60..d2d0358407 100644
--- a/backends/graphics/opengl/opengl-graphics.h
+++ b/backends/graphics/opengl/opengl-graphics.h
@@ -57,10 +57,6 @@ public:
virtual void setFeatureState(OSystem::Feature f, bool enable);
virtual bool getFeatureState(OSystem::Feature f);
- // HACK: This is required for the SDL backend to switch between OpenGL SDL
- // and Surface SDL.
- static const OSystem::GraphicsMode *supportedGraphicsModes();
-
virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
virtual int getDefaultGraphicsMode() const;
virtual bool setGraphicsMode(int mode);
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 8ad0bcbdd7..c946b8e747 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -262,10 +262,6 @@ bool SurfaceSdlGraphicsManager::getFeatureState(OSystem::Feature f) {
}
}
-const OSystem::GraphicsMode *SurfaceSdlGraphicsManager::supportedGraphicsModes() {
- return s_supportedGraphicsModes;
-}
-
const OSystem::GraphicsMode *SurfaceSdlGraphicsManager::getSupportedGraphicsModes() const {
return s_supportedGraphicsModes;
}
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index 0bee70bf0c..00c05ff2bf 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -87,7 +87,6 @@ public:
virtual void setFeatureState(OSystem::Feature f, bool enable);
virtual bool getFeatureState(OSystem::Feature f);
- static const OSystem::GraphicsMode *supportedGraphicsModes();
virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const;
virtual int getDefaultGraphicsMode() const;
virtual bool setGraphicsMode(int mode);
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index 39865c85c6..327dfe21b9 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -651,21 +651,26 @@ void OSystem_SDL::setupGraphicsModes() {
_graphicsModes.clear();
_graphicsModeIds.clear();
- const OSystem::GraphicsMode *sdlGraphicsModes = SurfaceSdlGraphicsManager::supportedGraphicsModes();
- const OSystem::GraphicsMode *openglGraphicsModes = OpenGLSdlGraphicsManager::supportedGraphicsModes();
-
// Count the number of graphics modes
- const OSystem::GraphicsMode *srcMode = sdlGraphicsModes;
+ const OSystem::GraphicsMode *srcMode;
+
+ GraphicsManager *manager = new SurfaceSdlGraphicsManager(_eventSource);
+ srcMode = manager->getSupportedGraphicsModes();
while (srcMode->name) {
_graphicsModes.push_back(*srcMode);
srcMode++;
}
+ delete manager;
+
_firstGLMode = _graphicsModes.size();
- srcMode = openglGraphicsModes;
+ manager = new OpenGLSdlGraphicsManager(_desktopWidth, _desktopHeight, _eventSource);
+ srcMode = manager->getSupportedGraphicsModes();
while (srcMode->name) {
_graphicsModes.push_back(*srcMode);
srcMode++;
}
+ delete manager;
+ manager = nullptr;
// Set a null mode at the end
GraphicsMode nullMode;