[PATCH weston] Remove weston_compositor_get_time() usage from animations.

Scott Moreau oreaus at gmail.com
Mon Jun 11 12:09:23 PDT 2012


---

Prepare for weston_compositor_get_time() removal.

 src/compositor.c |    9 +++------
 src/util.c       |   12 ++++++++----
 2 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index 0fad66c..79b7082 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -956,6 +956,9 @@ fade_frame(struct weston_animation *animation,
 			     struct weston_compositor, fade.animation);
 	struct weston_surface *surface;
 
+	if (animation->frame_counter == 0)
+		compositor->fade.spring.timestamp = msecs;
+
 	surface = compositor->fade.surface;
 	weston_spring_update(&compositor->fade.spring, msecs);
 	weston_surface_set_color(surface, 0.0, 0.0, 0.0,
@@ -1147,20 +1150,14 @@ weston_compositor_fade(struct weston_compositor *compositor, float tint)
 {
 	struct weston_output *output;
 	struct weston_surface *surface;
-	int done;
 
 	output = container_of(compositor->output_list.next,
                              struct weston_output, link);
 
-	done = weston_spring_done(&compositor->fade.spring);
 	compositor->fade.spring.target = tint;
 	if (weston_spring_done(&compositor->fade.spring))
 		return;
 
-	if (done)
-		compositor->fade.spring.timestamp =
-			weston_compositor_get_time();
-
 	if (compositor->fade.surface == NULL) {
 		surface = weston_surface_create(compositor);
 		weston_surface_configure(surface, 0, 0, 8192, 8192);
diff --git a/src/util.c b/src/util.c
index bc013ca..3418a8a 100644
--- a/src/util.c
+++ b/src/util.c
@@ -135,6 +135,9 @@ weston_zoom_frame(struct weston_animation *animation,
 	struct weston_surface *es = zoom->surface;
 	GLfloat scale;
 
+	if (animation->frame_counter == 0)
+		zoom->spring.timestamp = msecs;
+
 	weston_spring_update(&zoom->spring, msecs);
 
 	if (weston_spring_done(&zoom->spring)) {
@@ -181,9 +184,8 @@ weston_zoom_run(struct weston_surface *surface, GLfloat start, GLfloat stop,
 	weston_spring_init(&zoom->spring, 200.0, 0.0, 1.0);
 	zoom->spring.friction = 700;
 	zoom->animation.frame_counter = 0;
-	zoom->spring.timestamp = weston_compositor_get_time();
 	zoom->animation.frame = weston_zoom_frame;
-	weston_zoom_frame(&zoom->animation, NULL, zoom->spring.timestamp);
+	weston_zoom_frame(&zoom->animation, NULL, 0);
 
 	zoom->listener.notify = handle_zoom_surface_destroy;
 	wl_signal_add(&surface->surface.resource.destroy_signal,
@@ -470,6 +472,9 @@ weston_fade_frame(struct weston_animation *animation,
 	struct weston_surface *es = fade->surface;
 	float fade_factor;
 
+	if (animation->frame_counter == 0)
+		fade->spring.timestamp = msecs;
+
 	weston_spring_update(&fade->spring, msecs);
 
 	if (weston_spring_done(&fade->spring)) {
@@ -504,9 +509,8 @@ weston_fade_run(struct weston_surface *surface,
 	weston_spring_init(&fade->spring, 200.0, 0, 1.0);
 	fade->spring.friction = 700;
 	fade->animation.frame_counter = 0;
-	fade->spring.timestamp = weston_compositor_get_time();
 	fade->animation.frame = weston_fade_frame;
-	weston_fade_frame(&fade->animation, NULL, fade->spring.timestamp);
+	weston_fade_frame(&fade->animation, NULL, 0);
 
 	fade->listener.notify = handle_fade_surface_destroy;
 	wl_signal_add(&surface->surface.resource.destroy_signal,
-- 
1.7.7.6



More information about the wayland-devel mailing list