calling somthing like cairo_set_dash(cr, (double[]){0, 4}, 2, 0.0) causes _cairo_stroker_line_to_dashed to call _cairo_stroker_add_leading_cap without initializing sub_start. This can be seen by running valgrind and getting a failure further down this call chain.
Created attachment 4309 [details] a test cases that exercises the failure
Created attachment 4614 [details] [review] a quick work around
The attached patch is wrong. It doesn't work properly when there are line caps. If there are line caps they should still be drawn even if the dash length is 0
*** Bug 5838 has been marked as a duplicate of this bug. ***
Created attachment 5050 [details] [review] compute the dashed line slope once and use that slope to compute line faces quick hack of a patch that appears to fix this bug.
Created attachment 5175 [details] [review] cleaner patch a cleaner patch, this time against git HEAD.
*** Bug 6158 has been marked as a duplicate of this bug. ***
Thanks to Jeff this bug is now fixed in any checkout of cairo 1.1.1 after 2006-04-09 (and the fixes will be released in the upcoming 1.2.0 release). Here are the relevant commits: commit 2078557c5c9e10cf8ae16fb3fa8a225f908ab528 Author: Jeff Muizelaar <jeff@infidigm.net> Date: Sun Apr 9 23:11:27 2006 -0400 Fix skipping zero length dash segments in dash_start. The extra check makes sure zero length segments are not skipped when computing the dash start state. This is needed so that we get proper line capping if, for example, the first dash segment has zero length and we have a dash offset of zero. commit 5eaf71e77bd975f5865cc059b4aa4d57c096688e Author: Jeff Muizelaar <jeff@infidigm.net> Date: Sun Apr 9 23:11:11 2006 -0400 Move the test for zero length sub edges below the computation of faces. Face computation still works if a line has zero length, all that is needed is a slope and a point. This patch fixes bug #5561 because the faces are initialized even if the segment has zero length as expected by _cairo_stroker_line_to_dashed. commit 20fca01a2cc539df017e442be0cc6ad35353571f Author: Jeff Muizelaar <jeff@infidigm.net> Date: Sun Apr 9 23:10:59 2006 -0400 Move calculation of slope outside of _cairo_stroker_add_sub_edge. This makes the slope calculation more accurate for dashed lines by computing it once for the entire line instead for each individual dash segment. It also adjusts stroker_line_to() to match the new convention for stroker_add_sub_edge(). commit 8a2ea660fb59beb4eacaf73978368c8db7a6b584 Author: Jeff Muizelaar <jeff@infidigm.net> Date: Sun Apr 9 23:10:46 2006 -0400 Check for zero length dashed lines. This makes line_to_dashed more like line_to by returning immediately on degenerate paths. This is needed so that we can do the slope calculation for the entire line. commit 584109d5e6160c1e74da0e79b6e024701a354293 Author: Jeff Muizelaar <jeff@infidigm.net> Date: Sun Apr 9 23:11:47 2006 -0400 Add test case for dashed lines. The new test case tests a variety of circumstances involved with zero length dashing.
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.