[weston v2 2/8] animation: Make zoom animation renders better and smoother

Tomeu Vizoso tomeu at tomeuvizoso.net
Wed Jul 3 06:58:16 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 | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/animation.c b/src/animation.c
index 42395af..6a60412 100644
--- a/src/animation.c
+++ b/src/animation.c
@@ -224,6 +224,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,
@@ -248,7 +251,8 @@ weston_zoom_run(struct weston_surface *surface, float start, float stop,
 					    zoom_frame, done, data, NULL);
 
 	weston_spring_init(&zoom->spring, 300.0, start, stop);
-	zoom->spring.friction = 1400;
+	zoom->spring.friction = 1150;
+	zoom->spring.k = 400;
 	zoom->spring.previous = start - (stop - start) * 0.03;
 
 	return zoom;
-- 
1.8.3.1



More information about the wayland-devel mailing list