~compiz-team/compiz/compiz.fix_1088399

« back to all changes in this revision

Viewing changes to plugins/animation/src/grid.cpp

Minor Performance Optimizations:

* Return ASAP./Prevent executing any unnecessary operations if we return.
* Used De Morgan's laws to merge and simplify if statements.

Other Changes:

* C++ Style: Declared iterator variables inside the for loops they are used in.
* No logic changes have been made.

Approved by Daniel van Vugt.

Show diffs side-by-side

added added

removed removed

Lines of Context:
219
219
                       unsigned int                maxGridWidth,
220
220
                       unsigned int                maxGridHeight)
221
221
{
222
 
   
 
222
    if (region.isEmpty ()) // nothing to do
 
223
        return;
 
224
 
223
225
    GLfloat *v, *vMax;
224
 
    float winContentsY, winContentsHeight;
225
 
    int vSize;
226
226
    bool notUsing3dCoords = !using3D ();
227
227
 
228
 
    if (region.isEmpty ()) // nothing to do
229
 
        return;
230
 
 
231
228
    CompRect outRect (mAWindow->savedRectsValid () ?
232
229
                      mAWindow->savedOutRect () :
233
230
                      mWindow->outputRect ());
242
239
    int oheight = outRect.height ();
243
240
 
244
241
    // to be used if event is shade/unshade
245
 
    winContentsY = oy + outExtents.top;
246
 
    winContentsHeight = oheight - outExtents.top - outExtents.bottom;
 
242
    float winContentsY = oy + outExtents.top;
 
243
    float winContentsHeight = oheight - outExtents.top - outExtents.bottom;
247
244
 
248
245
    GLWindow *gWindow = GLWindow::get (mWindow);
249
246
    GLVertexBuffer *vertexBuffer = gWindow->vertexBuffer ();
250
 
    vSize = vertexBuffer->getVertexStride ();
 
247
    int vSize = vertexBuffer->getVertexStride ();
251
248
 
252
249
    // Indentation kept to provide a clean diff with the old code, for now...
253
250
    {