xbm image format: avoid uninitialized pixels for truncated data
xbm bitmaps are conventionally accepted as valid even if there is not enough data to fill the declared bitmap size: both ImageMagick and GIMP do this. Qt did too, but the uncovered areas would be uninitialized, and thus contain random junk bits. This commit adds clearing of the full QImage data. Task-number: QTBUG-54169 Change-Id: I84150d54d07dbd546a4947e7ec332f83f2d7ca41 Reviewed-by: Paul Olav Tvete <paul.tvete@qt.io>
This commit is contained in:
parent
05a71c6c7f
commit
901ed36f36
@ -143,6 +143,8 @@ static bool read_xbm_body(QIODevice *device, int w, int h, QImage *outImage)
|
||||
return false;
|
||||
}
|
||||
|
||||
outImage->fill(Qt::color0); // in case the image data does not cover the full image
|
||||
|
||||
outImage->setColorCount(2);
|
||||
outImage->setColor(0, qRgb(255,255,255)); // white
|
||||
outImage->setColor(1, qRgb(0,0,0)); // black
|
||||
|
Loading…
Reference in New Issue
Block a user