From 4ad54b285378744a796a2ad2c25e83ab8e12573e Mon Sep 17 00:00:00 2001 From: foamyguy Date: Wed, 31 May 2023 20:57:17 -0500 Subject: [PATCH] debugging prints. add rendered_hidden field to tilegrid --- shared-module/displayio/Display.c | 3 +++ shared-module/displayio/Group.c | 8 +++++--- shared-module/displayio/TileGrid.c | 25 +++++++++++++++++++------ shared-module/displayio/TileGrid.h | 3 +++ 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/shared-module/displayio/Display.c b/shared-module/displayio/Display.c index 093604214d..ae2b4efe6b 100644 --- a/shared-module/displayio/Display.c +++ b/shared-module/displayio/Display.c @@ -330,7 +330,10 @@ STATIC void _refresh_display(displayio_display_obj_t *self) { return; } const displayio_area_t *current_area = _get_refresh_areas(self); + int i = 0; while (current_area != NULL) { + mp_printf(&mp_plat_print, "calling refresh area: %d \n", i); + i = i + 1; _refresh_area(self, current_area); current_area = current_area->next; } diff --git a/shared-module/displayio/Group.c b/shared-module/displayio/Group.c index bd62280c96..3cdb32ca2f 100644 --- a/shared-module/displayio/Group.c +++ b/shared-module/displayio/Group.c @@ -438,7 +438,7 @@ void displayio_group_finish_refresh(displayio_group_t *self) { } displayio_area_t *displayio_group_get_refresh_areas(displayio_group_t *self, displayio_area_t *tail) { - if (! self->hidden){ + //if (! self->hidden){ if (self->item_removed) { self->dirty_area.next = tail; tail = &self->dirty_area; @@ -457,8 +457,10 @@ 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) { - if (!common_hal_displayio_tilegrid_get_hidden(layer)){ + if (!displayio_tilegrid_get_rendered_hidden(layer)) { + //if (!common_hal_displayio_tilegrid_get_hidden(layer)){ tail = displayio_tilegrid_get_refresh_areas(layer, tail); + //} } continue; } @@ -468,7 +470,7 @@ displayio_area_t *displayio_group_get_refresh_areas(displayio_group_t *self, dis tail = displayio_group_get_refresh_areas(layer, tail); continue; } - } + // } } return tail; diff --git a/shared-module/displayio/TileGrid.c b/shared-module/displayio/TileGrid.c index 723aa41682..fd972a9b5e 100644 --- a/shared-module/displayio/TileGrid.c +++ b/shared-module/displayio/TileGrid.c @@ -82,10 +82,16 @@ 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; if (!hidden) { self->full_change = true; + }else{ + self->rendered_hidden = false; } } @@ -578,16 +584,23 @@ void displayio_tilegrid_finish_refresh(displayio_tilegrid_t *self) { } displayio_area_t *displayio_tilegrid_get_refresh_areas(displayio_tilegrid_t *self, displayio_area_t *tail) { + //mp_printf(&mp_plat_print, "x1 : %d x2: %d \n", self->previous_area.x1, self->previous_area.x2); bool first_draw = self->previous_area.x1 == self->previous_area.x2; bool hidden = self->hidden || self->hidden_by_parent; + //mp_printf(&mp_plat_print, "first draw: %d\n", first_draw); // Check hidden first because it trumps all other changes. if (hidden) { - if (!first_draw) { - self->previous_area.next = tail; - return &self->previous_area; - } else { - return tail; - } + //mp_printf(&mp_plat_print, "rendered_hidden: %d\n", self->rendered_hidden); + //if (!self->rendered_hidden){ + self->rendered_hidden = true; + if (!first_draw) { + self->previous_area.next = tail; + return &self->previous_area; + } else { + return tail; + } + //} + } else if (self->moved && !first_draw) { displayio_area_union(&self->previous_area, &self->current_area, &self->dirty_area); if (displayio_area_size(&self->dirty_area) <= 2U * self->pixel_width * self->pixel_height) { diff --git a/shared-module/displayio/TileGrid.h b/shared-module/displayio/TileGrid.h index b5aab51348..4f5cfbc62f 100644 --- a/shared-module/displayio/TileGrid.h +++ b/shared-module/displayio/TileGrid.h @@ -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