avoid temporary in QBitmap::operator=()

Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
This commit is contained in:
Ivailo Monev 2020-04-06 01:55:05 +00:00
parent f5af31d53f
commit 4c06eda33c

View file

@ -190,8 +190,7 @@ QBitmap &QBitmap::operator=(const QPixmap &pixmap)
} else if (pixmap.depth() == 1) { // 1-bit pixmap } else if (pixmap.depth() == 1) { // 1-bit pixmap
QPixmap::operator=(pixmap); // shallow assignment QPixmap::operator=(pixmap); // shallow assignment
} else { // n-bit depth pixmap } else { // n-bit depth pixmap
QImage image = pixmap.toImage(); // convert pixmap to image *this = fromImage(pixmap.toImage()); // convert pixmap to image and dither
*this = fromImage(image); // will dither image
} }
return *this; return *this;
} }