Revert "fix recursion in case QBitmap is constructed with null pixmap"

This reverts commit 66f787ee62.
This commit is contained in:
Ivailo Monev 2019-05-26 16:16:00 +00:00
parent a171ef7d91
commit d7d4e5fda1

View file

@ -192,7 +192,16 @@ QBitmap::QBitmap(const QString& fileName, const char *format)
QBitmap &QBitmap::operator=(const QPixmap &pixmap)
{
*this = fromImage(pixmap.toImage());
if (pixmap.isNull()) { // a null pixmap
QBitmap bm(0, 0);
QBitmap::operator=(bm);
} else if (pixmap.depth() == 1) { // 1-bit pixmap
QPixmap::operator=(pixmap); // shallow assignment
} else { // n-bit depth pixmap
QImage image;
image = pixmap.toImage(); // convert pixmap to image
*this = fromImage(image); // will dither image
}
return *this;
}