[PATCH weston] libweston: Add move (without scale) animation
Quentin Glidic
sardemff7+wayland at sardemff7.net
Wed Aug 10 13:53:33 UTC 2016
From: Quentin Glidic <sardemff7+git at sardemff7.net>
Signed-off-by: Quentin Glidic <sardemff7+git at sardemff7.net>
---
libweston/animation.c | 35 +++++++++++++++++++++++++++++------
libweston/compositor.h | 7 ++++++-
2 files changed, 35 insertions(+), 7 deletions(-)
diff --git a/libweston/animation.c b/libweston/animation.c
index 30b3e5d..75da957 100644
--- a/libweston/animation.c
+++ b/libweston/animation.c
@@ -418,7 +418,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;
};
@@ -436,7 +437,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);
@@ -453,10 +456,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;
@@ -467,6 +471,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,
@@ -484,3 +489,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 0133084..b17c71c 100644
--- a/libweston/compositor.h
+++ b/libweston/compositor.h
@@ -1702,9 +1702,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);
--
2.9.2
More information about the wayland-devel
mailing list