avoid unnecessary conversion: QPixmap->QImage->QPixmap

svn path=/trunk/KDE/kdebase/workspace/; revision=535225
This commit is contained in:
Thorsten Roeder 2006-04-28 21:29:59 +00:00
parent a54ba477c3
commit 86d995aec4
3 changed files with 3 additions and 3 deletions

View file

@ -695,7 +695,7 @@ void KDEDefaultButton::drawButton(QPainter *p)
// Smooth scale the pixmap for small titlebars
// This is slow, but we assume this isn't done too often
if ( width() < 16 ) {
btnpix = QPixmap::fromImage(btnpix.toImage().scaled(12, 12));
btnpix.scaled(12, 12);
p->drawPixmap( 0, 0, btnpix );
}
else

View file

@ -261,7 +261,7 @@ void PlastikButton::drawButton(QPainter *painter)
{
QPixmap menuIcon(m_client->icon().pixmap( style()->pixelMetric( QStyle::PM_SmallIconSize ) ));
if (width() < menuIcon.width() || height() < menuIcon.height() ) {
menuIcon = QPixmap::fromImage( menuIcon.toImage().scaled(width(), height()));
menuIcon.scaled(width(), height());
}
bP.drawPixmap((width()-menuIcon.width())/2, (height()-menuIcon.height())/2, menuIcon);
}

View file

@ -494,7 +494,7 @@ void QuartzButton::drawButton(QPainter *p)
if ( height() < 16)
{
// Smooth scale the image
QPixmap tmpPix = QPixmap::fromImage( btnpix.toImage().scaled(height(), height(), Qt::IgnoreAspectRatio,Qt::SmoothTransformation));
QPixmap tmpPix ( btnpix.scaled(height(), height(), Qt::IgnoreAspectRatio,Qt::SmoothTransformation) );
p->drawPixmap( 0, 0, tmpPix );
} else {
Offset += (height() - 16)/2;