diff options
author | Sven Hesse | 2010-08-08 00:39:03 +0000 |
---|---|---|
committer | Sven Hesse | 2010-08-08 00:39:03 +0000 |
commit | f7363fdb10675bf27c1a1d37d23a25590bdc344c (patch) | |
tree | f439caf375108dd25a9c2fe11a296ce225d8b4ca /graphics/video | |
parent | 12c9e895b559d1ca2780b5b8f156b0451eb11f11 (diff) | |
download | scummvm-rg350-f7363fdb10675bf27c1a1d37d23a25590bdc344c.tar.gz scummvm-rg350-f7363fdb10675bf27c1a1d37d23a25590bdc344c.tar.bz2 scummvm-rg350-f7363fdb10675bf27c1a1d37d23a25590bdc344c.zip |
VIDEO/GOB: Add CoktelDecoder::getDirtyRects()
This allows for the client code to only update the parts of the
video frames that actually changed.
svn-id: r51859
Diffstat (limited to 'graphics/video')
-rw-r--r-- | graphics/video/coktel_decoder.cpp | 10 | ||||
-rw-r--r-- | graphics/video/coktel_decoder.h | 16 |
2 files changed, 17 insertions, 9 deletions
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(); |