[PATCH 1/2] compositor: Make sure surface->transform.matrix,inverse are always valid
Kristian Høgsberg
hoegsberg at gmail.com
Wed Feb 20 09:46:42 PST 2013
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.
Kristian
> > +
> > 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