Skip to content
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

Merge parallel horizontal edges in ImagingDrawPolygon #5347

Merged
merged 8 commits into from Jun 28, 2021

Conversation

radarhere
Copy link
Member

@radarhere radarhere commented Mar 20, 2021

Resolves #5235. Alternative to #5240

The issue reports missing pixels if a polygon is drawn with multiple horizontal lines in sequence, decreasing in x. This problem arises because, well, draw_horizontal_lines from #5183 loops through edges in order, working from left to right.

This PR adds a solution in ImagingDrawPolygon - is the next edge to be added a horizontal line in the same direction as the last edge? If so, don't bother adding another edge, just extend the last one.

Only the 'decreasing in x' case is necessary to fix the problem. However, since we're there, let's merge 'increasing in x' lines as well, to save a bit of memory.

@hugovk hugovk merged commit f3db65d into python-pillow:master Jun 28, 2021
@radarhere radarhere deleted the edge branch June 28, 2021 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drawing polygon gets different result with reversed xy
3 participants