diff options
author | richiesams | 2013-07-11 17:02:14 -0500 |
---|---|---|
committer | richiesams | 2013-08-04 13:32:15 -0500 |
commit | ae84e9508e846e7cfd39652f74c0816b399409e7 (patch) | |
tree | 9ce48630abb36f45dc340d2873b8604e01d6ed97 | |
parent | 29061acd4ebeef2686b2ee2ff9c97d6ee4f11e91 (diff) | |
download | scummvm-rg350-ae84e9508e846e7cfd39652f74c0816b399409e7.tar.gz scummvm-rg350-ae84e9508e846e7cfd39652f74c0816b399409e7.tar.bz2 scummvm-rg350-ae84e9508e846e7cfd39652f74c0816b399409e7.zip |
ZVISION: Add 2x scaling to videos
-rw-r--r-- | engines/zvision/video.cpp | 18 | ||||
-rw-r--r-- | engines/zvision/zvision.cpp | 1 | ||||
-rw-r--r-- | engines/zvision/zvision.h | 1 |
3 files changed, 14 insertions, 6 deletions
diff --git a/engines/zvision/video.cpp b/engines/zvision/video.cpp index b5e9fa098c..0cca486af6 100644 --- a/engines/zvision/video.cpp +++ b/engines/zvision/video.cpp @@ -79,7 +79,10 @@ void ZVision::startVideo(Video::VideoDecoder *videoDecoder) { Common::List<Graphics::PixelFormat> formats; formats.push_back(videoDecoder->getPixelFormat()); - initGraphics(640, 480, true, formats); + initGraphics(_width, _height, true, formats); + + _scaledVideoFrameBuffer = new byte[_currentVideo->getWidth() * _currentVideo->getHeight() * _currentVideo->getPixelFormat().bytesPerPixel * 4]; + _currentVideo->start(); // Load the first frame @@ -95,17 +98,18 @@ void ZVision::continueVideo() { byte bytesPerPixel = _currentVideo->getPixelFormat().bytesPerPixel; uint16 width = _currentVideo->getWidth(); uint16 height = _currentVideo->getHeight(); - uint16 pitch = _currentVideo->getWidth() * bytesPerPixel; + uint16 pitch = width * bytesPerPixel; - uint16 x = (_system->getWidth() - width) / 2; - uint16 y = (_system->getWidth() - height) / 2; + uint16 x = (_system->getWidth() - (width * 2)) / 2; + uint16 y = (_system->getHeight() - (height * 2)) / 2; if (!_currentVideo->endOfVideo()) { if (_currentVideo->needsUpdate()) { const Graphics::Surface *frame = _currentVideo->decodeNextFrame(); - if (frame) { - _system->copyRectToScreen(frame->pixels, pitch, x, y, width, height); + if (frame) { + scale2x(static_cast<byte *>(frame->pixels), _scaledVideoFrameBuffer, width, height, bytesPerPixel); + _system->copyRectToScreen(_scaledVideoFrameBuffer, pitch * 2, x, y, width * 2, height * 2); _needsScreenUpdate = true; } @@ -114,6 +118,8 @@ void ZVision::continueVideo() { initGraphics(_width, _height, true, &_pixelFormat); delete _currentVideo; _currentVideo = 0; + delete _scaledVideoFrameBuffer; + _scaledVideoFrameBuffer = 0; } } diff --git a/engines/zvision/zvision.cpp b/engines/zvision/zvision.cpp index c126a9ad7c..475a453c08 100644 --- a/engines/zvision/zvision.cpp +++ b/engines/zvision/zvision.cpp @@ -46,6 +46,7 @@ ZVision::ZVision(OSystem *syst, const ZVisionGameDescription *gameDesc) _gameDescription(gameDesc), _pixelFormat(2, 5, 5, 5, 0, 10, 5, 0, 0), // RGB555 _currentVideo(0), + _scaledVideoFrameBuffer(0), _width(640), _height(480) { // Put your engine in a sane state, but do nothing big yet; diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h index 7f5b8e3a86..50394a6070 100644 --- a/engines/zvision/zvision.h +++ b/engines/zvision/zvision.h @@ -69,6 +69,7 @@ private: bool _needsScreenUpdate; Video::VideoDecoder *_currentVideo; + byte *_scaledVideoFrameBuffer; public: uint32 getFeatures() const; Common::Language getLanguage() const; |