diff options
author | Cameron Cawley | 2019-07-26 20:33:50 +0100 |
---|---|---|
committer | Filippos Karapetis | 2019-07-27 07:11:57 +0300 |
commit | ecd89808c49941323cca84724c1a26dfe26ce10f (patch) | |
tree | 14f3a85899ac90a6b8e107d3e77fbd4f21b0a7df /backends/graphics/dinguxsdl | |
parent | f1761567355b13ec5fb6ef83ec4ee1ea35334067 (diff) | |
download | scummvm-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.cpp | 18 |
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; |