Minor performance improvement to QLabel with Image
QPixmap::fromImage in QLabel paintEvent should use the rvalue reference overload for efficiency [ChangeLog][QtWidgets][QLabel] Minor performance improvement when painting a label with an image Change-Id: I8ab9bf427c1efc320907c66538e9f8e4011f5586 Reviewed-by: Richard Moe Gustavsen <richard.gustavsen@qt.io>
This commit is contained in:
parent
155ae07b70
commit
98ec8bed19
@ -1098,7 +1098,7 @@ void QLabel::paintEvent(QPaintEvent *)
|
|||||||
QImage scaledImage =
|
QImage scaledImage =
|
||||||
d->cachedimage->scaled(scaledSize,
|
d->cachedimage->scaled(scaledSize,
|
||||||
Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
Qt::IgnoreAspectRatio, Qt::SmoothTransformation);
|
||||||
d->scaledpixmap = new QPixmap(QPixmap::fromImage(scaledImage));
|
d->scaledpixmap = new QPixmap(QPixmap::fromImage(std::move(scaledImage)));
|
||||||
d->scaledpixmap->setDevicePixelRatio(devicePixelRatioF());
|
d->scaledpixmap->setDevicePixelRatio(devicePixelRatioF());
|
||||||
}
|
}
|
||||||
pix = *d->scaledpixmap;
|
pix = *d->scaledpixmap;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user