~timo-jyrinki/compiz/metacity-key-migrations

« back to all changes in this revision

Viewing changes to plugins/loginout/src/loginout.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:
171
171
void
172
172
LoginoutScreen::preparePaint (int        ms)
173
173
{
174
 
    float val, val2;
 
174
    float val;
175
175
 
176
176
    val = ((float)ms / 1000.0) / optionGetInTime ();
177
177
 
190
190
    if (in > 0.0 || out > 0.0)
191
191
    {
192
192
        val  = (in * optionGetInOpacity () / 100.0) + (1.0 - in);
193
 
        val2 = (out * optionGetOutOpacity () / 100.0) + (1.0 - out);
 
193
        float val2 = (out * optionGetOutOpacity () / 100.0) + (1.0 - out);
194
194
        opacity = MIN (val, val2);
195
195
 
196
196
        val  = (in * optionGetInSaturation () / 100.0) + (1.0 - in);