[PATCH weston 3/8] animation: When fading, round the surface alpha when close to 0 or 1

Ander Conselvan de Oliveira ander.conselvan.de.oliveira at intel.com
Thu Feb 21 08:35:18 PST 2013


The spring code stops when the current value is withing 0.0002 of the
target. In that case, round the value to 0.0 or 1.0 to enable the use
of fast paths, such as disabling blending in the GL renderer when an
opaque region is set.
---
 src/animation.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/animation.c b/src/animation.c
index 147a5c0..9e2ad4e 100644
--- a/src/animation.c
+++ b/src/animation.c
@@ -229,9 +229,9 @@ weston_zoom_run(struct weston_surface *surface, float start, float stop,
 static void
 fade_frame(struct weston_surface_animation *animation)
 {
-	if (animation->spring.current > 1)
+	if (animation->spring.current > 0.999)
 		animation->surface->alpha = 1;
-	else if (animation->spring.current < 0 )
+	else if (animation->spring.current < 0.001 )
 		animation->surface->alpha = 0;
 	else
 		animation->surface->alpha = animation->spring.current;
-- 
1.7.10.4



More information about the wayland-devel mailing list