Start the fade when we can display the first frame of it, not when we know that there...
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 20 Feb 2005 22:52:45 +0000 (22:52 +0000)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Sun, 20 Feb 2005 22:52:45 +0000 (22:52 +0000)
bigscreen/rotatescreen.cpp
bigscreen/rotatescreen.h

index 54f0423..3c2a4b9 100644 (file)
@@ -38,6 +38,11 @@ void RotateScreen::draw(unsigned char *buf)
                struct timeval now;
                gettimeofday(&now, NULL);
 
+               if (!fade_found_start_time) {
+                       fade_found_start_time = true;
+                       fade_started = now;
+               }
+               
                double elapsed_fade = double(now.tv_sec - fade_started.tv_sec) +
                        double(now.tv_usec - fade_started.tv_usec) * 1.0e-6;
                
@@ -108,8 +113,8 @@ void RotateScreen::draw(unsigned char *buf)
                if (current_screen != old_current_screen || subscreens[current_screen].screen->check_invalidated()) {
                        // initialize a fade
                        in_fade = true;
+                       fade_found_start_time = false;
                        same_fade = (current_screen == old_current_screen);
-                       gettimeofday(&fade_started, NULL);
                        
                        memcpy(fadefrom_buf, subscreens[old_current_screen].buf, 800 * 600 * 4);
 
index d2c69f7..4fe6edf 100644 (file)
@@ -23,7 +23,7 @@ private:
        unsigned current_screen;
 
        struct timeval last_update, fade_started;
-       bool in_fade, same_fade;
+       bool in_fade, fade_found_start_time, same_fade;
 
        bool needs_update();