diff options
author | Paul Gilbert | 2014-02-04 00:20:24 -0500 |
---|---|---|
committer | Paul Gilbert | 2014-02-04 00:20:24 -0500 |
commit | 07f57ac65076d5b303e308b154c9fdc0326dacc9 (patch) | |
tree | f7fb627355935bb8e2dc0144eeab9b19defe3a76 /engines | |
parent | bb37927afdd155d78ca5f9f896e8857423da459c (diff) | |
download | scummvm-rg350-07f57ac65076d5b303e308b154c9fdc0326dacc9.tar.gz scummvm-rg350-07f57ac65076d5b303e308b154c9fdc0326dacc9.tar.bz2 scummvm-rg350-07f57ac65076d5b303e308b154c9fdc0326dacc9.zip |
VOYEUR: Simplified reference to audio and video tracks in the RL2Decoder
Diffstat (limited to 'engines')
-rw-r--r-- | engines/voyeur/animation.cpp | 41 | ||||
-rw-r--r-- | engines/voyeur/animation.h | 6 |
2 files changed, 15 insertions, 32 deletions
diff --git a/engines/voyeur/animation.cpp b/engines/voyeur/animation.cpp index 8206707bc5..ca924d3b2b 100644 --- a/engines/voyeur/animation.cpp +++ b/engines/voyeur/animation.cpp @@ -71,14 +71,15 @@ bool RL2Decoder::loadStream(Common::SeekableReadStream *stream) { } // Add an audio track if sound is present - RL2AudioTrack *audioTrack = NULL; + _audioTrack = nullptr; if (_header._soundRate) { - audioTrack = new RL2AudioTrack(_header, stream, _soundType); - addTrack(audioTrack); + _audioTrack = new RL2AudioTrack(_header, stream, _soundType); + addTrack(_audioTrack); } // Create a video track - addTrack(new RL2VideoTrack(_header, audioTrack, stream)); + _videoTrack = new RL2VideoTrack(_header, _audioTrack, stream); + addTrack(_videoTrack); // Load the offset/sizes of the video's audio data _soundFrames.reserve(_header._numFrames); @@ -93,40 +94,20 @@ bool RL2Decoder::loadStream(Common::SeekableReadStream *stream) { } const Common::List<Common::Rect> *RL2Decoder::getDirtyRects() const { - const Track *track = getTrack(1); - - if (track) - return ((const RL2VideoTrack *)track)->getDirtyRects(); + if (_videoTrack) + return _videoTrack->getDirtyRects(); return 0; } void RL2Decoder::clearDirtyRects() { - Track *track = getTrack(1); - - if (track) - ((RL2VideoTrack *)track)->clearDirtyRects(); + if (_videoTrack) + _videoTrack->clearDirtyRects(); } void RL2Decoder::copyDirtyRectsToBuffer(uint8 *dst, uint pitch) { - Track *track = getTrack(1); - - if (track) - ((RL2VideoTrack *)track)->copyDirtyRectsToBuffer(dst, pitch); -} - -RL2Decoder::RL2VideoTrack *RL2Decoder::getVideoTrack() { - Track *track = getTrack(1); - assert(track); - - return (RL2VideoTrack *)track; -} - -RL2Decoder::RL2AudioTrack *RL2Decoder::getAudioTrack() { - Track *track = getTrack(0); - assert(track); - - return (RL2AudioTrack *)track; + if (_videoTrack) + _videoTrack->copyDirtyRectsToBuffer(dst, pitch); } void RL2Decoder::readNextPacket() { diff --git a/engines/voyeur/animation.h b/engines/voyeur/animation.h index 8ebebaaada..b8f0c57832 100644 --- a/engines/voyeur/animation.h +++ b/engines/voyeur/animation.h @@ -150,6 +150,8 @@ private: }; private: + RL2AudioTrack *_audioTrack; + RL2VideoTrack *_videoTrack; Common::SeekableReadStream *_fileStream; Audio::Mixer::SoundType _soundType; RL2FileHeader _header; @@ -171,8 +173,8 @@ public: const Common::List<Common::Rect> *getDirtyRects() const; void clearDirtyRects(); void copyDirtyRectsToBuffer(uint8 *dst, uint pitch); - RL2VideoTrack *getVideoTrack(); - RL2AudioTrack *getAudioTrack(); + RL2VideoTrack *getVideoTrack() { return _videoTrack; } + RL2AudioTrack *getAudioTrack() { return _audioTrack; } int getPaletteStart() const { return _paletteStart; } int getPaletteCount() const { return _header._colorCount; } const RL2FileHeader &getHeader() { return _header; } |