[PATCH weston] Increment frame_counter before calling animation->frame().

Kristian Høgsberg hoegsberg at gmail.com
Fri Jun 15 07:21:38 PDT 2012


On Thu, Jun 14, 2012 at 01:01:56AM -0600, Scott Moreau wrote:
> Iterate the frame_counter before calling animation->frame() because the animation might be
> destroyed in this path. The first frame is now 1 (not 0) in the animation frame handlers.
> ---
> 
> This fixes bug #51057

Thanks,
Kristian

> 
>  src/compositor.c |    6 +++---
>  src/util.c       |    4 ++--
>  2 files changed, 5 insertions(+), 5 deletions(-)
> 
> diff --git a/src/compositor.c b/src/compositor.c
> index 51347dc..0d07576 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -956,7 +956,7 @@ fade_frame(struct weston_animation *animation,
>  			     struct weston_compositor, fade.animation);
>  	struct weston_surface *surface;
>  
> -	if (animation->frame_counter == 0)
> +	if (animation->frame_counter <= 1)
>  		compositor->fade.spring.timestamp = msecs;
>  
>  	surface = compositor->fade.surface;
> @@ -1073,8 +1073,8 @@ weston_output_repaint(struct weston_output *output, int msecs)
>  	wl_list_init(&frame_callback_list);
>  
>  	wl_list_for_each_safe(animation, next, &output->animation_list, link) {
> -		animation->frame(animation, output, msecs);
>  		animation->frame_counter++;
> +		animation->frame(animation, output, msecs);
>  	}
>  }
>  
> @@ -2735,7 +2735,7 @@ static void
>  weston_zoom_frame_z(struct weston_animation *animation,
>  		struct weston_output *output, uint32_t msecs)
>  {
> -	if (animation->frame_counter == 0)
> +	if (animation->frame_counter <= 1)
>  		output->zoom.spring_z.timestamp = msecs;
>  
>  	weston_spring_update(&output->zoom.spring_z, msecs);
> diff --git a/src/util.c b/src/util.c
> index 3418a8a..e2547a9 100644
> --- a/src/util.c
> +++ b/src/util.c
> @@ -135,7 +135,7 @@ weston_zoom_frame(struct weston_animation *animation,
>  	struct weston_surface *es = zoom->surface;
>  	GLfloat scale;
>  
> -	if (animation->frame_counter == 0)
> +	if (animation->frame_counter <= 1)
>  		zoom->spring.timestamp = msecs;
>  
>  	weston_spring_update(&zoom->spring, msecs);
> @@ -472,7 +472,7 @@ weston_fade_frame(struct weston_animation *animation,
>  	struct weston_surface *es = fade->surface;
>  	float fade_factor;
>  
> -	if (animation->frame_counter == 0)
> +	if (animation->frame_counter <= 1)
>  		fade->spring.timestamp = msecs;
>  
>  	weston_spring_update(&fade->spring, msecs);
> -- 
> 1.7.7.6
> 
> _______________________________________________
> wayland-devel mailing list
> wayland-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/wayland-devel


More information about the wayland-devel mailing list