diff options
author | Sven Hesse | 2010-08-08 01:00:23 +0000 |
---|---|---|
committer | Sven Hesse | 2010-08-08 01:00:23 +0000 |
commit | b796c39645276958d1e5dcd63ac13d5dde0ab7e8 (patch) | |
tree | 2c960c9a999323d22aefab67fc8dc84e1c79f515 /graphics | |
parent | 506c1e7d85773b2fe7e8a8d69edde7fc8f88fe10 (diff) | |
download | scummvm-rg350-b796c39645276958d1e5dcd63ac13d5dde0ab7e8.tar.gz scummvm-rg350-b796c39645276958d1e5dcd63ac13d5dde0ab7e8.tar.bz2 scummvm-rg350-b796c39645276958d1e5dcd63ac13d5dde0ab7e8.zip |
VIDEO: Implement VMD frame rendering
svn-id: r51905
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/video/coktel_decoder.cpp | 62 | ||||
-rw-r--r-- | graphics/video/coktel_decoder.h | 1 |
2 files changed, 61 insertions, 2 deletions
diff --git a/graphics/video/coktel_decoder.cpp b/graphics/video/coktel_decoder.cpp index 567a51f8d1..c70da85deb 100644 --- a/graphics/video/coktel_decoder.cpp +++ b/graphics/video/coktel_decoder.cpp @@ -476,6 +476,12 @@ void CoktelDecoder::renderBlockSparse2Y(const byte *src, Common::Rect &rect) { } } +void CoktelDecoder::renderBlockRLE(const byte *src, Common::Rect &rect) { + warning("renderBlockRLE"); + + // TODO +} + Common::Rational CoktelDecoder::getFrameRate() const { return _frameRate; } @@ -1948,9 +1954,61 @@ void VMDDecoder::processFrame() { } bool VMDDecoder::renderFrame(Common::Rect &rect) { - // TODO + if (!rect.isValidRect()) + // Invalid rendering area + return false; - return false; + // Clip the rendering area to the video's visible area + rect.clip(Common::Rect(_x, _y, _x + _width, _y + _height)); + if (!rect.isValidRect() || rect.isEmpty()) + // Result is empty => nothing to do + return false; + + if (_externalCodec) { + // TODO + return false; + } + + if (_blitMode > 0) { + // TODO + return false; + } + + byte *dataPtr = _frameData; + + uint8 type = *dataPtr++; + + if (type & 0x80) { + // Frame data is compressed + + type &= 0x7F; + + if ((type == 2) && (rect.width() == _surface.w) && (_x == 0)) { + // Directly uncompress onto the video surface + deLZ77((byte *)_surface.pixels + (_y * _surface.pitch), dataPtr); + return true; + } + + deLZ77(_videoBuffer, dataPtr); + + dataPtr = _videoBuffer; + } + + // Evaluate the block type + if (type == 0x01) + renderBlockSparse (dataPtr, rect); + else if (type == 0x02) + renderBlockWhole (dataPtr, rect); + else if (type == 0x03) + renderBlockRLE (dataPtr, rect); + else if (type == 0x42) + renderBlockWhole4X (dataPtr, rect); + else if ((type & 0x0F) == 0x02) + renderBlockWhole2Y (dataPtr, rect); + else + renderBlockSparse2Y(dataPtr, rect); + + return true; } void VMDDecoder::emptySoundSlice(uint32 size) { diff --git a/graphics/video/coktel_decoder.h b/graphics/video/coktel_decoder.h index f713f39470..48d43962e7 100644 --- a/graphics/video/coktel_decoder.h +++ b/graphics/video/coktel_decoder.h @@ -193,6 +193,7 @@ protected: void renderBlockWhole2Y (const byte *src, Common::Rect &rect); void renderBlockSparse (const byte *src, Common::Rect &rect); void renderBlockSparse2Y(const byte *src, Common::Rect &rect); + void renderBlockRLE (const byte *src, Common::Rect &rect); // Sound helper functions inline void unsignedToSigned(byte *buffer, int length); |