aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Schickel2013-10-24 00:06:32 +0200
committerJohannes Schickel2013-10-24 00:06:32 +0200
commitea6d38d5f3b123b765e5bf8e2dc4f957e4b43eb6 (patch)
tree7ae9023d618e271f202e0847092ec2f92b9a9048
parent281672e1718d5f960061b714f79924125922e1e5 (diff)
downloadscummvm-rg350-ea6d38d5f3b123b765e5bf8e2dc4f957e4b43eb6.tar.gz
scummvm-rg350-ea6d38d5f3b123b765e5bf8e2dc4f957e4b43eb6.tar.bz2
scummvm-rg350-ea6d38d5f3b123b765e5bf8e2dc4f957e4b43eb6.zip
SDL: Make activateManager/deactivateManager SdlGraphicsManager specific.
We can do this now that we can use virtual inheritance and dynamic_cast because we enabled RTTI.
-rw-r--r--backends/graphics/graphics.h21
-rw-r--r--backends/graphics/openglsdl/openglsdl-graphics.cpp4
-rw-r--r--backends/graphics/sdl/sdl-graphics.h13
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp4
-rw-r--r--backends/platform/sdl/sdl.cpp10
5 files changed, 22 insertions, 30 deletions
diff --git a/backends/graphics/graphics.h b/backends/graphics/graphics.h
index 74258b8910..24397228e6 100644
--- a/backends/graphics/graphics.h
+++ b/backends/graphics/graphics.h
@@ -37,27 +37,6 @@ class GraphicsManager : public PaletteManager {
public:
virtual ~GraphicsManager() {}
- /**
- * Makes this graphics manager active. That means it should be ready to
- * process inputs now. However, even without being active it should be
- * able to query the supported modes and other bits.
- *
- * HACK: Actually this is specific to SdlGraphicsManager subclasses.
- * But sadly we cannot cast from GraphicsManager to SdlGraphicsManager
- * because there is no relation between these two.
- */
- virtual void activateManager() {}
-
- /**
- * Makes this graphics manager inactive. This should allow another
- * graphics manager to become active again.
- *
- * HACK: Actually this is specific to SdlGraphicsManager subclasses.
- * But sadly we cannot cast from GraphicsManager to SdlGraphicsManager
- * because there is no relation between these two.
- */
- virtual void deactivateManager() {}
-
virtual bool hasFeature(OSystem::Feature f) = 0;
virtual void setFeatureState(OSystem::Feature f, bool enable) = 0;
virtual bool getFeatureState(OSystem::Feature f) = 0;
diff --git a/backends/graphics/openglsdl/openglsdl-graphics.cpp b/backends/graphics/openglsdl/openglsdl-graphics.cpp
index e39cd35870..f76d7b2ec0 100644
--- a/backends/graphics/openglsdl/openglsdl-graphics.cpp
+++ b/backends/graphics/openglsdl/openglsdl-graphics.cpp
@@ -73,7 +73,7 @@ OpenGLSdlGraphicsManager::~OpenGLSdlGraphicsManager() {
}
void OpenGLSdlGraphicsManager::activateManager() {
- OpenGLGraphicsManager::activateManager();
+ SdlGraphicsManager::activateManager();
initEventSource();
// Register the graphics manager as a event observer
@@ -87,7 +87,7 @@ void OpenGLSdlGraphicsManager::deactivateManager() {
}
deinitEventSource();
- OpenGLGraphicsManager::deactivateManager();
+ SdlGraphicsManager::deactivateManager();
}
bool OpenGLSdlGraphicsManager::hasFeature(OSystem::Feature f) {
diff --git a/backends/graphics/sdl/sdl-graphics.h b/backends/graphics/sdl/sdl-graphics.h
index ebf8078f23..fea743b3ca 100644
--- a/backends/graphics/sdl/sdl-graphics.h
+++ b/backends/graphics/sdl/sdl-graphics.h
@@ -40,6 +40,19 @@ public:
virtual ~SdlGraphicsManager();
/**
+ * Makes this graphics manager active. That means it should be ready to
+ * process inputs now. However, even without being active it should be
+ * able to query the supported modes and other bits.
+ */
+ virtual void activateManager() {}
+
+ /**
+ * Makes this graphics manager inactive. This should allow another
+ * graphics manager to become active again.
+ */
+ virtual void deactivateManager() {}
+
+ /**
* Notify the graphics manager that the graphics needs to be redrawn, since
* the application window was modified.
*
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index c946b8e747..15193e2da4 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -198,7 +198,7 @@ SurfaceSdlGraphicsManager::~SurfaceSdlGraphicsManager() {
}
void SurfaceSdlGraphicsManager::activateManager() {
- GraphicsManager::activateManager();
+ SdlGraphicsManager::activateManager();
initEventSource();
// Register the graphics manager as a event observer
@@ -212,7 +212,7 @@ void SurfaceSdlGraphicsManager::deactivateManager() {
}
deinitEventSource();
- GraphicsManager::deactivateManager();
+ SdlGraphicsManager::deactivateManager();
}
bool SurfaceSdlGraphicsManager::hasFeature(OSystem::Feature f) {
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp
index c240727069..6175f07a53 100644
--- a/backends/platform/sdl/sdl.cpp
+++ b/backends/platform/sdl/sdl.cpp
@@ -91,7 +91,7 @@ OSystem_SDL::~OSystem_SDL() {
delete _savefileManager;
_savefileManager = 0;
if (_graphicsManager) {
- _graphicsManager->deactivateManager();
+ dynamic_cast<SdlGraphicsManager *>(_graphicsManager)->deactivateManager();
}
delete _graphicsManager;
_graphicsManager = 0;
@@ -240,7 +240,7 @@ void OSystem_SDL::initBackend() {
// so the virtual keyboard can be initialized, but we have to add the
// graphics manager as an event observer after initializing the event
// manager.
- _graphicsManager->activateManager();
+ dynamic_cast<SdlGraphicsManager *>(_graphicsManager)->activateManager();
}
#if defined(USE_TASKBAR)
@@ -585,14 +585,14 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
// manager, delete and create the new mode graphics manager
if (_graphicsMode >= _firstGLMode && mode < _firstGLMode) {
debug(1, "switching to plain SDL graphics");
- _graphicsManager->deactivateManager();
+ dynamic_cast<SdlGraphicsManager *>(_graphicsManager)->deactivateManager();
delete _graphicsManager;
_graphicsManager = new SurfaceSdlGraphicsManager(_eventSource);
switchedManager = true;
} else if (_graphicsMode < _firstGLMode && mode >= _firstGLMode) {
debug(1, "switching to OpenGL graphics");
- _graphicsManager->deactivateManager();
+ dynamic_cast<SdlGraphicsManager *>(_graphicsManager)->deactivateManager();
delete _graphicsManager;
_graphicsManager = new OpenGLSdlGraphicsManager(_desktopWidth, _desktopHeight, _eventSource);
@@ -602,7 +602,7 @@ bool OSystem_SDL::setGraphicsMode(int mode) {
_graphicsMode = mode;
if (switchedManager) {
- _graphicsManager->activateManager();
+ dynamic_cast<SdlGraphicsManager *>(_graphicsManager)->activateManager();
_graphicsManager->beginGFXTransaction();
#ifdef USE_RGB_COLOR