diff options
-rw-r--r-- | engines/gob/demos/demoplayer.cpp | 2 | ||||
-rw-r--r-- | engines/gob/videoplayer.cpp | 12 | ||||
-rw-r--r-- | graphics/video/coktel_decoder.cpp | 10 | ||||
-rw-r--r-- | graphics/video/coktel_decoder.h | 16 |
4 files changed, 25 insertions, 15 deletions
diff --git a/engines/gob/demos/demoplayer.cpp b/engines/gob/demos/demoplayer.cpp index 0782e84a84..cd3e97d7f0 100644 --- a/engines/gob/demos/demoplayer.cpp +++ b/engines/gob/demos/demoplayer.cpp @@ -226,6 +226,7 @@ void DemoPlayer::playVideoDoubled() { for (uint i = 0; i < _vm->_vidPlayer->getFrameCount(); i++) { // _vm->_vidPlayer->playFrame(i); + /* Graphics::CoktelDecoder::State state;// = _vm->_vidPlayer->getState(); int16 w = state.right - state.left + 1; @@ -237,6 +238,7 @@ void DemoPlayer::playVideoDoubled() { state.left, state.top, state.right, state.bottom, state.left, state.top, 0); _vm->_draw->dirtiedRect(_vm->_draw->_frontSurface, state.left * 2, state.top * 2, wD, hD); + */ _vm->_video->retrace(); _vm->_util->processInput(); diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index d126d0e963..587f640f28 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -307,23 +307,23 @@ bool VideoPlayer::playFrame(int slot, Properties &properties) { } */ + const Common::List<Common::Rect> &dirtyRects = video->decoder->getDirtyRects(); + if (modifiedPal && (properties.palCmd == 8) && (properties.sprite == Draw::kBackSurface)) _vm->_video->setFullPalette(_vm->_global->_pPaletteDesc); if (properties.sprite == Draw::kBackSurface) { - _vm->_draw->invalidateRect(properties.x, properties.y, - properties.x + video->decoder->getWidth(), - properties.y + video->decoder->getHeight()); + for (Common::List<Common::Rect>::const_iterator rect = dirtyRects.begin(); rect != dirtyRects.end(); ++rect) + _vm->_draw->invalidateRect(rect->left, rect->top, rect->right - 1, rect->bottom - 1); _vm->_draw->blitInvalidated(); // if (!noRetrace) _vm->_video->retrace(); } else if (properties.sprite == Draw::kFrontSurface) { - _vm->_video->dirtyRectsAdd(properties.x, properties.y, - properties.x + video->decoder->getWidth(), - properties.y + video->decoder->getHeight()); + for (Common::List<Common::Rect>::const_iterator rect = dirtyRects.begin(); rect != dirtyRects.end(); ++rect) + _vm->_video->dirtyRectsAdd(rect->left, rect->top, rect->right - 1, rect->bottom - 1); // if (!noRetrace) _vm->_video->retrace(); diff --git a/graphics/video/coktel_decoder.cpp b/graphics/video/coktel_decoder.cpp index 6f846c9a07..a9a2e157a3 100644 --- a/graphics/video/coktel_decoder.cpp +++ b/graphics/video/coktel_decoder.cpp @@ -29,7 +29,7 @@ namespace Graphics { -CoktelDecoder::State::State() : left(0), top(0), right(0), bottom(0), flags(0), speechId(0) { +CoktelDecoder::State::State() : flags(0), speechId(0) { } @@ -97,6 +97,10 @@ void CoktelDecoder::setXY(uint16 x, uint16 y) { _y = y; } +const Common::List<Common::Rect> &CoktelDecoder::getDirtyRects() const { + return _dirtyRects; +} + void CoktelDecoder::close() { freeSurface(); @@ -299,6 +303,8 @@ void PreIMDDecoder::processFrame() { } void PreIMDDecoder::renderFrame() { + _dirtyRects.clear(); + uint16 w = CLIP<int32>(_surface.w - _x, 0, _width); uint16 h = CLIP<int32>(_surface.h - _y, 0, _height); @@ -317,6 +323,8 @@ void PreIMDDecoder::renderFrame() { frameDataSize -= n; } + + _dirtyRects.push_back(Common::Rect(_x, _y, _x + _width, _y + _height)); } PixelFormat PreIMDDecoder::getPixelFormat() const { diff --git a/graphics/video/coktel_decoder.h b/graphics/video/coktel_decoder.h index a4d12c5294..ea405974d6 100644 --- a/graphics/video/coktel_decoder.h +++ b/graphics/video/coktel_decoder.h @@ -33,6 +33,9 @@ #ifndef GRAPHICS_VIDEO_COKTELDECODER_H #define GRAPHICS_VIDEO_COKTELDECODER_H +#include "common/list.h" +#include "common/rect.h" + #include "graphics/video/video_decoder.h" #include "sound/mixer.h" @@ -42,14 +45,6 @@ namespace Graphics { class CoktelDecoder : public FixedRateVideoDecoder { public: struct State { - /** Left-most value of the updated rectangle. */ - int16 left; - /** Top-most value of the updated rectangle. */ - int16 top; - /** Right-most value of the updated rectangle. */ - int16 right; - /** Bottom-most value of the updated rectangle. */ - int16 bottom; /** Set accordingly to what was done. */ uint32 flags; /** The id of the spoken words. */ @@ -72,6 +67,9 @@ public: /** Draw the video starting at this position within the video memory. */ void setXY(uint16 x, uint16 y); + /** Return a list of rectangles that changed in the last frame. */ + const Common::List<Common::Rect> &getDirtyRects() const; + // VideoDecoder interface void close(); @@ -102,6 +100,8 @@ protected: bool _ownSurface; Surface _surface; + Common::List<Common::Rect> _dirtyRects; + Common::Rational _frameRate; bool hasSurface(); |