diff options
author | Colin Snover | 2017-08-04 23:46:13 -0500 |
---|---|---|
committer | Colin Snover | 2017-09-03 20:58:07 -0500 |
commit | 7545bb7133099400245ef5db5cecc015e57acd56 (patch) | |
tree | b9d35674c329fd232c64d23b7bab05975137a5f3 /engines/sci/graphics/video32.cpp | |
parent | 43a07abb46cc55d09f7415090f9f53c068c856aa (diff) | |
download | scummvm-rg350-7545bb7133099400245ef5db5cecc015e57acd56.tar.gz scummvm-rg350-7545bb7133099400245ef5db5cecc015e57acd56.tar.bz2 scummvm-rg350-7545bb7133099400245ef5db5cecc015e57acd56.zip |
SCI32: Clip videos to the screen
This is needed for 8.VMD in Lighthouse (room 380, the credits
room), which is rendered partially off the bottom of the screen.
OSystem does not accept rects that are offscreen.
Technically this video probably should not have been doubled
vertically by game scripts, but there is not enough space to fix
the rendering with a regular script patch, and it is a very
unimportant video.
Diffstat (limited to 'engines/sci/graphics/video32.cpp')
-rw-r--r-- | engines/sci/graphics/video32.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/engines/sci/graphics/video32.cpp b/engines/sci/graphics/video32.cpp index 2b1f7219fd..c9c48eb9fd 100644 --- a/engines/sci/graphics/video32.cpp +++ b/engines/sci/graphics/video32.cpp @@ -252,7 +252,7 @@ void VideoPlayer::renderFrame(const Graphics::Surface &nextFrame) const { freeConvertedFrame = true; } - g_system->copyRectToScreen(convertedFrame->getPixels(), convertedFrame->pitch, _drawRect.left, _drawRect.top, convertedFrame->w, convertedFrame->h); + g_system->copyRectToScreen(convertedFrame->getPixels(), convertedFrame->pitch, _drawRect.left, _drawRect.top, _drawRect.width(), _drawRect.height()); g_sci->_gfxFrameout->updateScreen(); if (freeConvertedFrame) { @@ -285,6 +285,14 @@ void VideoPlayer::renderLQToSurface(Graphics::Surface &out, const Graphics::Surf } } +void VideoPlayer::setDrawRect(const int16 x, const int16 y, const int16 width, const int16 height) { + _drawRect = Common::Rect(x, y, x + width, y + height); + if (_drawRect.right > g_system->getWidth() || _drawRect.bottom > g_system->getHeight()) { + warning("Draw rect (%d, %d, %d, %d) is out of bounds of the screen; clipping it", PRINT_RECT(_drawRect)); + _drawRect.clip(g_system->getWidth(), g_system->getHeight()); + } +} + #pragma mark SEQPlayer SEQPlayer::SEQPlayer(EventManager *eventMan) : @@ -566,10 +574,9 @@ void VMDPlayer::init(int16 x, const int16 y, const PlayFlags flags, const int16 #endif _stretchVertical = flags & kPlayFlagStretchVertical; - _drawRect = Common::Rect(x, - y, - x + (_decoder->getWidth() << _doublePixels), - y + (_decoder->getHeight() << (_doublePixels || _stretchVertical))); + setDrawRect(x, y, + (_decoder->getWidth() << _doublePixels), + (_decoder->getHeight() << (_doublePixels || _stretchVertical))); } VMDPlayer::IOStatus VMDPlayer::close() { @@ -1010,9 +1017,9 @@ void DuckPlayer::open(const GuiResourceId resourceId, const int displayMode, con // SSCI seems to incorrectly calculate the draw rect by scaling the origin // in addition to the width/height for the BR point - _drawRect = Common::Rect(x, y, - x + (_decoder->getWidth() << _doublePixels), - y + (_decoder->getHeight() << _doublePixels)); + setDrawRect(x, y, + (_decoder->getWidth() << _doublePixels), + (_decoder->getHeight() << _doublePixels)); g_sci->_gfxCursor32->hide(); |