diff options
author | Cameron Cawley | 2019-04-02 15:25:25 +0100 |
---|---|---|
committer | Filippos Karapetis | 2019-04-07 20:52:39 +0300 |
commit | c21090ea03965b128edcdfabad7f074151961fda (patch) | |
tree | abb365fefe922eea72bf0eaefd16790587feaa09 | |
parent | b3e4aa146463b13b5524877328993f66e0b48f1a (diff) | |
download | scummvm-rg350-c21090ea03965b128edcdfabad7f074151961fda.tar.gz scummvm-rg350-c21090ea03965b128edcdfabad7f074151961fda.tar.bz2 scummvm-rg350-c21090ea03965b128edcdfabad7f074151961fda.zip |
BACKENDS: Simplify setGraphicsMode on GPH, Dingux and LinuxMoto
-rw-r--r-- | backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp | 31 | ||||
-rw-r--r-- | backends/graphics/dinguxsdl/dinguxsdl-graphics.h | 2 | ||||
-rw-r--r-- | backends/graphics/gph/gph-graphics.cpp | 29 | ||||
-rw-r--r-- | backends/graphics/gph/gph-graphics.h | 3 | ||||
-rw-r--r-- | backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp | 29 | ||||
-rw-r--r-- | backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h | 2 |
6 files changed, 19 insertions, 77 deletions
diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp index b1a69b27e4..5cfcdcfcb8 100644 --- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp +++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp @@ -51,39 +51,20 @@ int DINGUXSdlGraphicsManager::getDefaultGraphicsMode() const { return GFX_NORMAL; } -bool DINGUXSdlGraphicsManager::setGraphicsMode(int mode) { - Common::StackLock lock(_graphicsMutex); - - assert(_transactionMode == kTransactionActive); - - if (_oldVideoMode.setup && _oldVideoMode.mode == mode) - return true; - - int newScaleFactor = 1; - +int DINGUXSdlGraphicsManager::getGraphicsModeScale(int mode) const { + int scale; switch (mode) { case GFX_NORMAL: - newScaleFactor = 1; - break; #ifdef USE_SCALERS case GFX_HALF: - newScaleFactor = 1; - break; #endif + scale = 1; + break; default: - warning("unknown gfx mode %d", mode); - return false; + scale = -1; } - if (_oldVideoMode.setup && _oldVideoMode.scaleFactor != newScaleFactor) - _transactionDetails.needHotswap = true; - - _transactionDetails.needUpdatescreen = true; - - _videoMode.mode = mode; - _videoMode.scaleFactor = newScaleFactor; - - return true; + return scale; } void DINGUXSdlGraphicsManager::setGraphicsModeIntern() { diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.h b/backends/graphics/dinguxsdl/dinguxsdl-graphics.h index 71910904d5..a8228cf991 100644 --- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.h +++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.h @@ -43,7 +43,7 @@ public: void initSize(uint w, uint h, const Graphics::PixelFormat *format = NULL) override; const OSystem::GraphicsMode *getSupportedGraphicsModes() const override; - bool setGraphicsMode(int mode) override; + int getGraphicsModeScale(int mode) const override; void setGraphicsModeIntern() override; void internUpdateScreen() override; void showOverlay() override; diff --git a/backends/graphics/gph/gph-graphics.cpp b/backends/graphics/gph/gph-graphics.cpp index 5ec36c25c6..efadc3ec37 100644 --- a/backends/graphics/gph/gph-graphics.cpp +++ b/backends/graphics/gph/gph-graphics.cpp @@ -47,37 +47,18 @@ int GPHGraphicsManager::getDefaultGraphicsMode() const { return GFX_NORMAL; } -bool GPHGraphicsManager::setGraphicsMode(int mode) { - Common::StackLock lock(_graphicsMutex); - - assert(_transactionMode == kTransactionActive); - - if (_oldVideoMode.setup && _oldVideoMode.mode == mode) - return true; - - int newScaleFactor = 1; - +int GPHGraphicsManager::getGraphicsModeScale(int mode) const { + int scale; switch (mode) { case GFX_NORMAL: - newScaleFactor = 1; - break; case GFX_HALF: - newScaleFactor = 1; + scale = 1; break; default: - warning("unknown gfx mode %d", mode); - return false; + scale = -1; } - if (_oldVideoMode.setup && _oldVideoMode.scaleFactor != newScaleFactor) - _transactionDetails.needHotswap = true; - - _transactionDetails.needUpdatescreen = true; - - _videoMode.mode = mode; - _videoMode.scaleFactor = newScaleFactor; - - return true; + return scale; } void GPHGraphicsManager::setGraphicsModeIntern() { diff --git a/backends/graphics/gph/gph-graphics.h b/backends/graphics/gph/gph-graphics.h index 69e3b8947f..77da75c6aa 100644 --- a/backends/graphics/gph/gph-graphics.h +++ b/backends/graphics/gph/gph-graphics.h @@ -42,8 +42,7 @@ public: void initSize(uint w, uint h, const Graphics::PixelFormat *format = NULL) override; const OSystem::GraphicsMode *getSupportedGraphicsModes() const override; - bool setGraphicsMode(const char *name) override; - bool setGraphicsMode(int mode) override; + int getGraphicsModeScale(int mode) const override; void setGraphicsModeIntern() override; void internUpdateScreen() override; void showOverlay() override; diff --git a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp index bb78435797..b36136c422 100644 --- a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp +++ b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp @@ -57,37 +57,18 @@ int LinuxmotoSdlGraphicsManager::getDefaultGraphicsMode() const { return GFX_NORMAL; } -bool LinuxmotoSdlGraphicsManager::setGraphicsMode(int mode) { - Common::StackLock lock(_graphicsMutex); - - assert(_transactionMode == kTransactionActive); - - if (_oldVideoMode.setup && _oldVideoMode.mode == mode) - return true; - - int newScaleFactor = 1; - +int LinuxmotoSdlGraphicsManager::getGraphicsModeScale(int mode) const { + int scale; switch (mode) { case GFX_NORMAL: - newScaleFactor = 1; - break; case GFX_HALF: - newScaleFactor = 1; + scale = 1; break; default: - warning("unknown gfx mode %d", mode); - return false; + scale = -1; } - if (_oldVideoMode.setup && _oldVideoMode.scaleFactor != newScaleFactor) - _transactionDetails.needHotswap = true; - - _transactionDetails.needUpdatescreen = true; - - _videoMode.mode = mode; - _videoMode.scaleFactor = newScaleFactor; - - return true; + return scale; } void LinuxmotoSdlGraphicsManager::setGraphicsModeIntern() { diff --git a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h index e7f96e877c..e48cff35e6 100644 --- a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h +++ b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h @@ -31,7 +31,7 @@ public: virtual void initSize(uint w, uint h) override; virtual void setGraphicsModeIntern() override; - virtual bool setGraphicsMode(int mode) override; + virtual int getGraphicsModeScale(int mode) const override; virtual void internUpdateScreen() override; virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const override; virtual int getDefaultGraphicsMode() const override; |