[PATCH 1/2] compositor: Make sure surface->transform.matrix,inverse are always valid

Pekka Paalanen ppaalanen at gmail.com
Wed Feb 20 03:05:42 PST 2013


On Tue, 19 Feb 2013 17:04:50 -0500
Kristian Høgsberg <krh at bitplanet.net> wrote:

> First step towards getting rid of the transform.enabled optimization.
> ---
>  src/compositor.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/src/compositor.c b/src/compositor.c
> index 64d0830..07b95a9 100644
> --- a/src/compositor.c
> +++ b/src/compositor.c
> @@ -520,6 +520,17 @@ weston_surface_update_transform_disable(struct weston_surface *surface)
>  	surface->geometry.x = roundf(surface->geometry.x);
>  	surface->geometry.y = roundf(surface->geometry.y);
>  
> +	/* Otherwise identity matrix, but with x and y translation. */
> +	surface->transform.position.matrix.type = WESTON_MATRIX_TRANSFORM_TRANSLATE;
> +	surface->transform.position.matrix.d[12] = surface->geometry.x;
> +	surface->transform.position.matrix.d[13] = surface->geometry.y;
> +
> +	surface->transform.matrix = surface->transform.position.matrix;
> +
> +	surface->transform.inverse.type  = WESTON_MATRIX_TRANSFORM_TRANSLATE;
> +	surface->transform.inverse.d[12] = -surface->geometry.x;
> +	surface->transform.inverse.d[13] = -surface->geometry.y;

I think you are missing initialization of the inverse matrix here, the
other elements may be arbitrary from the previous transformation.

> +
>  	pixman_region32_init_rect(&surface->transform.boundingbox,
>  				  surface->geometry.x,
>  				  surface->geometry.y,

Other than that, looking good.


Thanks,
pq


More information about the wayland-devel mailing list