CCITT fax decoder, finishing

This commit is contained in:
Jakub Melka
2019-10-13 19:02:38 +02:00
parent e20dfe6a5c
commit b1b5780753
4 changed files with 116 additions and 9 deletions

View File

@ -56,10 +56,24 @@ PDFBitReader::Value PDFBitReader::read(PDFBitReader::Value bits)
return value;
}
PDFBitReader::Value PDFBitReader::look(PDFBitReader::Value bits) const
PDFBitReader::Value PDFBitReader::look(Value bits) const
{
PDFBitReader temp(*this);
return temp.read(bits);
Value result = 0;
for (Value i = 0; i < bits; ++i)
{
if (!temp.isAtEnd())
{
result = (result << 1) | temp.read(1);
}
else
{
result = (result << 1);
}
}
return result;
}
void PDFBitReader::seek(qint64 position)