Remove weston_compositor_get_time() usage from animations.
authorScott Moreau <oreaus@gmail.com>
Mon, 11 Jun 2012 19:09:23 +0000 (13:09 -0600)
committerKristian Høgsberg <krh@bitplanet.net>
Tue, 12 Jun 2012 03:46:02 +0000 (23:46 -0400)
src/compositor.c
src/util.c

index 609ca21..75d5ab2 100644 (file)
@@ -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);
index bc013ca..3418a8a 100644 (file)
@@ -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,