GNOME Bugzilla – Bug 685906
Wrong marker angle when control point and point of a curve are at the same position
Last modified: 2016-01-05 19:53:52 UTC
For example, with the following path: M 10,10 C 20,20 50,50 50,50 An end marker will have a wrong angle.
Created attachment 226190 [details] Sample file
Created attachment 226191 [details] Reference rendering
Created attachment 226192 [details] librsvg output
Here's what I did in order to fix this issue in lasem, which has more or less the same code as librsvg: http://git.gnome.org/browse/lasem/commit/?id=adc0ccccf820afd513f7e6929dd0fed6cab645d3
This renders better now, after all the refactoring and fixes from bug #677068. It still doesn't render the top-right arrow, though. Need to take a closer look at lasem!
OK, this is fixed now! Take a look at commit 0cfdd27ecb5023b65865d6458d9a810f48f08eb2 - this is a rewrite of the marker-drawing code. I think it's more robust than lasem's for multiple subsequent zero-length segments :) Feel free to use it there. Librsvg not only screwed up the angles; it also got NaNs in the middle vertex, which I think got Cairo into an error state so that no subsequent markers got drawn within that path. This is fixed now.
Created attachment 317732 [details] [review] NULL pointer crash! New marker bug in recent commit! https://git.gnome.org/browse/librsvg/commit/?id=7621ae4f61901c349af7cfe5ae3790b417227bf6 This fix breaks "make check" with the following SVG file: https://git.gnome.org/browse/librsvg/tree/tests/fixtures/reftests/bugs/476507.svg?id=0cfdd27ecb5023b65865d6458d9a810f48f08eb2 Markers with NULL pointer are not omitted. In consequence memory violations occure and librsvg crashes.
Good catch! I've pushed a fix that puts the test inside rsvg_marker_render() so the caller can avoid having a test at each call.