Skip to content

displayio: include vectorio members in a Group's previous area - #12022

Merged
tannewt merged 2 commits into
adafruit:mainfrom
adrianwells:fix-group-previous-area-vectorio
Dec 4, 2026
Merged

tannewt merged 2 commits into
adafruit:mainfrom
adrianwells:fix-group-previous-area-vectorio

Conversation

@adrianwells

Copy link
Copy Markdown

Fixes #12003.

displayio_group_get_previous_area() handled only TileGrid and Group members. For a draw protocol member (vectorio shape, videocore buffer), neither branch ran and layer_area was read uninitialized. Removing a Group that contains vectorio shapes therefore left the shapes on screen.

Fix: get the area from draw_get_dirty_area(), as _remove_layer() already does for a direct draw protocol member, and skip members with no area.

Testing

PyPortal (SAMD51, ILI9341), script from #12003:

Build Result
main at 634fded Green TileGrid and green Rectangle remain on screen
main + fix Only the red square remains (correct)

Built with Arm GNU Toolchain 15.3.Rel1 (make BOARD=pyportal). tools/codeformat.py reports no changes.

LLM assistance

Patch and builds by Claude Code; hardware test run and checked manually.

🤖 Generated with Claude Code

displayio_group_get_previous_area() only handled TileGrid and Group
members. For a draw protocol member (vectorio shape, videocore buffer)
neither branch ran and layer_area was used without being set, so when a
Group containing vectorio shapes was removed from its parent, the shapes'
area was not marked dirty and the shapes stayed on screen.

Get the area from draw_get_dirty_area(), as _remove_layer() does for a
direct draw protocol member, and skip any member that has no area
instead of reading layer_area uninitialized.

Fixes adafruit#12003

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dhalbert
dhalbert requested a review from a team December 2, 2026 22:56

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a native_sim based test that tests this case. I appreciate your manual testing. Adding a native_sim test will ensure it doesn't get broken in the future too.

A Group with a Circle and a Rectangle is shown and then removed from the
root group. The capture after the removal must show only the rectangle
that stays in the root group. Without the previous commit the legacy
compositor leaves the removed shapes on screen.

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

Copy link
Copy Markdown
Author

Added test_vectorio_remove_group to ports/zephyr-cp/tests/test_vectorio.py. It shows a Group holding a Circle and a Rectangle, removes the Group from the root group and compares the whole frame: only a Rectangle that stays in the root group may be left. Without the fix the legacy compositor leaves the removed shapes on screen. It runs on all native_sim boards, legacy and LVGL.

@tannewt tannewt left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@tannewt
tannewt merged commit bf40142 into adafruit:main Dec 4, 2026
18 checks passed
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.

displayio: removing a Group that contains vectorio shapes leaves the shapes on screen (displayio_group_get_previous_area ignores vectorio)

2 participants