[Scummvm-cvs-logs] SF.net SVN: scummvm:[51905] scummvm/trunk/graphics/video
drmccoy at users.sourceforge.net
drmccoy at users.sourceforge.net
Sun Aug 8 03:00:23 CEST 2010
Revision: 51905
http://scummvm.svn.sourceforge.net/scummvm/?rev=51905&view=rev
Author: drmccoy
Date: 2010-08-08 01:00:23 +0000 (Sun, 08 Aug 2010)
Log Message:
-----------
VIDEO: Implement VMD frame rendering
Modified Paths:
--------------
scummvm/trunk/graphics/video/coktel_decoder.cpp
scummvm/trunk/graphics/video/coktel_decoder.h
Modified: scummvm/trunk/graphics/video/coktel_decoder.cpp
===================================================================
--- scummvm/trunk/graphics/video/coktel_decoder.cpp 2010-08-08 00:59:58 UTC (rev 51904)
+++ scummvm/trunk/graphics/video/coktel_decoder.cpp 2010-08-08 01:00:23 UTC (rev 51905)
@@ -476,6 +476,12 @@
}
}
+void CoktelDecoder::renderBlockRLE(const byte *src, Common::Rect &rect) {
+ warning("renderBlockRLE");
+
+ // TODO
+}
+
Common::Rational CoktelDecoder::getFrameRate() const {
return _frameRate;
}
@@ -1948,9 +1954,61 @@
}
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) {
Modified: scummvm/trunk/graphics/video/coktel_decoder.h
===================================================================
--- scummvm/trunk/graphics/video/coktel_decoder.h 2010-08-08 00:59:58 UTC (rev 51904)
+++ scummvm/trunk/graphics/video/coktel_decoder.h 2010-08-08 01:00:23 UTC (rev 51905)
@@ -193,6 +193,7 @@
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);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list