[cairo] Gradient mesh rasterizer

James Cloos cloos at jhcloos.com
Sun Jul 19 17:58:45 PDT 2009


>>>>> "Paolo" == Paolo Bonzini <bonzini at gnu.org> writes:

Paolo> I don't think they're very expensive, at least on x86.  If they were,
Paolo> I'd first investigate compiling pixman and/or cairo with -ffast-math.

They are expensive because the C spec requires a different rounding mode
for casting a double to an int than it does for fp math, which means
that the compiler has to reset the fp control word before and after
every cast.

The lrint(3) and llrint(3) functions were invented to avoid that requirement;
they are spec'ed to use the current rounding mode, whatever that may be.

Cairo has a function which does a multiply followed by a bit
manipulation to grab out a 32 bit int from a 64-bit double.

Either cairo's existing function or lrint(3) are required for fast
casting from doubles to integers.

-JimC
-- 
James Cloos <cloos at jhcloos.com>         OpenPGP: 1024D/ED7DAEA6


More information about the cairo mailing list