compositor: round off fractions
authorPekka Paalanen <ppaalanen@gmail.com>
Mon, 13 Feb 2012 08:34:04 +0000 (10:34 +0200)
committerPekka Paalanen <ppaalanen@gmail.com>
Mon, 13 Feb 2012 08:34:04 +0000 (10:34 +0200)
Round off fractions from non-transformed surface position coordinates.

Transformed surface moved by a client may have non-integer position
coordinates. That is required to prevent drifting on continuous
resizing.

We can round the position to integers when the surface is not (anymore)
transformed.

This change may fix a rounding inconsistency in the opaque region setup,
where the rectangle is initialised from the coordinates without explicit
rounding operation.

Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
src/compositor.c

index 507fcda..ae1a0fd 100644 (file)
@@ -312,6 +312,10 @@ weston_surface_update_transform_disable(struct weston_surface *surface)
 {
        surface->transform.enabled = 0;
 
+       /* round off fractions when not transformed */
+       surface->geometry.x = roundf(surface->geometry.x);
+       surface->geometry.y = roundf(surface->geometry.y);
+
        pixman_region32_init_rect(&surface->transform.boundingbox,
                                  surface->geometry.x,
                                  surface->geometry.y,