<p dir="ltr"><br>
On Apr 25, 2014 8:11 AM, "Pekka Paalanen" <<a href="mailto:ppaalanen@gmail.com">ppaalanen@gmail.com</a>> wrote:<br>
><br>
> On Fri, 25 Apr 2014 13:19:37 +0100<br>
> Neil Roberts <<a href="mailto:neil@linux.intel.com">neil@linux.intel.com</a>> wrote:<br>
><br>
> > In order to apply the zoom transformation to the output matrix, Weston was<br>
> > doing the following:<br>
> ><br>
> > • Create a temporary matrix to hold the translation<br>
> > • Invert the translation matrix using weston_matrix_invert into<br>
> > another temporary matrix<br>
> > • Scale that matrix by the scale factor<br>
> > • Multiply the current matrix with the temporary matrix<br>
> ><br>
> > Using weston_matrix_invert to invert a translation matrix is over the top.<br>
> > Instead we can just negate the values we pass to weston_matrix_translate.<br>
> > Matrix multiplication is associative so creating a temporary matrix to hold the<br>
> > scale and translation transform should be equivalent to just applying them<br>
> > directly to the output matrix.<br>
> > ---<br>
> > src/compositor.c | 13 ++++---------<br>
> > 1 file changed, 4 insertions(+), 9 deletions(-)<br>
> ><br>
> > diff --git a/src/compositor.c b/src/compositor.c<br>
> > index fd2decb..f836cf7 100644<br>
> > --- a/src/compositor.c<br>
> > +++ b/src/compositor.c<br>
> > @@ -3186,8 +3186,6 @@ WL_EXPORT void<br>
> > weston_output_update_matrix(struct weston_output *output)<br>
> > {<br>
> > float magnification;<br>
> > - struct weston_matrix camera;<br>
> > - struct weston_matrix modelview;<br>
> ><br>
> > weston_matrix_init(&output->matrix);<br>
> > weston_matrix_translate(&output->matrix,<br>
> > @@ -3202,14 +3200,11 @@ weston_output_update_matrix(struct weston_output *output)<br>
> ><br>
> > if (output->zoom.active) {<br>
> > magnification = 1 / (1 - output->zoom.spring_z.current);<br>
> > - weston_matrix_init(&camera);<br>
> > - weston_matrix_init(&modelview);<br>
> > weston_output_update_zoom(output);<br>
> > - weston_matrix_translate(&camera, output->zoom.trans_x,<br>
> > - -output->zoom.trans_y, 0);<br>
> > - weston_matrix_invert(&modelview, &camera);<br>
> > - weston_matrix_scale(&modelview, magnification, magnification, 1.0);<br>
> > - weston_matrix_multiply(&output->matrix, &modelview);<br>
> > + weston_matrix_translate(&output->matrix, -output->zoom.trans_x,<br>
> > + output->zoom.trans_y, 0);<br>
> > + weston_matrix_scale(&output->matrix, magnification,<br>
> > + magnification, 1.0);<br>
> > }<br>
> ><br>
> > output->dirty = 0;<br>
><br>
> About time someone did this! :-D<br>
> Yes, please.</p>
<p dir="ltr">I'll second that.<br>
--Jason Ekstrand</p>
<p dir="ltr">><br>
><br>
> Thanks,<br>
> pq<br>
> _______________________________________________<br>
> wayland-devel mailing list<br>
> <a href="mailto:wayland-devel@lists.freedesktop.org">wayland-devel@lists.freedesktop.org</a><br>
> <a href="http://lists.freedesktop.org/mailman/listinfo/wayland-devel">http://lists.freedesktop.org/mailman/listinfo/wayland-devel</a><br>
</p>