VOYEUR: Fixes for decoding RL2 videos with transparency

This commit is contained in:
Paul Gilbert 2014-01-03 18:09:19 -10:00
parent 3672e3fa16
commit 7d9680058a
3 changed files with 10 additions and 9 deletions

View File

@ -355,9 +355,9 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithTransparency(int screenOffset)
++screenOffset;
--frameSize;
} else if (nextByte < 0x80) {
// Raw byte to copy to output
// Single 7-bit pixel to output (128-255)
assert(frameSize > 0);
destP[screenOffset] = nextByte;
destP[screenOffset] = nextByte | 0x80;
++screenOffset;
--frameSize;
} else if (nextByte == 0x80) {
@ -374,7 +374,6 @@ void RL2Decoder::RL2VideoTrack::rl2DecodeFrameWithTransparency(int screenOffset)
} else {
// Run length of a single pixel value
int runLength = _fileStream->readByte();
nextByte &= 0x7f;
runLength = MIN(runLength, frameSize);
Common::fill(destP + screenOffset, destP + screenOffset + runLength, nextByte);

View File

@ -157,6 +157,7 @@ public:
void copyDirtyRectsToBuffer(uint8 *dst, uint pitch);
RL2VideoTrack *getVideoTrack();
void play(::Voyeur::VoyeurEngine *vm);
int getPaletteCount() const { return _header._colorCount; }
};
} // End of namespace Video

View File

@ -564,11 +564,6 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
while (!shouldQuit() && !decoder.endOfVideo() && !_eventsManager._mouseClicked &&
(decoder.getCurFrame() < endFrame)) {
if (decoder.hasDirtyPalette()) {
const byte *palette = decoder.getPalette();
_graphicsManager.setPalette(palette, 0, 256);
}
if (decoder.needsUpdate()) {
const Graphics::Surface *frame = decoder.decodeNextFrame();
@ -576,7 +571,13 @@ void VoyeurEngine::playAVideoDuration(int videoId, int duration) {
(byte *)_graphicsManager._screenSurface.getPixels());
}
_eventsManager.pollEvents();
if (decoder.hasDirtyPalette()) {
const byte *palette = decoder.getPalette();
_graphicsManager.setPalette(palette, 0, decoder.getPaletteCount());
_graphicsManager.setOneColor(128, 220, 20, 20);
}
_eventsManager.getMouseInfo();
g_system->delayMillis(10);
}