<html>
    <head>
      <base href="https://bugs.freedesktop.org/" />
    </head>
    <body><span class="vcard"><a class="email" href="mailto:sixtysix@inwind.it" title="Massimo <sixtysix@inwind.it>"> <span class="fn">Massimo</span></a>
</span> changed
              <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Segmentation fault when using a complex path for clip and stroke"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=74779">bug 74779</a>
        <br>
             <table border="1" cellspacing="0" cellpadding="8">
          <tr>
            <th>What</th>
            <th>Removed</th>
            <th>Added</th>
          </tr>

         <tr>
           <td style="text-align:right;">Attachment #104163 is obsolete</td>
           <td>
                
           </td>
           <td>1
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Attachment #104273 is obsolete</td>
           <td>
                
           </td>
           <td>1
           </td>
         </tr>

         <tr>
           <td style="text-align:right;">Attachment #104274 is obsolete</td>
           <td>
                
           </td>
           <td>1
           </td>
         </tr></table>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Segmentation fault when using a complex path for clip and stroke"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=74779#c9">Comment # 9</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - Segmentation fault when using a complex path for clip and stroke"
   href="https://bugs.freedesktop.org/show_bug.cgi?id=74779">bug 74779</a>
              from <span class="vcard"><a class="email" href="mailto:sixtysix@inwind.it" title="Massimo <sixtysix@inwind.it>"> <span class="fn">Massimo</span></a>
</span></b>
        <pre>Created <span class=""><a href="attachment.cgi?id=105530" name="attach_105530" title="proposed patch">attachment 105530</a> <a href="attachment.cgi?id=105530&action=edit" title="proposed patch">[details]</a></span> <a href='page.cgi?id=splinter.html&bug=74779&attachment=105530'>[review]</a>
proposed patch


This patch superesedes the previous.

The problem seems to be that flooring (or rounding to the nearest)
intersections and processing START events after INTERSECTION events
causes an inversion in the active edge list, that is it happens
that introducing new edges at the same y of a floored intersection
finds two or more edges already swapped and
event_queue_insert_if_intersect_below_current_y enqueues intersections
events above the current sweep_line position because slope_compare is
incorrectly assuming left to be the left edge and right the right one.


The patched implementation of the sweep_line instead considers edges
as translated upward and shrinked by 1 and 2 epsilon.

It means that all edge lower vertices are considered positioned at
an y = nominal y - 2 * epsilon, the upper points at y - epsilon.

It follows that events having the same y are processed in the order:

STOP prior than START prior than INTERSECTION (floored to integer).

This way START and STOP events should find the active-edges
list correctly sorted, and sorting the new edges also using
slope_compare should not miss intersection, nor move the sweep line
back and forth.

Here it fixes the 3 test cases attached to this report and the 2 scripts
attached to <a class="bz_bug_link 
          bz_status_REOPENED "
   title="REOPENED --- - segfault in cairo-polygon-intersect.c: active_edges()"
   href="show_bug.cgi?id=59098">bug 59098</a>, plus I can open in evince the pdf mentioned in

<a href="https://bugzilla.redhat.com/show_bug.cgi?id=1134832">https://bugzilla.redhat.com/show_bug.cgi?id=1134832</a>

with the side panel (thumb pages) visible.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the QA Contact for the bug.</li>
      </ul>
    </body>
</html>