summaryrefslogtreecommitdiff
path: root/src/animation.c
diff options
context:
space:
mode:
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>2013-02-21 18:35:18 +0200
committerKristian Høgsberg <krh@bitplanet.net>2013-02-21 21:12:44 -0500
commit8a91324c13107d7958b1b2432cef3e5c21cc0294 (patch)
treec79d85523fc7b587867e69594c9c68d63e21b1d9 /src/animation.c
parentee4160544662c298102f2f7183ba5d3520da63ad (diff)
downloadweston-8a91324c13107d7958b1b2432cef3e5c21cc0294.tar.gz
animation: When fading, round the surface alpha when close to 0 or 1
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.
Diffstat (limited to 'src/animation.c')
-rw-r--r--src/animation.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/animation.c b/src/animation.c
index 147a5c03..9e2ad4ec 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;