Skip to content

Commit

Permalink
ACCESS: Dirty rect handling for conversation videos
Browse files Browse the repository at this point in the history
  • Loading branch information
dreammaster committed Dec 14, 2014
1 parent 310853a commit 2cdd053
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
3 changes: 2 additions & 1 deletion engines/access/screen.cpp
Expand Up @@ -251,7 +251,8 @@ void Screen::copyBlock(ASurface *src, const Common::Rect &bounds) {
}

void Screen::restoreBlock() {
addDirtyRect(_savedBounds);
if (!_savedBounds.isEmpty())
addDirtyRect(_savedBounds);
ASurface::restoreBlock();
}

Expand Down
10 changes: 9 additions & 1 deletion engines/access/video.cpp
Expand Up @@ -60,6 +60,7 @@ void VideoPlayer::setVideo(ASurface *vidSurface, const Common::Point &pt, const
_xCount = _header._width;
_scanCount = _header._height;
_videoFrame = 0;
_videoBounds = Common::Rect(pt.x, pt.y, pt.x + _header._width, pt.y + _header._height);

getFrame();

Expand Down Expand Up @@ -133,6 +134,10 @@ void VideoPlayer::playVideo() {
}
}

// If the video is playing on the screen surface, add a dirty rect
if (_vidSurface == _vm->_screen)
_vm->_screen->addDirtyRect(_videoBounds);

getFrame();
if (++_videoFrame == _frameCount) {
closeVideo();
Expand All @@ -142,14 +147,16 @@ void VideoPlayer::playVideo() {

void VideoPlayer::copyVideo() {
_vm->_player->calcPlayer();

// Figure out the dirty rect area for the video frame
Common::Rect r = Common::Rect(_vm->_vidX - _vm->_screen->_bufferStart.x,
_vm->_vidY - _vm->_screen->_bufferStart.y,
_vm->_vidX - _vm->_screen->_bufferStart.x + _header._width,
_vm->_vidY - _vm->_screen->_bufferStart.y + _header._height);
if (!_vm->_screen->clip(r))
return;

_vm->_newRects.push_back(r);

int vh = _header._height;
int vw = _header._width;
int destIdx = _vm->_vidX - _vm->_screen->_bufferStart.x;
Expand All @@ -165,4 +172,5 @@ void VideoPlayer::copyVideo() {
destP += _vm->_buffer2.pitch;
}
}

} // End of namespace Access
1 change: 1 addition & 0 deletions engines/access/video.h
Expand Up @@ -48,6 +48,7 @@ class VideoPlayer: public Manager {
int _xCount;
int _scanCount;
int _frameSize;
Common::Rect _videoBounds;

void getFrame();
public:
Expand Down

0 comments on commit 2cdd053

Please sign in to comment.