aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorColin Snover2017-05-05 23:05:12 -0500
committerColin Snover2017-05-06 10:38:58 -0500
commit575ed98da1035c0d08338f01b6db6de5e5987214 (patch)
tree16c9e7e5df15904dcf47ba2e98023773e983dbe9 /engines
parentb73e275b42955d95b8728f8c636e42d3373bf8e8 (diff)
downloadscummvm-rg350-575ed98da1035c0d08338f01b6db6de5e5987214.tar.gz
scummvm-rg350-575ed98da1035c0d08338f01b6db6de5e5987214.tar.bz2
scummvm-rg350-575ed98da1035c0d08338f01b6db6de5e5987214.zip
SCI32: Centralize handling of pixel format switches
Diffstat (limited to 'engines')
-rw-r--r--engines/sci/graphics/frameout.h5
-rw-r--r--engines/sci/graphics/video32.cpp14
2 files changed, 9 insertions, 10 deletions
diff --git a/engines/sci/graphics/frameout.h b/engines/sci/graphics/frameout.h
index 650c2c7889..e706f141b2 100644
--- a/engines/sci/graphics/frameout.h
+++ b/engines/sci/graphics/frameout.h
@@ -23,6 +23,7 @@
#ifndef SCI_GRAPHICS_FRAMEOUT_H
#define SCI_GRAPHICS_FRAMEOUT_H
+#include "engines/util.h" // for initGraphics
#include "sci/graphics/plane32.h"
#include "sci/graphics/screen_item32.h"
@@ -284,6 +285,10 @@ private:
}
public:
+ void setPixelFormat(const Graphics::PixelFormat &format) const {
+ initGraphics(_currentBuffer.screenWidth, _currentBuffer.screenHeight, _isHiRes, &format);
+ }
+
/**
* Whether palMorphFrameOut should be used instead of
* frameOut for rendering. Used by kMorphOn to
diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp
index 0a7cd7e6ef..35a92c3ab9 100644
--- a/engines/sci/graphics/video32.cpp
+++ b/engines/sci/graphics/video32.cpp
@@ -26,7 +26,6 @@
#include "common/util.h" // for ARRAYSIZE
#include "common/system.h" // for g_system
#include "engine.h" // for Engine, g_engine
-#include "engines/util.h" // for initGraphics
#include "sci/console.h" // for Console
#include "sci/engine/features.h" // for GameFeatures
#include "sci/engine/state.h" // for EngineState
@@ -286,9 +285,8 @@ void AVIPlayer::init() {
// have a 24bpp mode but just directed VFW to display videos instead)
g_sci->_gfxCursor32->hide();
- const Buffer &currentBuffer = g_sci->_gfxFrameout->getCurrentBuffer();
const Graphics::PixelFormat format = _decoder->getPixelFormat();
- initGraphics(currentBuffer.screenWidth, currentBuffer.screenHeight, g_sci->_gfxFrameout->_isHiRes, &format);
+ g_sci->_gfxFrameout->setPixelFormat(format);
if (_pixelDouble) {
const int16 width = _drawRect.width();
@@ -338,10 +336,8 @@ AVIPlayer::IOStatus AVIPlayer::close() {
_scaleBuffer = nullptr;
if (_decoder->getPixelFormat().bytesPerPixel != 1) {
- const bool isHiRes = g_sci->_gfxFrameout->_isHiRes;
- const Buffer &currentBuffer = g_sci->_gfxFrameout->getCurrentBuffer();
const Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8();
- initGraphics(currentBuffer.screenWidth, currentBuffer.screenHeight, isHiRes, &format);
+ g_sci->_gfxFrameout->setPixelFormat(format);
g_sci->_gfxCursor32->unhide();
}
@@ -986,7 +982,6 @@ void DuckPlayer::open(const GuiResourceId resourceId, const int displayMode, con
g_sci->_gfxFrameout->frameOut(true);
}
- const Buffer &currentBuffer = g_sci->_gfxFrameout->getCurrentBuffer();
const Graphics::PixelFormat format = _decoder->getPixelFormat();
if (_pixelDouble) {
@@ -994,7 +989,7 @@ void DuckPlayer::open(const GuiResourceId resourceId, const int displayMode, con
_scaleBuffer = new byte[_drawRect.width() * _drawRect.height() * format.bytesPerPixel];
}
- initGraphics(currentBuffer.screenWidth, currentBuffer.screenHeight, true, &format);
+ g_sci->_gfxFrameout->setPixelFormat(format);
_status = kDuckOpen;
}
@@ -1049,9 +1044,8 @@ void DuckPlayer::close() {
_decoder->close();
- const Buffer &currentBuffer = g_sci->_gfxFrameout->getCurrentBuffer();
const Graphics::PixelFormat format = Graphics::PixelFormat::createFormatCLUT8();
- initGraphics(currentBuffer.screenWidth, currentBuffer.screenHeight, true, &format);
+ g_sci->_gfxFrameout->setPixelFormat(format);
g_sci->_gfxCursor32->unhide();