~uriboni/compiz/unminimize-configurable-independently

« back to all changes in this revision

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

Fixed various problems described in bug 1030473.
Optimized performance and style following suggestions reported by cppcheck:

1. Reduced the scope of various variables.

2. Used prefix ++ operators for non-primitive types, because those can be more efficient than post-increment. Post-increment usually keeps a copy of the previous value, adds extra code and is slower.. Fixes: https://bugs.launchpad.net/bugs/1030473. Approved by Daniel van Vugt, Sam Spilsbury.

Show diffs side-by-side

added added

removed removed

Lines of Context:
596
596
    bool allRandom = optionGetAllRandom ();
597
597
    AnimEffectVector *randomEffects = &mRandomEffects[animEvent].effects;
598
598
    unsigned int nRandomEffects = randomEffects->size ();
599
 
    unsigned int nFirstRandomEffect = 0;
600
599
 
601
600
    if ((effect == AnimEffectRandom) || allRandom)
602
601
    {
 
602
        unsigned int nFirstRandomEffect = 0;
603
603
        if (nRandomEffects == 0) // no random animation selected, assume "all"
604
604
        {
605
605
            randomEffects = &mEventEffectsAllowed[animEvent];
978
978
PrivateAnimScreen::eventMatchesChanged (CompOption                *opt,
979
979
                                        AnimationOptions::Options num)
980
980
{
981
 
    if (mExtensionPlugins.size () == 0)
 
981
    if (mExtensionPlugins.empty ())
982
982
        initAnimationList ();
983
983
    foreach (CompOption::Value &val, opt->value ().list ())
984
984
        val.match ().update ();
988
988
PrivateAnimScreen::eventOptionsChanged (CompOption                *opt,
989
989
                                        AnimationOptions::Options num)
990
990
{
991
 
    if (mExtensionPlugins.size () == 0)
 
991
    if (mExtensionPlugins.empty ())
992
992
        initAnimationList ();
993
993
    updateOptionSets (getCorrespondingAnimEvent (num));
994
994
}
997
997
PrivateAnimScreen::eventEffectsChanged (CompOption                *opt,
998
998
                                        AnimationOptions::Options num)
999
999
{
1000
 
    if (mExtensionPlugins.size () == 0)
 
1000
    if (mExtensionPlugins.empty ())
1001
1001
        initAnimationList ();
1002
1002
    updateEventEffects (getCorrespondingAnimEvent (num), false);
1003
1003
}
1006
1006
PrivateAnimScreen::eventRandomEffectsChanged (CompOption                *opt,
1007
1007
                                              AnimationOptions::Options num)
1008
1008
{
1009
 
    if (mExtensionPlugins.size () == 0)
 
1009
    if (mExtensionPlugins.empty ())
1010
1010
        initAnimationList ();
1011
1011
    updateEventEffects (getCorrespondingAnimEvent (num), true);
1012
1012
}
1267
1267
 
1268
1268
        /* Paint list includes destroyed windows */
1269
1269
        for (CompWindowList::const_reverse_iterator rit = pl.rbegin ();
1270
 
             rit != pl.rend (); rit++)
 
1270
             rit != pl.rend (); ++rit)
1271
1271
        {
1272
1272
            CompWindow *w = (*rit);
1273
1273
            AnimWindow *animWin = AnimWindow::get (w);
1383
1383
 
1384
1384
    /* Paint list includes destroyed windows */
1385
1385
    for (CompWindowList::const_reverse_iterator rit = pl.rbegin ();
1386
 
         rit != pl.rend (); rit++)
 
1386
         rit != pl.rend (); ++rit)
1387
1387
    {
1388
1388
        CompWindow *w = (*rit);
1389
1389
        AnimWindow *animWin = AnimWindow::get (w);
2931
2931
 
2932
2932
    // Destroy each persistent data object
2933
2933
    PersistentDataMap::iterator itData = persistentData.begin ();
2934
 
    for (; itData != persistentData.end (); itData++)
 
2934
    for (; itData != persistentData.end (); ++itData)
2935
2935
        delete itData->second;
2936
2936
 
2937
2937
    persistentData.clear ();