[cairo] Reduce number of floating point operations

Carl Worth cworth at cworth.org
Mon Sep 25 11:26:53 PDT 2006

On Mon, 25 Sep 2006 20:55:36 +0000, Aivars Kalvans wrote:
> At first I should explain that I added some printf's to print ctm and
> device_transform matrices. Often matrix had non-zero x0 and y0 while
> xx=1, yx=0, xy=0 and yy=1. So I used it as a common case, not
> {1,0,0,1,0,0}. That should explain why I check only first 4 doubles in
> cairo_matrix_is_identity.

Sure. A translation-only matrix will be quite common. It's just not an
identity matrix.

> > I'm confused here. These identity matrices have translation components
> > of (0,0) by definition. So why are we adding them in here?
> >
> I hope I answered it above.

So then that code needs to be fixed. The "is_identity" predicate must
not return a true value if there is a non-zero translation
component. See the discussion previously in this thread that describes
the 3x3 matrix we are really working with here, (with an implicit
third column).

> > So, it's really hard to look at the two implementations above and not
> > be convinced that there are bugs in that one uses xx, xy, yx, and yy
> > while the other one does not.
> I can't be 100% sure that it's correct, but I did the math at least twice.

Oh, I think I verified that your implementation is correct, (or at
least plausible). It's just that I'd rather have the implementation be
easier to read than that. (Or failing that, the tricky bits should get
some comments).

> Unfortunately, I'm very busy at work lately, so I don't have time to
> work on this patch and won't have it in near future. It would be nice if
> someone could continue to work on this patch.

OK. So, thanks for the patches. There's definitely lots of useful
stuff here. I'll see if I can get some time to clean some of it up and
get it in this week or next, (though, don't let that stop anybody from
taking a whack at it).

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.freedesktop.org/archives/cairo/attachments/20060925/49e88d73/attachment.pgp

More information about the cairo mailing list