mirror of
https://bitbucket.org/smil3y/katie.git
synced 2025-02-23 18:32:55 +00:00
do not create QImage in addition to QPixmap in QLabel
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
783b4e90e9
commit
ec682f91f2
2 changed files with 1 additions and 9 deletions
|
@ -41,7 +41,6 @@ QLabelPrivate::QLabelPrivate()
|
||||||
margin(0),
|
margin(0),
|
||||||
pixmap(nullptr),
|
pixmap(nullptr),
|
||||||
scaledpixmap(nullptr),
|
scaledpixmap(nullptr),
|
||||||
cachedimage(nullptr),
|
|
||||||
align(Qt::AlignLeft | Qt::AlignVCenter),
|
align(Qt::AlignLeft | Qt::AlignVCenter),
|
||||||
indent(-1),
|
indent(-1),
|
||||||
scaledcontents(false),
|
scaledcontents(false),
|
||||||
|
@ -990,10 +989,8 @@ void QLabel::paintEvent(QPaintEvent *ev)
|
||||||
QPixmap pix;
|
QPixmap pix;
|
||||||
if (d->scaledcontents) {
|
if (d->scaledcontents) {
|
||||||
if (!d->scaledpixmap || d->scaledpixmap->size() != cr.size()) {
|
if (!d->scaledpixmap || d->scaledpixmap->size() != cr.size()) {
|
||||||
if (!d->cachedimage)
|
|
||||||
d->cachedimage = new QImage(d->pixmap->toImage());
|
|
||||||
delete d->scaledpixmap;
|
delete d->scaledpixmap;
|
||||||
d->scaledpixmap = new QPixmap(QPixmap::fromImage(d->cachedimage->scaled(cr.size(),Qt::IgnoreAspectRatio,Qt::SmoothTransformation)));
|
d->scaledpixmap = new QPixmap(d->pixmap->scaled(cr.size() ,Qt::IgnoreAspectRatio, Qt::SmoothTransformation));
|
||||||
}
|
}
|
||||||
pix = *d->scaledpixmap;
|
pix = *d->scaledpixmap;
|
||||||
} else
|
} else
|
||||||
|
@ -1180,8 +1177,6 @@ void QLabelPrivate::clearContents()
|
||||||
|
|
||||||
delete scaledpixmap;
|
delete scaledpixmap;
|
||||||
scaledpixmap = 0;
|
scaledpixmap = 0;
|
||||||
delete cachedimage;
|
|
||||||
cachedimage = 0;
|
|
||||||
delete pixmap;
|
delete pixmap;
|
||||||
pixmap = 0;
|
pixmap = 0;
|
||||||
|
|
||||||
|
@ -1305,8 +1300,6 @@ void QLabel::setScaledContents(bool enable)
|
||||||
if (!enable) {
|
if (!enable) {
|
||||||
delete d->scaledpixmap;
|
delete d->scaledpixmap;
|
||||||
d->scaledpixmap = 0;
|
d->scaledpixmap = 0;
|
||||||
delete d->cachedimage;
|
|
||||||
d->cachedimage = 0;
|
|
||||||
}
|
}
|
||||||
update(contentsRect());
|
update(contentsRect());
|
||||||
}
|
}
|
||||||
|
|
|
@ -66,7 +66,6 @@ public:
|
||||||
QString text;
|
QString text;
|
||||||
QPixmap *pixmap;
|
QPixmap *pixmap;
|
||||||
QPixmap *scaledpixmap;
|
QPixmap *scaledpixmap;
|
||||||
QImage *cachedimage;
|
|
||||||
#ifndef QT_NO_MOVIE
|
#ifndef QT_NO_MOVIE
|
||||||
QPointer<QMovie> movie;
|
QPointer<QMovie> movie;
|
||||||
void _q_movieUpdated(const QRect&);
|
void _q_movieUpdated(const QRect&);
|
||||||
|
|
Loading…
Add table
Reference in a new issue