libweston: Add move (without scale) animation

Signed-off-by: Quentin Glidic <sardemff7+git@sardemff7.net>
Reviewed-by: Daniel Stone <daniels@collabora.com>
dev
Quentin Glidic 8 years ago committed by Daniel Stone
parent e7ed60fabe
commit 24d306ccd8
  1. 35
      libweston/animation.c
  2. 7
      libweston/compositor.h

@ -434,7 +434,8 @@ weston_slide_run(struct weston_view *view, float start, float stop,
struct weston_move_animation { struct weston_move_animation {
int dx; int dx;
int dy; int dy;
int reverse; bool reverse;
bool scale;
weston_view_animation_done_func_t done; weston_view_animation_done_func_t done;
}; };
@ -452,7 +453,9 @@ move_frame(struct weston_view_animation *animation)
(animation->stop - animation->start) * (animation->stop - animation->start) *
progress; progress;
weston_matrix_init(&animation->transform.matrix); weston_matrix_init(&animation->transform.matrix);
weston_matrix_scale(&animation->transform.matrix, scale, scale, 1.0f); if (move->scale)
weston_matrix_scale(&animation->transform.matrix, scale, scale,
1.0f);
weston_matrix_translate(&animation->transform.matrix, weston_matrix_translate(&animation->transform.matrix,
move->dx * progress, move->dy * progress, move->dx * progress, move->dy * progress,
0); 0);
@ -469,10 +472,11 @@ move_done(struct weston_view_animation *animation, void *data)
free(move); free(move);
} }
WL_EXPORT struct weston_view_animation * static struct weston_view_animation *
weston_move_scale_run(struct weston_view *view, int dx, int dy, weston_move_scale_run_internal(struct weston_view *view, int dx, int dy,
float start, float end, int reverse, float start, float end, bool reverse, bool scale,
weston_view_animation_done_func_t done, void *data) weston_view_animation_done_func_t done,
void *data)
{ {
struct weston_move_animation *move; struct weston_move_animation *move;
struct weston_view_animation *animation; struct weston_view_animation *animation;
@ -483,6 +487,7 @@ weston_move_scale_run(struct weston_view *view, int dx, int dy,
move->dx = dx; move->dx = dx;
move->dy = dy; move->dy = dy;
move->reverse = reverse; move->reverse = reverse;
move->scale = scale;
move->done = done; move->done = done;
animation = weston_view_animation_create(view, start, end, move_frame, animation = weston_view_animation_create(view, start, end, move_frame,
@ -500,3 +505,21 @@ weston_move_scale_run(struct weston_view *view, int dx, int dy,
return animation; return animation;
} }
WL_EXPORT struct weston_view_animation *
weston_move_scale_run(struct weston_view *view, int dx, int dy,
float start, float end, bool reverse,
weston_view_animation_done_func_t done, void *data)
{
return weston_move_scale_run_internal(view, dx, dy, start, end, reverse,
true, done, data);
}
WL_EXPORT struct weston_view_animation *
weston_move_run(struct weston_view *view, int dx, int dy,
float start, float end, bool reverse,
weston_view_animation_done_func_t done, void *data)
{
return weston_move_scale_run_internal(view, dx, dy, start, end, reverse,
false, done, data);
}

@ -1707,9 +1707,14 @@ weston_fade_run(struct weston_view *view,
struct weston_view_animation * struct weston_view_animation *
weston_move_scale_run(struct weston_view *view, int dx, int dy, weston_move_scale_run(struct weston_view *view, int dx, int dy,
float start, float end, int reverse, float start, float end, bool reverse,
weston_view_animation_done_func_t done, void *data); weston_view_animation_done_func_t done, void *data);
struct weston_view_animation *
weston_move_run(struct weston_view *view, int dx, int dy,
float start, float end, bool reverse,
weston_view_animation_done_func_t done, void *data);
void void
weston_fade_update(struct weston_view_animation *fade, float target); weston_fade_update(struct weston_view_animation *fade, float target);

Loading…
Cancel
Save