[PATCH weston] animation: Use fixed spring in weston_view_animation_run

Kristian Høgsberg hoegsberg at gmail.com
Tue Apr 8 10:12:37 PDT 2014


On Tue, Apr 08, 2014 at 03:54:43PM +0900, Daiki Ueno wrote:
> From: Daiki Ueno <ueno at gnu.org>
> 
> Since commit 3a869019, weston_view_animation_run initializes the
> spring with an arbitrary value range.  This should be fine if the
> range is narrow enough, but if the range is wide, the spring functions
> converge too slowly, since the step is hard-coded.
> 
> This patch partially reverts the change and adjusts the fade-in/out
> behavior in fade_frame instead.

Yeah, that may be better, but doesn't this affect the other animations?

Kristian

> ---
> 
> With the current git master, I noticed a significant delay between
> clicking on a text entry and getting weston-keyboard appearing.
> Sometimes I get: "unexpectedly large timestamp jump" message.
> 
> After some debugging, it seems to be stalled at looping over a
> considerably wide range [180.0, 0.0], with 0.01 step.
> 
>  src/animation.c | 13 +++++++++----
>  1 file changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/src/animation.c b/src/animation.c
> index 521e4f1..85276e1 100644
> --- a/src/animation.c
> +++ b/src/animation.c
> @@ -206,7 +206,7 @@ weston_view_animation_run(struct weston_view *view,
>  	weston_matrix_init(&animation->transform.matrix);
>  	wl_list_insert(&view->geometry.transformation_list,
>  		       &animation->transform.link);
> -	weston_spring_init(&animation->spring, 200.0, start, stop);
> +	weston_spring_init(&animation->spring, 200.0, 0.0, 1.0);
>  	animation->spring.friction = 700;
>  	animation->animation.frame_counter = 0;
>  	animation->animation.frame = weston_view_animation_frame;
> @@ -275,12 +275,17 @@ weston_zoom_run(struct weston_view *view, float start, float stop,
>  static void
>  fade_frame(struct weston_view_animation *animation)
>  {
> -	if (animation->spring.current > 0.999)
> +	float alpha;
> +
> +	alpha = animation->start +
> +		(animation->stop - animation->start) *
> +		animation->spring.current;
> +	if (alpha > 0.999)
>  		animation->view->alpha = 1;
> -	else if (animation->spring.current < 0.001 )
> +	else if (alpha < 0.001)
>  		animation->view->alpha = 0;
>  	else
> -		animation->view->alpha = animation->spring.current;
> +		animation->view->alpha = alpha;
>  }
>  
>  WL_EXPORT struct weston_view_animation *
> -- 
> 1.9.0
> 
> _______________________________________________
> 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