Created attachment 116882 [details] clipped dashed line not drawn Expected results: The portion of the blue line within the gray clipping rectangle should be green. Actual results: The portion of the blue line within the gray clipping rectangle is red.
This originated from firefox bug https://bugzilla.mozilla.org/show_bug.cgi?id=1179859 but seems to still be broken in current cairo. It looks like there's a bug in _cairo_box_intersects_line_segment. In the testcase, when (fully_in_bounds || (! stroker->has_first_face && stroker->dash.dash_starts_on) || _cairo_box_intersects_line_segment (&stroker->bounds, &segment)) is tested in _cairo_stroker_line_to_dashed, the first two tests fail, but the third should pass and doesn't. Inside _cairo_box_intersects_line_segment we get xlen=5120, t1=-58147, and t2=63267, so the if ((t1 < 0 || t1 > xlen) && (t2 < 0 || t2 > xlen)) return FALSE; test mistakenly returns FALSE.
Created attachment 117352 [details] [review] fix _cairo_box_intersects_line_segment early rejection tests As described by Tom, there seem to be problems with the early rejection tests in _cairo_box_intersects_line_segment, or at least, I could see no logical reason for the way they were written. Fixing these to verify as expected that the box is either wholly to the left, right, top, or bottom of the line segment, as done in this patch, fixes the issue on these test cases in Firefox. We would appreciate if this patch could get incorporated upstream.
-- GitLab Migration Automatic Message -- This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity. You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/cairo/cairo/issues/20.
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.