Rename same_fade to fade_to_new_info, plus minor code cleanup.
authorSteinar H. Gunderson <sesse@samfundet.no>
Tue, 1 Mar 2005 00:57:33 +0000 (00:57 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Tue, 1 Mar 2005 00:57:33 +0000 (00:57 +0000)
bigscreen/rotatescreen.cpp
bigscreen/rotatescreen.h

index a7d3a5c..6b244e8 100644 (file)
@@ -52,7 +52,7 @@ void RotateScreen::draw(unsigned char *buf)
                double elapsed_fade = double(now.tv_sec - fade_started.tv_sec) +
                        double(now.tv_usec - fade_started.tv_usec) * 1.0e-6;
                
-               if (elapsed_fade > 5.5 || (!same_fade && elapsed_fade > 0.5)) {
+               if (elapsed_fade > 5.5 || (!fade_to_new_info && elapsed_fade > 0.5)) {
                        in_fade = false;
 
                        // ugly hack here? :-)
@@ -62,7 +62,7 @@ void RotateScreen::draw(unsigned char *buf)
                } else {
                        // find the fade factors
                        int fr, fg, fb, fa;
-                       if (same_fade) {
+                       if (fade_to_new_info) {
                                if (elapsed_fade < 0.5) {
                                        fr = fg = fb = fa = unsigned(elapsed_fade/0.5 * 256.0);
                                } else {
@@ -76,7 +76,7 @@ void RotateScreen::draw(unsigned char *buf)
                        unsigned char *sptr2 = subscreens[current_screen].buf;
                        unsigned char *dptr = buf;
 
-                       if (same_fade && elapsed_fade >= 0.5) {
+                       if (fade_to_new_info && elapsed_fade >= 0.5) {
                                // fade G&B to be = R
                                for (unsigned i = 0; i < 800 * 600; ++i) {
                                        dptr[0] = sptr2[0] + (((int(sptr2[2]) - int(sptr2[0])) * fb) >> 8);
@@ -120,7 +120,7 @@ void RotateScreen::draw(unsigned char *buf)
                        // initialize a fade
                        in_fade = true;
                        fade_found_start_time = false;
-                       same_fade = (current_screen == old_current_screen) || force;
+                       fade_to_new_info = force;
                        
                        memcpy(fadefrom_buf, subscreens[old_current_screen].buf, 800 * 600 * 4);
 
index 4fe6edf..114f6c0 100644 (file)
@@ -23,7 +23,7 @@ private:
        unsigned current_screen;
 
        struct timeval last_update, fade_started;
-       bool in_fade, fade_found_start_time, same_fade;
+       bool in_fade, fade_found_start_time, fade_to_new_info;
 
        bool needs_update();