Fix DIB image reading.

Position the QIODevice correctly for DIB (==BMP without file
header).

Task-number: QTBUG-26690
Change-Id: I7922b4e830a92dcc19f1b52e305ca9ff3fd5d9f5
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@digia.com>
bb10
Friedemann Kleint 2012-10-02 15:38:29 +02:00 committed by The Qt Project
parent 7c382d81d9
commit a0af0fbcd4
1 changed files with 4 additions and 1 deletions

View File

@ -757,7 +757,10 @@ bool QBmpHandler::read(QImage *image)
s.setByteOrder(QDataStream::LittleEndian);
// read image
if (!read_dib_body(s, infoHeader, fileHeader.bfOffBits, startpos, *image))
const bool readSuccess = m_format == BmpFormat ?
read_dib_body(s, infoHeader, fileHeader.bfOffBits, startpos, *image) :
read_dib_body(s, infoHeader, -1, startpos - BMP_FILEHDR_SIZE, *image);
if (!readSuccess)
return false;
state = Ready;