kdeui: avoid QPixmap->QImage->QPixmap converting and construction

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2016-09-05 03:29:35 +00:00
parent 5625d3bd29
commit a567ffcc5b

View file

@ -670,7 +670,7 @@ QPixmap KWindowSystem::icon( WId win, int width, int height, bool scale, int fla
QPixmap pm = QPixmap::fromX11Pixmap( p );
if ( scale && width > 0 && height > 0 && !pm.isNull()
&& ( pm.width() != width || pm.height() != height) ){
result = QPixmap::fromImage( pm.toImage().scaled( width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) );
result = pm.scaled( width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
} else {
result = pm;
}
@ -700,7 +700,7 @@ QPixmap KWindowSystem::icon( WId win, int width, int height, bool scale, int fla
QPixmap pm = KIconLoader::global()->loadIcon( className.toLower(), KIconLoader::Small, iconWidth,
KIconLoader::DefaultState, QStringList(), 0, true );
if( scale && !pm.isNull() )
result = QPixmap::fromImage( pm.toImage().scaled( width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) );
result = pm.scaled( width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
else
result = pm;
@ -717,7 +717,7 @@ QPixmap KWindowSystem::icon( WId win, int width, int height, bool scale, int fla
QPixmap pm = KIconLoader::global()->loadIcon( "xorg", KIconLoader::Small, iconWidth,
KIconLoader::DefaultState, QStringList(), 0, true );
if( scale && !pm.isNull() )
result = QPixmap::fromImage( pm.toImage().scaled( width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation ) );
result = pm.scaled( width, height, Qt::IgnoreAspectRatio, Qt::SmoothTransformation );
else
result = pm;
}