diff options
author | Sven Hesse | 2010-08-08 01:08:17 +0000 |
---|---|---|
committer | Sven Hesse | 2010-08-08 01:08:17 +0000 |
commit | 1151676d8215f411718a28f2d2f58961560efbd1 (patch) | |
tree | eb90f9b6522cd02f7ca1694f1f73e5fa37741419 | |
parent | 8186214bc9348514c5020f4449cea2ecfb599a8a (diff) | |
download | scummvm-rg350-1151676d8215f411718a28f2d2f58961560efbd1.tar.gz scummvm-rg350-1151676d8215f411718a28f2d2f58961560efbd1.tar.bz2 scummvm-rg350-1151676d8215f411718a28f2d2f58961560efbd1.zip |
VIDEO: Use proper palettes in CoktelDecoder
Not just the 6 bits per color component used in VGA
svn-id: r51921
-rw-r--r-- | engines/gob/videoplayer.cpp | 7 | ||||
-rw-r--r-- | graphics/video/coktel_decoder.cpp | 20 |
2 files changed, 19 insertions, 8 deletions
diff --git a/engines/gob/videoplayer.cpp b/engines/gob/videoplayer.cpp index 0d72751c87..9e49bfc092 100644 --- a/engines/gob/videoplayer.cpp +++ b/engines/gob/videoplayer.cpp @@ -749,8 +749,11 @@ void VideoPlayer::copyPalette(const Video &video, int16 palStart, int16 palEnd) if (palEnd < 0) palEnd = 255; - memcpy(((char *)(_vm->_global->_pPaletteDesc->vgaPal)) + palStart * 3, - video.decoder->getPalette() + palStart * 3, (palEnd - palStart + 1) * 3); + palStart = palStart * 3; + palEnd = (palEnd + 1) * 3; + + for (int i = palStart; i <= palEnd; i++) + ((char *)(_vm->_global->_pPaletteDesc->vgaPal))[i] = video.decoder->getPalette()[i] >> 2; } } // End of namespace Gob diff --git a/graphics/video/coktel_decoder.cpp b/graphics/video/coktel_decoder.cpp index ac0622f739..30ca157406 100644 --- a/graphics/video/coktel_decoder.cpp +++ b/graphics/video/coktel_decoder.cpp @@ -916,7 +916,8 @@ bool IMDDecoder::load(Common::SeekableReadStream *stream) { _features |= kFeaturesPalette; // Palette - _stream->read((byte *)_palette, 768); + for (int i = 0; i < 768; i++) + _palette[i] = _stream->readByte() << 2; _paletteDirty = true; @@ -1194,7 +1195,9 @@ void IMDDecoder::processFrame() { _paletteDirty = true; - _stream->read(_palette, 768); + for (int i = 0; i < 768; i++) + _palette[i] = _stream->readByte() << 2; + cmd = _stream->readUint16LE(); } @@ -1307,8 +1310,10 @@ bool IMDDecoder::renderFrame(Common::Rect &rect) { // One byte index int index = *dataPtr++; - // 16 entries with each 3 bytes (RGB) - memcpy(_palette + index * 3, dataPtr, MIN((255 - index) * 3, 48)); + + int count = MIN((255 - index) * 3, 48); + for (int i = 0; i < count; i++) + _palette[index * 3 + i] = dataPtr[i] << 2; dataPtr += 48; type ^= 0x10; @@ -1605,7 +1610,8 @@ bool VMDDecoder::load(Common::SeekableReadStream *stream) { _videoCodec = _stream->readUint32BE(); if (_features & kFeaturesPalette) { - _stream->read((byte *)_palette, 768); + for (int i = 0; i < 768; i++) + _palette[i] = _stream->readByte() << 2; _paletteDirty = true; } @@ -2011,7 +2017,9 @@ void VMDDecoder::processFrame() { uint8 index = _stream->readByte(); uint8 count = _stream->readByte(); - _stream->read(_palette + index * 3, (count + 1) * 3); + for (int j = 0; j < ((count + 1) * 3); j++) + _palette[index * 3 + j] = _stream->readByte() << 2; + _stream->skip((255 - count) * 3); _paletteDirty = true; |