-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix #5948: Don't clip closed paths #5955
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
How does this relate (if at all) with #5911? On Mon, Feb 1, 2016 at 4:28 PM, Michael Droettboom <notifications@github.com
|
Failures look like
|
In this case, I think we update the test... |
Isn't that test also modified in #5911? On Mon, Feb 1, 2016 at 5:44 PM, Michael Droettboom <notifications@github.com
|
#5911 fixes the problem that there was always a MOVETO command emitted at the beginning, even if that MOVETO command was out of bounds. This deals with not inserting MOVETO commands in the middle of a closed shape -- by bluntly just turning off clipping for closed paths. The test changed to be more correct (coincidentally) in both cases. One by not having two MOVETO commands at the beginning, and the other by not running clipping at all on the path. So, in a sense, the broken test is now testing something really easy (copying values from one place to another), but it's probably worth keeping anyway. |
@@ -488,7 +488,7 @@ RendererAgg::draw_path(GCAgg &gc, PathIterator &path, agg::trans_affine &trans, | |||
|
|||
transformed_path_t tpath(path, trans); | |||
nan_removed_t nan_removed(tpath, true, path.has_curves()); | |||
clipped_t clipped(nan_removed, clip, width, height); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't we only want to skip this if the path has a close command, not just any code points.
@tacaswell is definitely related I'll pull your latest code and check later on. Thanks for the reference. |
Fix #5948: Don't clip closed paths
The issue is that the clipping algorithm may create a moveto command if the polygon is clipped outside of the image. A subsequent "close poly" command will then close the polygon to that last moveto command, rather than the original moveto location.
I'm not sure there's a good solution to this: One needs the closepoly command to actually close the poly (if you just to a lineto to the original point, the line isn't "joined" at the corner properly... not getting that detail right has been the source of other bugs in the past.) The only correct solution I can think of is to "rotate" the order of the vertices so that the closepoly always ends up outside of the clipping box. But that just sounds hard to do efficiently.
In the meantime, I think the best fix is to just turn off clipping for all paths that have a closepoly on the grounds that large polygons are less likely to require clipping anyway vs. the many-vertex line plots that are quite common.