[cairo] Cairo lines disappear in a certain scale range

M Joonas Pihlaja jpihlaja at cc.helsinki.fi
Wed Apr 1 06:30:07 PDT 2009


Hi Robert,

On Wed, 1 Apr 2009 robert9reen at yahoo.com wrote:

> Could someone please explain to me what's going on? According to my 
> past programming experience with other libraries, such behavior may 
> be related to a variable range overflow during user-space to 
> device-space conversion operations.

Exactly right.  User space coordinates are converted to device space 
as soon as they're given to cairo, but no clipping or clamping is done 
at that time.  The device space coordinates are currently stored in 
24.8 fixed point format.

> Do you have a fix for that?

Apart from managing the user space to device space transform and path 
clipping or coordinate clamping yourself, not really.

> If not, what are the minimum/maximum limits for shape coordinates 
> and scale factors to avoid such problems?

Safe device space coordinate ranges are currently in the +-8 million 
range for path coordinates.  To be conservative, leaving a bit for 
arithmetic and keeping the coordinates in the +-4 million range ought 
to suffice.  I'm not certain what safe scale factors are, but probably 
1:16000 in and out is likely safe for all operations.  This range is 
from the fact that cairo user-to-device space matrices are sometimes 
converted into 16.16 fixed point format for software rendering.

Cheers,

Joonas


More information about the cairo mailing list