aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics
diff options
context:
space:
mode:
authorCameron Cawley2019-07-26 20:33:50 +0100
committerFilippos Karapetis2019-07-27 07:11:57 +0300
commitecd89808c49941323cca84724c1a26dfe26ce10f (patch)
tree14f3a85899ac90a6b8e107d3e77fbd4f21b0a7df /backends/graphics
parentf1761567355b13ec5fb6ef83ec4ee1ea35334067 (diff)
downloadscummvm-rg350-ecd89808c49941323cca84724c1a26dfe26ce10f.tar.gz
scummvm-rg350-ecd89808c49941323cca84724c1a26dfe26ce10f.tar.bz2
scummvm-rg350-ecd89808c49941323cca84724c1a26dfe26ce10f.zip
BACKENDS: Avoid redundant format changes on Dingux and LinuxMoto
Diffstat (limited to 'backends/graphics')
-rw-r--r--backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp18
-rw-r--r--backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp21
-rw-r--r--backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h2
3 files changed, 38 insertions, 3 deletions
diff --git a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
index 5e86a2be11..f3061824dc 100644
--- a/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
+++ b/backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp
@@ -101,6 +101,24 @@ void DINGUXSdlGraphicsManager::setGraphicsModeIntern() {
void DINGUXSdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) {
assert(_transactionMode == kTransactionActive);
+#ifdef USE_RGB_COLOR
+ // Avoid redundant format changes
+ Graphics::PixelFormat newFormat;
+ if (!format)
+ newFormat = Graphics::PixelFormat::createFormatCLUT8();
+ else
+ newFormat = *format;
+
+ assert(newFormat.bytesPerPixel > 0);
+
+ if (newFormat != _videoMode.format) {
+ _videoMode.format = newFormat;
+ _transactionDetails.formatChanged = true;
+ _screenFormat = newFormat;
+ }
+#endif
+
+
// Avoid redundant res changes
if ((int)w == _videoMode.screenWidth && (int)h == _videoMode.screenHeight)
return;
diff --git a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp
index b36136c422..7ca4202045 100644
--- a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp
+++ b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.cpp
@@ -100,10 +100,27 @@ void LinuxmotoSdlGraphicsManager::setGraphicsModeIntern() {
blitCursor();
}
-
-void LinuxmotoSdlGraphicsManager::initSize(uint w, uint h) {
+void LinuxmotoSdlGraphicsManager::initSize(uint w, uint h, const Graphics::PixelFormat *format) {
assert(_transactionMode == kTransactionActive);
+#ifdef USE_RGB_COLOR
+ // Avoid redundant format changes
+ Graphics::PixelFormat newFormat;
+ if (!format)
+ newFormat = Graphics::PixelFormat::createFormatCLUT8();
+ else
+ newFormat = *format;
+
+ assert(newFormat.bytesPerPixel > 0);
+
+ if (newFormat != _videoMode.format) {
+ _videoMode.format = newFormat;
+ _transactionDetails.formatChanged = true;
+ _screenFormat = newFormat;
+ }
+#endif
+
+
// Avoid redundant res changes
if ((int)w == _videoMode.screenWidth && (int)h == _videoMode.screenHeight)
return;
diff --git a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h
index e48cff35e6..cc2af5ff0c 100644
--- a/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h
+++ b/backends/graphics/linuxmotosdl/linuxmotosdl-graphics.h
@@ -29,7 +29,7 @@ class LinuxmotoSdlGraphicsManager : public SurfaceSdlGraphicsManager {
public:
LinuxmotoSdlGraphicsManager(SdlEventSource *sdlEventSource, SdlWindow *window);
- virtual void initSize(uint w, uint h) override;
+ virtual void initSize(uint w, uint h, const Graphics::PixelFormat *format = NULL) override;
virtual void setGraphicsModeIntern() override;
virtual int getGraphicsModeScale(int mode) const override;
virtual void internUpdateScreen() override;