Merge pull request #8050 from FoamyGuy/hidden_refresh_areas

don't consider refresh areas for hidden groups or tilegrids
This commit is contained in:
Scott Shawcroft 2023-06-21 09:56:27 -07:00 committed by GitHub
commit 0da62416a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 13 additions and 1 deletions

View File

@ -456,7 +456,9 @@ displayio_area_t *displayio_group_get_refresh_areas(displayio_group_t *self, dis
layer = mp_obj_cast_to_native_base(
self->members->items[i], &displayio_tilegrid_type);
if (layer != MP_OBJ_NULL) {
tail = displayio_tilegrid_get_refresh_areas(layer, tail);
if (!displayio_tilegrid_get_rendered_hidden(layer)) {
tail = displayio_tilegrid_get_refresh_areas(layer, tail);
}
continue;
}
layer = mp_obj_cast_to_native_base(

View File

@ -82,8 +82,13 @@ bool common_hal_displayio_tilegrid_get_hidden(displayio_tilegrid_t *self) {
return self->hidden;
}
bool displayio_tilegrid_get_rendered_hidden(displayio_tilegrid_t *self) {
return self->rendered_hidden;
}
void common_hal_displayio_tilegrid_set_hidden(displayio_tilegrid_t *self, bool hidden) {
self->hidden = hidden;
self->rendered_hidden = false;
if (!hidden) {
self->full_change = true;
}
@ -91,6 +96,7 @@ void common_hal_displayio_tilegrid_set_hidden(displayio_tilegrid_t *self, bool h
void displayio_tilegrid_set_hidden_by_parent(displayio_tilegrid_t *self, bool hidden) {
self->hidden_by_parent = hidden;
self->rendered_hidden = false;
if (!hidden) {
self->full_change = true;
}
@ -582,6 +588,7 @@ displayio_area_t *displayio_tilegrid_get_refresh_areas(displayio_tilegrid_t *sel
bool hidden = self->hidden || self->hidden_by_parent;
// Check hidden first because it trumps all other changes.
if (hidden) {
self->rendered_hidden = true;
if (!first_draw) {
self->previous_area.next = tail;
return &self->previous_area;

View File

@ -66,6 +66,7 @@ typedef struct {
bool transpose_xy : 1;
bool hidden : 1;
bool hidden_by_parent : 1;
bool rendered_hidden : 1;
uint8_t padding : 6;
} displayio_tilegrid_t;
@ -86,4 +87,6 @@ void displayio_tilegrid_update_transform(displayio_tilegrid_t *group, const disp
bool displayio_tilegrid_get_previous_area(displayio_tilegrid_t *self, displayio_area_t *area);
void displayio_tilegrid_finish_refresh(displayio_tilegrid_t *self);
bool displayio_tilegrid_get_rendered_hidden(displayio_tilegrid_t *self);
#endif // MICROPY_INCLUDED_SHARED_MODULE_DISPLAYIO_TILEGRID_H