On Sun, Apr 6, 2008 at 3:27 AM, Carl Worth <cworth@...573...> wrote:
That will make the bug go away, sure. But it will introduce another. If you don't do a cairo_close_path when the SVG has the close-path ('z') operator, then you'll get caps at the beginning and ending of the path rather than a join between them.
Good catch! Although right now it does not matter, as it is only used for outline mode. But it will matter when we switch the main rendering to cairo.
For your optimization you would actually want the other half of move_to. That is, what you want to do is to change the current point, but without starting a new sub-path. I suppose we could add another function for that, but I wonder if it would be more confusing than helpful in general.
I think it would be helpful, and I think it makes perfect sense to add it, since you already have that other half-function :)
In the meantime, you can actually do the right thing, but it takes a little more effort. What you would need to do is every time you are optimizing away a path element, save the final point, (but don't issue a move_to), replacing a point saved in any immediately previously optimized-away element. Then, at the next non-optimized-away element, if there's a saved point you would issue a cairo_line_to to that point. That way, you optimize away almost as much drawing, (all but one line), but you avoid introducing the extra, undesired sub-path.
This would work, but I like it less for the obvious reason - it's less of an optimization, because it would still spend resources on drawing that invisible line. So I would prefer to use a move-without-new-subpath function.
Anyway, more than anything, I'm glad that you're playing with cairo inside of inkscape, and I want to let you know that we're always available if you have any questions or problems.
Thanks, that is very much appreciated!