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

List:       kde-commits
Subject:    KDE/kdebase/workspace/kwin
From:       Albert Astals Cid <tsdgeos () terra ! es>
Date:       2008-10-11 12:38:46
Message-ID: 1223728726.899148.3094.nullmailer () svn ! kde ! org
[Download RAW message or body]

SVN commit 869928 by aacid:

Add const & so we don't copy all that objects for nothing, faster effects for free!


 M  +1 -1      composite.cpp  
 M  +2 -2      effects/boxswitch.cpp  
 M  +6 -6      effects/cube.cpp  
 M  +1 -1      effects/desktopgrid.cpp  
 M  +2 -2      effects/shadow.cpp  
 M  +1 -1      effects/shadow.h  
 M  +2 -2      effects/showpaint.cpp  
 M  +13 -13    lib/kwineffects.cpp  


--- trunk/KDE/kdebase/workspace/kwin/composite.cpp #869927:869928
@@ -732,7 +732,7 @@
             }
         break;
         }
-    foreach( QRect r, damage.rects())
+    foreach( const QRect& r, damage.rects())
         addDamage( r ); 
     }
 
--- trunk/KDE/kdebase/workspace/kwin/effects/boxswitch.cpp #869927:869928
@@ -763,7 +763,7 @@
         data.quads = data.quads.splitAtX( splitPoint );
         WindowQuadList left_quads;
         WindowQuadList right_quads;
-        foreach( WindowQuad quad, data.quads )
+        foreach( const WindowQuad &quad, data.quads )
             {
             if( quad.left() >= splitPoint )
                 left_quads << quad;
@@ -878,7 +878,7 @@
         data.quads = data.quads.splitAtX( splitPoint );
         WindowQuadList rightQuads;
         WindowQuadList leftQuads;
-        foreach( WindowQuad quad, data.quads )
+        foreach( const WindowQuad &quad, data.quads )
             {
             if( quad.right() <= splitPoint )
                 leftQuads << quad;
--- trunk/KDE/kdebase/workspace/kwin/effects/cube.cpp #869927:869928
@@ -1199,7 +1199,7 @@
             QRect rect = effects->clientArea( FullArea, activeScreen, prev_desktop);
             data.xTranslate = -rect.width();
             WindowQuadList new_quads;
-            foreach( WindowQuad quad, data.quads )
+            foreach( const WindowQuad &quad, data.quads )
                 {
                 if( quad.right() > rect.width() - w->x() )
                     {
@@ -1213,7 +1213,7 @@
             QRect rect = effects->clientArea( FullArea, activeScreen, next_desktop);
             data.xTranslate = rect.width();
             WindowQuadList new_quads;
-            foreach( WindowQuad quad, data.quads )
+            foreach( const WindowQuad &quad, data.quads )
                 {
                 if( w->x() + quad.right() <= rect.x() )
                     {
@@ -1248,7 +1248,7 @@
         if( w->isOnDesktop(painting_desktop) && w->x() < rect.x() )
             {
             WindowQuadList new_quads;
-            foreach( WindowQuad quad, data.quads )
+            foreach( const WindowQuad &quad, data.quads )
                 {
                 if( quad.right() > -w->x() )
                     {
@@ -1260,7 +1260,7 @@
         if( w->isOnDesktop(painting_desktop) && w->x() + w->width() > rect.x() + \
rect.width() )  {
             WindowQuadList new_quads;
-            foreach( WindowQuad quad, data.quads )
+            foreach( const WindowQuad &quad, data.quads )
                 {
                 if( quad.right() <= rect.width() - w->x() )
                     {
@@ -1272,7 +1272,7 @@
         if( w->y() < rect.y() )
             {
             WindowQuadList new_quads;
-            foreach( WindowQuad quad, data.quads )
+            foreach( const WindowQuad &quad, data.quads )
                 {
                 if( quad.bottom() > -w->y() )
                     {
@@ -1284,7 +1284,7 @@
         if( w->y() + w->height() > rect.y() + rect.height() )
             {
             WindowQuadList new_quads;
-            foreach( WindowQuad quad, data.quads )
+            foreach( const WindowQuad &quad, data.quads )
                 {
                 if( quad.bottom() <= rect.height() - w->y() )
                     {
--- trunk/KDE/kdebase/workspace/kwin/effects/desktopgrid.cpp #869927:869928
@@ -220,7 +220,7 @@
 
             // Display all quads on the same screen on the same pass
             WindowQuadList screenQuads;
-            foreach( WindowQuad quad, data.quads )
+            foreach( const WindowQuad &quad, data.quads )
                 {
                 QRect quadRect(
                     w->x() + quad.left(), w->y() + quad.top(),
--- trunk/KDE/kdebase/workspace/kwin/effects/shadow.cpp #869927:869928
@@ -261,7 +261,7 @@
     {
     QList<ShadowData> newShadowDatas;
     EffectWindowList stack = effects->stackingOrder();
-    foreach( ShadowData d, shadowDatas )
+    foreach( const ShadowData &d, shadowDatas )
         {
         // If behindWindow is given then only render shadows of the windows
         //  that are behind that window.
@@ -277,7 +277,7 @@
     shadowDatas = newShadowDatas;
     }
 
-void ShadowEffect::drawShadow( EffectWindow* window, int mask, QRegion region, \
WindowPaintData& data ) +void ShadowEffect::drawShadow( EffectWindow* window, int \
mask, QRegion region, const WindowPaintData& data )  {
 #ifdef KWIN_HAVE_OPENGL_COMPOSITING
     if( effects->compositingType() == OpenGLCompositing)
--- trunk/KDE/kdebase/workspace/kwin/effects/shadow.h #869927:869928
@@ -59,7 +59,7 @@
         void updateShadowColor();
 
     private:
-        void drawShadow( EffectWindow* w, int mask, QRegion region, WindowPaintData& \
data ); +        void drawShadow( EffectWindow* w, int mask, QRegion region, const \
                WindowPaintData& data );
         void addQuadVertices(QVector<float>& verts, float x1, float y1, float x2, \
float y2) const;  // transforms window rect -> shadow rect
         QRect shadowRectangle(const QRect& windowRectangle) const;
--- trunk/KDE/kdebase/workspace/kwin/effects/showpaint.cpp #869927:869928
@@ -80,7 +80,7 @@
     const QColor& color = colors[ color_index ];
     glColor4f( color.red() / 255., color.green() / 255., color.blue() / 255., alpha \
);  glBegin( GL_QUADS );
-    foreach( QRect r, painted.rects())
+    foreach( const QRect &r, painted.rects())
         {
         glVertex2i( r.x(), r.y());
         glVertex2i( r.x() + r.width(), r.y());
@@ -102,7 +102,7 @@
     col.red = int( alpha * 0xffff * color.red() / 255 );
     col.green = int( alpha * 0xffff * color.green() / 255 );
     col.blue= int( alpha * 0xffff * color.blue() / 255 );
-    foreach( QRect r, painted.rects())
+    foreach( const QRect &r, painted.rects())
         XRenderFillRectangle( display(), PictOpOver, \
effects->xrenderBufferPicture(),  &col, r.x(), r.y(), r.width(), r.height());
 #endif
--- trunk/KDE/kdebase/workspace/kwin/lib/kwineffects.cpp #869927:869928
@@ -569,7 +569,7 @@
 WindowQuadList WindowQuadList::splitAtX( double x ) const
     {
     WindowQuadList ret;
-    foreach( WindowQuad quad, *this )
+    foreach( const WindowQuad &quad, *this )
         {
 #ifndef NDEBUG
         if( quad.isTransformed())
@@ -600,7 +600,7 @@
 WindowQuadList WindowQuadList::splitAtY( double y ) const
     {
     WindowQuadList ret;
-    foreach( WindowQuad quad, *this )
+    foreach( const WindowQuad &quad, *this )
         {
 #ifndef NDEBUG
         if( quad.isTransformed())
@@ -637,7 +637,7 @@
     double right = first().right();
     double top = first().top();
     double bottom = first().bottom();
-    foreach( WindowQuad quad, *this )
+    foreach( const WindowQuad &quad, *this )
         {
 #ifndef NDEBUG
         if( quad.isTransformed())
@@ -657,7 +657,7 @@
              y < bottom;
              y += maxquadsize )
             {
-            foreach( WindowQuad quad, *this )
+            foreach( const WindowQuad &quad, *this )
                 {
                 if( QRectF( QPointF( quad.left(), quad.top()), QPointF( \
                quad.right(), quad.bottom()))
                     .intersects( QRectF( x, y, maxquadsize, maxquadsize )))
@@ -680,7 +680,7 @@
     double right = first().right();
     double top = first().top();
     double bottom = first().bottom();
-    foreach( WindowQuad quad, *this )
+    foreach( const WindowQuad &quad, *this )
         {
 #ifndef NDEBUG
         if( quad.isTransformed())
@@ -703,7 +703,7 @@
              x < right;
              x +=  xincrement)
             {
-            foreach( WindowQuad quad, *this )
+            foreach( const WindowQuad &quad, *this )
                 {
                 if( QRectF( QPointF( quad.left(), quad.top()), QPointF( \
                quad.right(), quad.bottom()))
                     .intersects( QRectF( x, y, xincrement, yincrement )))
@@ -739,12 +739,12 @@
 
 WindowQuadList WindowQuadList::select( WindowQuadType type ) const
     {
-    foreach( WindowQuad q, *this )
+    foreach( const WindowQuad &q, *this )
         {
         if( q.type != type ) // something else than ones to select, make a copy and \
filter  {
             WindowQuadList ret;
-            foreach( WindowQuad q, *this )
+            foreach( const WindowQuad &q, *this )
                 {
                 if( q.type == type )
                     ret.append( q );
@@ -757,12 +757,12 @@
 
 WindowQuadList WindowQuadList::filterOut( WindowQuadType type ) const
     {
-    foreach( WindowQuad q, *this )
+    foreach( const WindowQuad &q, *this )
         {
         if( q.type == type ) // something to filter out, make a copy and filter
             {
             WindowQuadList ret;
-            foreach( WindowQuad q, *this )
+            foreach( const WindowQuad &q, *this )
                 {
                 if( q.type != type )
                     ret.append( q );
@@ -775,7 +775,7 @@
 
 bool WindowQuadList::smoothNeeded() const
     {
-    foreach( WindowQuad q, *this )
+    foreach( const WindowQuad &q, *this )
         if( q.smoothNeeded())
             return true;
     return false;
@@ -783,7 +783,7 @@
 
 bool WindowQuadList::isTransformed() const
     {
-    foreach( WindowQuad q, *this )
+    foreach( const WindowQuad &q, *this )
         if( q.isTransformed())
             return true;
     return false;
@@ -838,7 +838,7 @@
     {
     assert( areas != NULL ); // can be called only with clip() == true
     QRegion ret = QRegion( 0, 0, displayWidth(), displayHeight());
-    foreach( QRegion r, *areas )
+    foreach( const QRegion &r, *areas )
         ret &= r;
     return ret;
     }


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

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