Skip to content

Commit 58c8e00

Browse files
committed
vectorio: clean up after group removal
VectorShape tells the Group to redraw whatever it left behind when it is removed now.
1 parent 6660311 commit 58c8e00

File tree

3 files changed

+12
-1
lines changed

3 files changed

+12
-1
lines changed

shared-module/displayio/Group.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,8 @@ static void _remove_layer(displayio_group_t* self, size_t index) {
250250
bool rendered_last_frame = false;
251251
#if CIRCUITPY_VECTORIO
252252
if (MP_OBJ_IS_TYPE(layer, &vectorio_vector_shape_type)) {
253+
bool has_dirty_area = vectorio_vector_shape_get_dirty_area(layer, &layer_area);
254+
rendered_last_frame = has_dirty_area;
253255
vectorio_vector_shape_update_transform(layer, NULL);
254256
}
255257
else

shared-module/vectorio/VectorShape.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,13 @@ static void _get_screen_area(vectorio_vector_shape_t *self, displayio_area_t *ou
6464
}
6565

6666

67+
// For use by Group to know where it needs to redraw on layer removal.
68+
bool vectorio_vector_shape_get_dirty_area(vectorio_vector_shape_t *self, displayio_area_t *out_area) {
69+
displayio_area_copy(&self->ephemeral_dirty_area, out_area);
70+
return true; // For now just always redraw.
71+
}
72+
73+
6774
// This must be invoked each time a shape changes its position or its shape in any way.
6875
void common_hal_vectorio_vector_shape_set_dirty(void *vector_shape) {
6976
vectorio_vector_shape_t *self = vector_shape;

shared-module/vectorio/VectorShape.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ typedef struct {
3838
displayio_area_t ephemeral_dirty_area;
3939
} vectorio_vector_shape_t;
4040

41-
displayio_area_t* vectorio_vector_shape_get_refresh_areas(vectorio_vector_shape_t *self, displayio_area_t* tail);
41+
displayio_area_t* vectorio_vector_shape_get_refresh_areas(vectorio_vector_shape_t *self, displayio_area_t *tail);
42+
43+
bool vectorio_vector_shape_get_dirty_area(vectorio_vector_shape_t *self, displayio_area_t *current_dirty_area);
4244

4345
// Area is always in absolute screen coordinates.
4446
bool vectorio_vector_shape_fill_area(vectorio_vector_shape_t *self, const _displayio_colorspace_t *colorspace, const displayio_area_t *area, uint32_t *mask, uint32_t *buffer);

0 commit comments

Comments
 (0)