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

List:       kde-commits
Subject:    branches/KDE/4.1/kdelibs/khtml/html
From:       Harri Porten <porten () kde ! org>
Date:       2008-10-03 22:04:26
Message-ID: 1223071466.472558.20213.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 867600 by porten:

Merged revision 867598:
Save calls to non-inline QImage::width(). About 0.25% CPU cycles
less http://www.nihilogic.dk/labs/javascript_canvas_fractals/

 M  +4 -2      html_canvasimpl.cpp  


--- branches/KDE/4.1/kdelibs/khtml/html/html_canvasimpl.cpp #867599:867600
@@ -673,7 +673,8 @@
 
 QColor CanvasImageDataImpl::pixel(unsigned pixelNum) const
 {
-    QRgb code = data.pixel(pixelNum % data.width(), pixelNum / data.width());
+    int w = data.width();
+    QRgb code = data.pixel(pixelNum % w, pixelNum / w);
     unsigned char  a = qAlpha(code);
     return QColor(unpremulComponent(qRed(code),  a), unpremulComponent(qGreen(code), a),
                   unpremulComponent(qBlue(code), a), a);
@@ -690,7 +691,8 @@
     unsigned char a = val.alpha();
     QRgb code = qRgba(premulComponent(val.red(), a), premulComponent(val.green(), a),
                       premulComponent(val.blue(),a), a);
-    data.setPixel(pixelNum % data.width(), pixelNum / data.width(), code);
+    int w = data.width();
+    data.setPixel(pixelNum % w, pixelNum / w, code);
 }
 
 //-------
[prev in list] [next in list] [prev in thread] [next in thread] 

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