[PATCH weston 11/18] animation: Make zoom animation renders better and smoother

ppaalanen at gmail.com ppaalanen at gmail.com
Wed May 22 08:03:14 PDT 2013


From: Louis-Francis Ratté-Boulianne <lfrb at collabora.com>

Don't scale to a size smaller than 1/8 the surface size
Adjust spring parameters so we don't go over the target value
---
 src/animation.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/src/animation.c b/src/animation.c
index 6f20179..835ed13 100644
--- a/src/animation.c
+++ b/src/animation.c
@@ -206,6 +206,9 @@ zoom_frame(struct weston_surface_animation *animation)
 	scale = animation->start +
 		(animation->stop - animation->start) *
 		animation->spring.current;
+	if (scale < 0.125)
+		scale = 0.125;
+
 	weston_matrix_init(&animation->transform.matrix);
 	weston_matrix_translate(&animation->transform.matrix,
 				-0.5f * es->geometry.width,
@@ -224,8 +227,15 @@ WL_EXPORT struct weston_surface_animation *
 weston_zoom_run(struct weston_surface *surface, float start, float stop,
 		weston_surface_animation_done_func_t done, void *data)
 {
-	return weston_surface_animation_run(surface, start, stop,
+	struct weston_surface_animation *zoom;
+
+	zoom = weston_surface_animation_run(surface, start, stop,
 					    zoom_frame, done, data, NULL);
+
+	zoom->spring.k = 400;
+	zoom->spring.friction = 1150;
+
+	return zoom;
 }
 
 static void
-- 
1.8.1.5



More information about the wayland-devel mailing list