Skip to content

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

2 participants