zoom: Don't update the zoom translation if zoom level is 0
authorAnder Conselvan de Oliveira <ander.conselvan.de.oliveira@intel.com>
Wed, 21 Nov 2012 13:11:36 +0000 (15:11 +0200)
committerKristian Høgsberg <krh@bitplanet.net>
Wed, 21 Nov 2012 16:40:39 +0000 (11:40 -0500)
On the first frame with zoom activated, the spring used for animation
will have a current value of zero. The translation calculated with that
value will be invalid (not a number). Using this value later leads to
having an invalid output matrix, so nothing is composited in the first
zoomed frame.

This problem is most evident when a sprite plane is being used. In that
case, enabling the zoom will cause the surface to be moved back to the
primary plane, but because of the bug described above, this surface
would not actually be rendered causing a quick flicker.

src/zoom.c

index 3be27f6..d57b868 100644 (file)
@@ -251,7 +251,8 @@ weston_output_update_zoom_transform(struct weston_output *output)
        level = output->zoom.spring_z.current;
        ratio = 1 / level;
 
-       if (!output->zoom.active || level > output->zoom.max_level)
+       if (!output->zoom.active || level > output->zoom.max_level ||
+           level == 0.0f)
                return;
 
        if (type == ZOOM_FOCUS_POINTER &&