[Cairo] Stroke problems

Soorya Kuloor skuloor at verano.com
Thu Sep 4 10:28:18 PDT 2003

Hi Carl,

I have seen strange horizontal lines show up in some of our schematics.
It happens only for certain window sizes and I could not reproduce it in
a C test code. However, I dug into the cairo code and have narrowed down
the problem to line 238 in cairo_path_stroke.c in the line joining code.

This line does if() on a double. In cases where the strange horizontal
lines appear the value of dy1 is generally very small negative value
(say around -5.29396e-23). In such cases the if statement succeeds and
the value of mx becomes a large -ve value. This somehow causes the
horizontal lines to appear. This especially happens if the edges in the
polygons are very close to being horizontal but are not exactly.

I changed the line to read 'if (XDoubleToFixed(dy1))' and the artifacts
went away. However, I do not know whether this is the right thing to do
here. Is there a cleaner fix either here or somewhere higher up?

-- Soorya

More information about the cairo mailing list