debugging prints. add rendered_hidden field to tilegrid

This commit is contained in:
foamyguy 2023-05-31 20:57:17 -05:00
parent 06057a63e6
commit 4ad54b2853
4 changed files with 30 additions and 9 deletions

View File

@ -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;
}

View File

@ -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;

View File

@ -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) {

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