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

Pekka Paalanen ppaalanen at gmail.com
Thu Feb 28 02:27:41 PST 2013


On Wed, 20 Feb 2013 12:46:42 -0500
Kristian Høgsberg <hoegsberg at gmail.com> wrote:

> On Wed, Feb 20, 2013 at 01:05:42PM +0200, Pekka Paalanen wrote:
> > 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.
> 
> Yes, you're right.  I'll just do
> 
>         surface->transform.inverse = surface->transform.position.matrix;
> 
> instead of the inverse.type assignment and we should be good.  Nice catch.

Hi,

did you forget this fix? :-)


Thanks,
pq


More information about the wayland-devel mailing list