diff --git a/libweston/animation.c b/libweston/animation.c index 24fc4adc..914135a2 100644 --- a/libweston/animation.c +++ b/libweston/animation.c @@ -434,7 +434,8 @@ weston_slide_run(struct weston_view *view, float start, float stop, struct weston_move_animation { int dx; int dy; - int reverse; + bool reverse; + bool scale; weston_view_animation_done_func_t done; }; @@ -452,7 +453,9 @@ move_frame(struct weston_view_animation *animation) (animation->stop - animation->start) * progress; 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, move->dx * progress, move->dy * progress, 0); @@ -469,10 +472,11 @@ move_done(struct weston_view_animation *animation, void *data) free(move); } -WL_EXPORT struct weston_view_animation * -weston_move_scale_run(struct weston_view *view, int dx, int dy, - float start, float end, int reverse, - weston_view_animation_done_func_t done, void *data) +static struct weston_view_animation * +weston_move_scale_run_internal(struct weston_view *view, int dx, int dy, + float start, float end, bool reverse, bool scale, + weston_view_animation_done_func_t done, + void *data) { struct weston_move_animation *move; 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->dy = dy; move->reverse = reverse; + move->scale = scale; move->done = done; 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; } + +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); +} diff --git a/libweston/compositor.h b/libweston/compositor.h index 534c8c2e..c78cc3bb 100644 --- a/libweston/compositor.h +++ b/libweston/compositor.h @@ -1707,9 +1707,14 @@ weston_fade_run(struct weston_view *view, struct weston_view_animation * 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); +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 weston_fade_update(struct weston_view_animation *fade, float target);