Skip to content

Fix draw_polygon and draw_circle leaving pixels off the screen - #11701

Open
mikeysklar wants to merge 2 commits into
adafruit:mainfrom
mikeysklar:fix-9239-polygon-dirty
Open

mikeysklar wants to merge 2 commits into
adafruit:mainfrom
mikeysklar:fix-9239-polygon-dirty

Conversation

@mikeysklar

@mikeysklar mikeysklar commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

What

Polygons and circles drawn with bitmaptools now fully appear on the display.

Why

The right and bottom edges were left out of the screen update.

Fixes #9239.

Testing

Where Script Before After
CLUE, current main Issue's script Gap in ring No gap
CLUE, current main Circle, radius 50 Two gaps No gaps
Desktop lab Issue's script 12 pixels missing 0
Desktop lab Horizontal polygon line 201 of 201 missing 0
Desktop lab Circle, radius 50 30 of 284 missing 0

The CLUE tested each fix on its own. The lab also tested both together. CLUE builds had hashlib turned off. Desktop lab is cp-desktop-lab. Other boards not tested.

draw_polygon on a CLUE, stock on the left, fixed on the right:

CLUE running the issue script, stock firmware with a gap in the ring and fixed firmware with no gap

draw_circle on a CLUE, stock on the left, fixed on the right:

CLUE drawing a circle, stock firmware with two gaps and fixed firmware with none

AI assistance

Claude helped find and test this. I checked the CLUE results.

🤖 Generated with Claude Code

…area

The dirty area's x2 and y2 are exclusive, but draw_polygon passed the
largest x and y it drew. Pixels on the right and bottom edges stayed off
the display, and purely horizontal or vertical lines did not appear.

Fixes adafruit#9239.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mikeysklar

Copy link
Copy Markdown
Collaborator Author

@lynt-smitka your cp-desktop-lab reproduced this before I tried it on a CLUE. Comparing its screenshots with the bitmap showed exactly which pixels were missing, which pointed to the cause. Thanks, it was really helpful!

The same exclusive-limit mistake as draw_polygon: pixels on the right and
bottom edges stayed off the display, and a circle of radius 0 did not
appear.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@mikeysklar mikeysklar changed the title Fix draw_polygon leaving pixels off the screen Fix draw_polygon and draw_circle leaving pixels off the screen Nov 1, 2026
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.

lines drawn with bitmaptools.draw_polygon to a bitmap can partially fail to update a screen

1 participant