From: Steinar H. Gunderson Date: Sun, 20 Feb 2005 22:52:45 +0000 (+0000) Subject: Start the fade when we can display the first frame of it, not when we know that there... X-Git-Url: https://git.sesse.net/?p=ccbs;a=commitdiff_plain;h=99b06a7cbf2cbd55cc5d6475b6b33d2fb1b2ecd0 Start the fade when we can display the first frame of it, not when we know that there is a new page. This gets rid of the "kink" we find at the start of a fade if the new screen tok a bit to generate. --- diff --git a/bigscreen/rotatescreen.cpp b/bigscreen/rotatescreen.cpp index 54f0423..3c2a4b9 100644 --- a/bigscreen/rotatescreen.cpp +++ b/bigscreen/rotatescreen.cpp @@ -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); diff --git a/bigscreen/rotatescreen.h b/bigscreen/rotatescreen.h index d2c69f7..4fe6edf 100644 --- a/bigscreen/rotatescreen.h +++ b/bigscreen/rotatescreen.h @@ -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();