aboutsummaryrefslogtreecommitdiff
path: root/backends
diff options
context:
space:
mode:
authorCameron Cawley2019-07-26 19:17:57 +0100
committerFilippos Karapetis2019-08-11 14:27:52 +0300
commit9b6461122e237a02a9cab6e7ee7a11b236f5d69f (patch)
treed2ace55ae9f8872a9af926210c019a6e0d1bc86c /backends
parent6b8869fc64c32054a026fe0aa9d03fff6f53e310 (diff)
downloadscummvm-rg350-9b6461122e237a02a9cab6e7ee7a11b236f5d69f.tar.gz
scummvm-rg350-9b6461122e237a02a9cab6e7ee7a11b236f5d69f.tar.bz2
scummvm-rg350-9b6461122e237a02a9cab6e7ee7a11b236f5d69f.zip
SDL: Move selecting the required ScalerProc into a separate function
Diffstat (limited to 'backends')
-rw-r--r--backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp19
-rw-r--r--backends/graphics/dinguxsdl/dinguxsdl-graphics.h2
-rw-r--r--backends/graphics/gph/gph-graphics.cpp19
-rw-r--r--backends/graphics/gph/gph-graphics.h2
-rw-r--r--backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp19
-rw-r--r--backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h2
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.cpp19
-rw-r--r--backends/graphics/surfacesdl/surfacesdl-graphics.h1
8 files changed, 23 insertions, 60 deletions
diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
index f3061824dc..0b0d9a3a7a 100644
--- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
+++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
@@ -67,10 +67,8 @@ int DINGUXSdlGraphicsManager::getGraphicsModeScale(int mode) const {
return scale;
}
-void DINGUXSdlGraphicsManager::setGraphicsModeIntern() {
- Common::StackLock lock(_graphicsMutex);
+ScalerProc *DINGUXSdlGraphicsManager::getGraphicsScalerProc(int mode) const {
ScalerProc *newScalerProc = 0;
-
switch (_videoMode.mode) {
case GFX_NORMAL:
newScalerProc = Normal1x;
@@ -80,22 +78,9 @@ void DINGUXSdlGraphicsManager::setGraphicsModeIntern() {
newScalerProc = DownscaleAllByHalf;
break;
#endif
-
- default:
- error("Unknown gfx mode %d", _videoMode.mode);
}
- _scalerProc = newScalerProc;
-
- if (!_screen || !_hwScreen)
- return;
-
- // Blit everything to the screen
- _forceRedraw = true;
-
- // Even if the old and new scale factors are the same, we may have a
- // different scaler for the cursor now.
- blitCursor();
+ return newScalerProc;
}
void DINGUXSdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) {
diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.h b/backends/graphics/dinguxsdl/dinguxsdl-graphics.h
index a8228cf991..c4f686d0e7 100644
--- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.h
+++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.h
@@ -44,7 +44,7 @@ public:
void initSize(uint w, uint h, const Graphics::PixelFormat *format = NULL) override;
const OSystem::GraphicsMode *getSupportedGraphicsModes() const override;
int getGraphicsModeScale(int mode) const override;
- void setGraphicsModeIntern() override;
+ ScalerProc *getGraphicsScalerProc(int mode) const override;
void internUpdateScreen() override;
void showOverlay() override;
void hideOverlay() override;
diff --git a/backends/graphics/gph/gph-graphics.cpp b/backends/graphics/gph/gph-graphics.cpp
index efadc3ec37..a55a8869bb 100644
--- a/backends/graphics/gph/gph-graphics.cpp
+++ b/backends/graphics/gph/gph-graphics.cpp
@@ -61,10 +61,8 @@ int GPHGraphicsManager::getGraphicsModeScale(int mode) const {
return scale;
}
-void GPHGraphicsManager::setGraphicsModeIntern() {
- Common::StackLock lock(_graphicsMutex);
+ScalerProc *GPHGraphicsManager::getGraphicsScalerProc(int mode) const {
ScalerProc *newScalerProc = 0;
-
switch (_videoMode.mode) {
case GFX_NORMAL:
newScalerProc = Normal1x;
@@ -72,22 +70,9 @@ void GPHGraphicsManager::setGraphicsModeIntern() {
case GFX_HALF:
newScalerProc = DownscaleAllByHalf;
break;
-
- default:
- error("Unknown gfx mode %d", _videoMode.mode);
}
- _scalerProc = newScalerProc;
-
- if (!_screen || !_hwScreen)
- return;
-
- // Blit everything to the screen
- _forceRedraw = true;
-
- // Even if the old and new scale factors are the same, we may have a
- // different scaler for the cursor now.
- blitCursor();
+ return newScalerProc;
}
void GPHGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) {
diff --git a/backends/graphics/gph/gph-graphics.h b/backends/graphics/gph/gph-graphics.h
index 77da75c6aa..016b9b3b7b 100644
--- a/backends/graphics/gph/gph-graphics.h
+++ b/backends/graphics/gph/gph-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;
int getGraphicsModeScale(int mode) const override;
- void setGraphicsModeIntern() override;
+ ScalerProc *getGraphicsScalerProc(int mode) const override;
void internUpdateScreen() override;
void showOverlay() override;
void hideOverlay() override;
diff --git a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp
index 7ca4202045..45546c10e7 100644
--- a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp
+++ b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp
@@ -71,10 +71,8 @@ int LinuxmotoSdlGraphicsManager::getGraphicsModeScale(int mode) const {
return scale;
}
-void LinuxmotoSdlGraphicsManager::setGraphicsModeIntern() {
- Common::StackLock lock(_graphicsMutex);
+ScalerProc *LinuxmotoSdlGraphicsManager::getGraphicsScalerProc(int mode) const {
ScalerProc *newScalerProc = 0;
-
switch (_videoMode.mode) {
case GFX_NORMAL:
newScalerProc = Normal1x;
@@ -82,22 +80,9 @@ void LinuxmotoSdlGraphicsManager::setGraphicsModeIntern() {
case GFX_HALF:
newScalerProc = DownscaleAllByHalf;
break;
-
- default:
- error("Unknown gfx mode %d", _videoMode.mode);
}
- _scalerProc = newScalerProc;
-
- if (!_screen || !_hwscreen)
- return;
-
- // Blit everything to the screen
- _forceFull = true;
-
- // Even if the old and new scale factors are the same, we may have a
- // different scaler for the cursor now.
- blitCursor();
+ return newScalerProc;
}
void LinuxmotoSdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) {
diff --git a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h
index cc2af5ff0c..ed10ba9d73 100644
--- a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h
+++ b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h
@@ -33,7 +33,7 @@ public:
virtual void setGraphicsModeIntern() override;
virtual int getGraphicsModeScale(int mode) const override;
virtual void internUpdateScreen() override;
- virtual const OSystem::GraphicsMode *getSupportedGraphicsModes() const override;
+ virtual ScalerProc *getGraphicsScalerProc(int mode) const override;
virtual int getDefaultGraphicsMode() const override;
virtual bool loadGFXMode() override;
virtual void drawMouse() override;
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
index 304848ed4c..e14471b067 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.cpp
@@ -674,12 +674,8 @@ bool SurfaceSdlGraphicsManager::setGraphicsMode(int mode) {
return true;
}
-void SurfaceSdlGraphicsManager::setGraphicsModeIntern() {
- Common::StackLock lock(_graphicsMutex);
+ScalerProc *SurfaceSdlGraphicsManager::getGraphicsScalerProc(int mode) const {
ScalerProc *newScalerProc = 0;
-
- updateShader();
-
switch (_videoMode.mode) {
case GFX_NORMAL:
newScalerProc = Normal1x;
@@ -722,8 +718,19 @@ void SurfaceSdlGraphicsManager::setGraphicsModeIntern() {
newScalerProc = DotMatrix;
break;
#endif // USE_SCALERS
+ }
- default:
+ return newScalerProc;
+}
+
+void SurfaceSdlGraphicsManager::setGraphicsModeIntern() {
+ Common::StackLock lock(_graphicsMutex);
+
+ updateShader();
+
+ ScalerProc *newScalerProc = getGraphicsScalerProc(_videoMode.mode);
+
+ if (!newScalerProc) {
error("Unknown gfx mode %d", _videoMode.mode);
}
diff --git a/backends/graphics/surfacesdl/surfacesdl-graphics.h b/backends/graphics/surfacesdl/surfacesdl-graphics.h
index 3db2ac6709..68d0cd2b07 100644
--- a/backends/graphics/surfacesdl/surfacesdl-graphics.h
+++ b/backends/graphics/surfacesdl/surfacesdl-graphics.h
@@ -189,6 +189,7 @@ protected:
virtual void handleResizeImpl(const int width, const int height) override;
virtual int getGraphicsModeScale(int mode) const override;
+ virtual ScalerProc *getGraphicsScalerProc(int mode) const override;
#if SDL_VERSION_ATLEAST(2, 0, 0)
/* SDL2 features a different API for 2D graphics. We create a wrapper