aboutsummaryrefslogtreecommitdiff
path: root/backends/graphics/dinguxsdl
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/dinguxsdl
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/dinguxsdl')
-rw-r--r--backends/graphics/dinguxsdl/dinguxsdl-graphics.cpp18
1 files changed, 18 insertions, 0 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;