From a0af0fbcd4a41fb7be6abf558296682182cdffa0 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 2 Oct 2012 15:38:29 +0200 Subject: 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 --- src/gui/image/qbmphandler.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/gui/image/qbmphandler.cpp b/src/gui/image/qbmphandler.cpp index 600a24ec24..49aeee6d7b 100644 --- a/src/gui/image/qbmphandler.cpp +++ b/src/gui/image/qbmphandler.cpp @@ -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; -- cgit v1.2.3