[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    KDE/kdelibs/nepomuk/ui
From:       Jonathan Michael Thomas <echidnaman () kubuntu ! org>
Date:       2010-08-27 23:37:54
Message-ID: 20100827233754.C0B30AC857 () svn ! kde ! org
[Download RAW message or body]

SVN commit 1168940 by jmthomas:

Optimize KRatingPainter::paint() by using the global KIconEffect for applying the \
effects on the pixmaps, rather than creating two new KIconEffect objects each time we \
paint. (Creating KIconEffects are rather expensive to be doing twice per paint, since \
they have to read/load configuration...) Gives a speedup of about 479x for the \
paint() function. (Which is to say it is now 0.04% of what my program spends time \
doing instead of 20%) Shouldn't be too noticable for things like the Dolphin info \
pane, but for things that paint a lot of these (say an itemview with a KRatingPainter \
in each delegate) it should be a marked improvement.


 M  +4 -2      kratingpainter.cpp  


--- trunk/KDE/kdelibs/nepomuk/ui/kratingpainter.cpp #1168939:1168940
@@ -28,6 +28,7 @@
 
 #include <kicon.h>
 #include <kiconeffect.h>
+#include <kiconloader.h>
 #include <kdebug.h>
 
 
@@ -198,7 +199,8 @@
     int maxHSizeOnePix = ( rect.width() - (numUsedStars-1)*usedSpacing ) / \
                numUsedStars;
     QPixmap ratingPix = d->getPixmap( qMin( rect.height(), maxHSizeOnePix ) );
 
-    QPixmap disabledRatingPix = KIconEffect().apply( ratingPix, KIconEffect::ToGray, \
1.0, QColor(), false ); +    KIconEffect *iconEffect = \
KIconLoader::global()->iconEffect(); +    QPixmap disabledRatingPix = \
iconEffect->apply( ratingPix, KIconEffect::ToGray, 1.0, QColor(), false );  QPixmap \
hoverPix;  
     // if we are disabled we become gray and more transparent
@@ -215,7 +217,7 @@
     if ( hoverRating > 0 && rating != hoverRating && d->isEnabled ) {
         numHoverStars = d->bHalfSteps ? hoverRating/2 : hoverRating;
         halfHover = d->bHalfSteps && hoverRating%2;
-        hoverPix = KIconEffect().apply( ratingPix, KIconEffect::ToGray, 0.5, \
QColor(), false ); +        hoverPix = iconEffect->apply( ratingPix, \
KIconEffect::ToGray, 0.5, QColor(), false );  }
 
     if ( d->alignment & Qt::AlignJustify ) {


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic