Skip to content

Speed up filling polygons with many points - #10609

Open
aclark4life wants to merge 1 commit into
mainfrom
polygon-scanline-speedup
Open

aclark4life wants to merge 1 commit into
mainfrom
polygon-scanline-speedup

Conversation

@aclark4life

Copy link
Copy Markdown
Member

polygon_generic() rescanned earlier edges to match corners, and when blending, walked every horizontal edge for each filled span, so filling a polygon took time quadratic in the number of points.

This sorts the edge ends once to match corners, and steps through the horizontal edges in order.

main This PR
32,000 zig-zag points, mode L 0.94 s 0.008 s
10,000 points, translucent RGBA 2.63 s 0.018 s

The output is unchanged.

🤖 Generated with Claude Code

Sort the edges once to match corners, rather than rescanning earlier
edges, and step through horizontal edges in order when blending.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant