[cairo] Matrix Inconsistency?

Bryce Harrington bryce at osg.samsung.com
Tue Jul 5 21:28:38 UTC 2016


On Thu, Jun 30, 2016 at 03:57:15PM +1200, Lawrence D'Oliveiro wrote:
> I wrote:
>
> > ... the docs for cairo_transform
> > <https://www.cairographics.org/manual/cairo-Transformations.html#cairo-transform>
> > say “The new transformation of user space takes place after any
>                                                         ^^^^^
> > existing transformation”.
>
> I think the fix should be to change “after” to “before”.

Is this the relevant bit of code?

_cairo_gstate_transform (cairo_gstate_t       *gstate,
			 const cairo_matrix_t *matrix)
{
    cairo_matrix_t tmp;
    // ...

    cairo_matrix_multiply (&gstate->ctm, matrix, &gstate->ctm);
    cairo_matrix_multiply (&gstate->ctm_inverse, &gstate->ctm_inverse, &tmp);
    // ...

So there, matrix is indeed being passed first...


Fwiw, I also ran across this fixme in cairo_matrix_multiply:

/*
 * XXX: The ordering of the arguments to this function corresponds
 *      to [row_vector]*A*B. If we want to use column vectors instead,
 *      then we need to switch the two arguments and fix up all
 *      uses.
 */
void
cairo_matrix_multiply (cairo_matrix_t *result, const cairo_matrix_t *a, const cairo_matrix_t *b)

That was introduced in commit 0b09748296ea3f0ebb554061ef248373b8437947,
which changed the order of transformation in the docs for
multiply/scale/rotate/translate.  That didn't touch the transform docs,
perhaps it should have?


Bryce


More information about the cairo mailing list