[PATCH v2 1/2] animation: add fading-in animation

Alex Wu zhiwen.wu at linux.intel.com
Wed Apr 25 19:52:03 PDT 2012


于 2012/4/25 19:09, juan.j.zhao at linux.intel.com 写道:
> From: Juan Zhao<juan.j.zhao at intel.com>
>
> To ful-fill user experience, add the fading-in animation
> when mapping a window.
> v2: update that westom_surface_damage to repaint
>      remove that transform part in fade struct
>
> Signed-off-by: Juan Zhao<juan.j.zhao at intel.com>
> ---
>
>
>   src/util.c |   85 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>   1 files changed, 85 insertions(+), 0 deletions(-)
>
> diff --git a/src/util.c b/src/util.c
> index c7511cf..9943820 100644
> --- a/src/util.c
> +++ b/src/util.c
> @@ -96,6 +96,15 @@ struct weston_zoom {
>   	void *data;
>   };
>
> +struct weston_fade {
> +	struct weston_surface *surface;
> +	struct weston_animation animation;
> +	struct weston_spring spring;
> +	struct wl_listener listener;
> +	void (*done)(struct weston_fade *fade, void *data);
> +	void *data;
> +};
> +
>   static void
>   weston_zoom_destroy(struct weston_zoom *zoom)
>   {
> @@ -325,3 +334,79 @@ weston_environment_get_fd(const char *env)
>
>   	return fd;
>   }
> +/*fade in and fade out animation*/
> +static void
> +weston_fade_destroy(struct weston_fade *fade)
> +{
> +	wl_list_remove(&fade->animation.link);
> +	wl_list_remove(&fade->listener.link);
> +	fade->surface->geometry.dirty = 1;
should we set the surface->alpha to 255 explicitly here? It seems that 
weston_spring_done() may not guarantee that spring.current > 1.0 when done.
> +	if (fade->done)
> +		fade->done(fade, fade->data);
> +	free(fade);
> +}
> +
>
>



More information about the wayland-devel mailing list