aboutsummaryrefslogtreecommitdiff
path: root/image/codecs/indeo/get_bits.cpp
diff options
context:
space:
mode:
authorPaul Gilbert2016-09-05 23:00:08 -0400
committerPaul Gilbert2016-09-10 10:08:10 -0400
commit5f0962696f97df2cce27d065d99b04243de59334 (patch)
tree001c83f1550677226cf264d6dc6a3c9ceaa70e2f /image/codecs/indeo/get_bits.cpp
parent73e79031865a71dd5ced18fe3269f79ceba6e08c (diff)
downloadscummvm-rg350-5f0962696f97df2cce27d065d99b04243de59334.tar.gz
scummvm-rg350-5f0962696f97df2cce27d065d99b04243de59334.tar.bz2
scummvm-rg350-5f0962696f97df2cce27d065d99b04243de59334.zip
IMAGE: Added Indeo4Decoder decodePictureHeader, and lots of dependencies
Diffstat (limited to 'image/codecs/indeo/get_bits.cpp')
-rw-r--r--image/codecs/indeo/get_bits.cpp24
1 files changed, 23 insertions, 1 deletions
diff --git a/image/codecs/indeo/get_bits.cpp b/image/codecs/indeo/get_bits.cpp
index 4878bc674f..98cef7facd 100644
--- a/image/codecs/indeo/get_bits.cpp
+++ b/image/codecs/indeo/get_bits.cpp
@@ -21,6 +21,7 @@
*/
#include "image/codecs/indeo/get_bits.h"
+#include "common/algorithm.h"
#include "common/endian.h"
#include "common/textconsole.h"
@@ -160,14 +161,35 @@ GetBits::GetBits(const byte *buffer, size_t totalBits) {
assert(buffer && totalBits < (INT_MAX - 7));
_buffer = buffer;
+ _disposeAfterUse = DisposeAfterUse::NO;
_sizeInBits = totalBits;
_sizeInBitsPlus8 = totalBits + 8;
_index = 0;
}
+GetBits::GetBits(Common::SeekableReadStream &stream) {
+ byte *buffer = new byte[stream.size()];
+ stream.read(buffer, stream.size());
+ _buffer = buffer;
+ _disposeAfterUse = DisposeAfterUse::YES;
+ _sizeInBits = stream.size() * 8;
+ _sizeInBitsPlus8 = _sizeInBits + 8;
+ _index = 0;
+}
GetBits::GetBits(const GetBits &src) : _index(src._index), _buffer(src._buffer),
- _sizeInBits(src._sizeInBits), _sizeInBitsPlus8(src._sizeInBitsPlus8) {
+ _sizeInBits(src._sizeInBits), _sizeInBitsPlus8(src._sizeInBitsPlus8),
+ _disposeAfterUse(src._disposeAfterUse) {
+ if (_disposeAfterUse == DisposeAfterUse::YES) {
+ byte *buffer = new byte[src._sizeInBits / 8];
+ Common::copy(src._buffer, src._buffer + (src._sizeInBits / 8), buffer);
+ _buffer = buffer;
+ }
+}
+
+GetBits::~GetBits() {
+ if (_disposeAfterUse == DisposeAfterUse::YES)
+ delete[] _buffer;
}
int GetBits::getXbits(int n) {