From e2949dba9b95b76ec759fc656f4eea60c7d5bbd5 Mon Sep 17 00:00:00 2001 From: Scott Moreau Date: Mon, 11 Jun 2012 13:09:23 -0600 Subject: [PATCH] Remove weston_compositor_get_time() usage from animations. --- 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 609ca21..75d5ab2 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, -- 2.7.4