Skip to content

Commit

Permalink
QImageIO: use the new allocation checker in the format handlers
Browse files Browse the repository at this point in the history
Change-Id: I604d99ce476d4758a1e20b78257082911f1f1546
Task-number: QTBUG-85037
Reviewed-by: Lars Knoll <lars.knoll@qt.io>
  • Loading branch information
aavit committed Jun 26, 2020
1 parent 5dea4fe commit 1a63409

File 4 of 8 in 1a63409

7 changes: 2 additions & 5 deletions src/gui/image/qxbmhandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,11 +147,8 @@ static bool read_xbm_body(QIODevice *device, int w, int h, QImage *outImage)
p = strstr(buf, "0x");
} while (!p);

if (outImage->size() != QSize(w, h) || outImage->format() != QImage::Format_MonoLSB) {
*outImage = QImage(w, h, QImage::Format_MonoLSB);
if (outImage->isNull())
return false;
}
if (!QImageIOHandler::allocateImage(QSize(w, h), QImage::Format_MonoLSB, outImage))
return false;

outImage->fill(Qt::color0); // in case the image data does not cover the full image

Expand Down
Loading

0 comments on commit 1a63409

Please sign in to comment.