Repository navigation
Clip width 1 lines to the image - #10610
aclark4life wants to merge 1 commit into
Conversation
Only step through the part of a line inside the image, using 64-bit arithmetic for the line deltas. Keep the dash phase of a clipped dashed line, and draw nothing for a dash pattern of zero length. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merging this PR will degrade performance by 12.86%2 warnings
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting Comparing Footnotes
|
Lines of width 1 were not clipped to the image before stepping through them, so the time grew with the length of the line. For example,
line((0, 0, 2**30, 1))on a 16x16 image took 1.24 s. The line deltas were also calculated inint, which could overflow for very distant coordinates.This clips the line to the image before drawing it, and uses 64-bit arithmetic for the deltas. The example now takes no measurable time.
For dashed lines (#9490, not yet released):
should_draw_dash()walked the pattern from the start of the line for each pixel.dash=(0,), now draws nothing, rather than looping forever. Negative values are treated as 0.🤖 Generated with Claude Code