[cairo] Path fill bug

Charles Tuckey ctuckey at verano.com
Fri Aug 6 14:29:56 PDT 2004


We have discovered a bug in the way cairo (or its backends) fill a 
particular concave polygon. Using glitz this polygon has some extra fill 
on its left side; using xlib or pixman the polygon lower interior is not 
filled. Stroking the polygon works fine.

The polygon is drawn as follows:
   cairo_new_path (cr);
   cairo_move_to (cr, x, y);
   cairo_line_to (cr, x2, y);
   cairo_line_to (cr, x, y2);
   cairo_line_to (cr, x2, y2);
   cairo_close_path (cr);

I have attached three cairo snippets that illustrate the problem:
   concave_poly_fill_large.cairo  - fills properly
   concave_poly_fill_small.cairo  - does not fill properly
   concave_poly_stroke_small.cairo - strokes properly

We have also noticed the problem on surfaces with larger extents where 
x2 has a large number of decimal places (7), especially if the x2s are 
not precisely the same, i.e. they differ by one in the last decimal place.

Sorry no patch! :)

charlie
-------------- next part --------------
cairo_set_rgb_color (cr, 0.000000, 1.000000, 1.000000);
cairo_new_path (cr);
cairo_move_to (cr, 0.25, 0.25);
cairo_line_to (cr, 0.75, 0.25);
cairo_line_to (cr, 0.25, 0.75);
cairo_line_to (cr, 0.75, 0.75);
cairo_close_path (cr);
cairo_fill (cr);
-------------- next part --------------
cairo_set_rgb_color (cr, 0.000000, 1.000000, 1.000000);
cairo_new_path (cr);
cairo_move_to (cr, 0.300000, 0.300000);
cairo_line_to (cr, 0.500000, 0.300000);
cairo_line_to (cr, 0.300000, 0.700000);
cairo_line_to (cr, 0.500000, 0.700000);
cairo_close_path (cr);
cairo_fill (cr);
-------------- next part --------------
cairo_set_rgb_color (cr, 0.000000, 1.000000, 1.000000);
cairo_new_path (cr);
cairo_move_to (cr, 0.300000, 0.300000);
cairo_line_to (cr, 0.500000, 0.300000);
cairo_line_to (cr, 0.300000, 0.700000);
cairo_line_to (cr, 0.500000, 0.700000);
cairo_close_path (cr);
cairo_stroke (cr);


More information about the cairo mailing list