[cairo] strange trapezoid produced by cairo

M Joonas Pihlaja jpihlaja at cc.helsinki.fi
Mon Jun 2 01:42:21 PDT 2008


Gah... I replied to the wrong thread "[cairo] intersect_lines in 
Bentley Ottman implementation".  The misdirected answer is 
reproduced below for your convenience. :)

Joonas

8<----------8<----------8<----------8<----------

Hi,

It's a little annoying I can't test for the bug using the client
side API.  Filling is masked by pixman as mentioned before, and
cairo_in_fill() doesn't expose it either.  Below is a patch that
doesn't introduce failures in the test suite and fixes the wrong
trap generation.

The broken and fixed tessellations are visible here (flip through
the pages, note the last trap in the broken version):

http://www.discontinuity.info/~rowan/broke-star.ps
http://www.discontinuity.info/~rowan/fixed-star.ps

Joonas

diff --git a/src/cairo-bentley-ottmann.c
b/src/cairo-bentley-ottmann.c
index 208da7c..a2c55a2 100644
--- a/src/cairo-bentley-ottmann.c
+++ b/src/cairo-bentley-ottmann.c
@@ -1214,7 +1214,7 @@ _active_edges_to_traps (cairo_bo_edge_t           *head,
       int in_out = 0;
       cairo_bo_edge_t *edge;

-    for (edge = head; edge && edge->next; edge = edge->next) {
+    for (edge = head; edge; edge = edge->next) {
          if (fill_rule == CAIRO_FILL_RULE_WINDING) {
              if (edge->reversed)
                  in_out++;




More information about the cairo mailing list