vectorio: clean up after group removal

VectorShape tells the Group to redraw whatever it left behind when it is removed now.
This commit is contained in:
warriorofwire 2020-05-10 15:36:23 -07:00
parent 6660311a96
commit 58c8e00745
3 changed files with 12 additions and 1 deletions

View File

@ -250,6 +250,8 @@ static void _remove_layer(displayio_group_t* self, size_t index) {
bool rendered_last_frame = false;
#if CIRCUITPY_VECTORIO
if (MP_OBJ_IS_TYPE(layer, &vectorio_vector_shape_type)) {
bool has_dirty_area = vectorio_vector_shape_get_dirty_area(layer, &layer_area);
rendered_last_frame = has_dirty_area;
vectorio_vector_shape_update_transform(layer, NULL);
}
else

View File

@ -64,6 +64,13 @@ static void _get_screen_area(vectorio_vector_shape_t *self, displayio_area_t *ou
}
// For use by Group to know where it needs to redraw on layer removal.
bool vectorio_vector_shape_get_dirty_area(vectorio_vector_shape_t *self, displayio_area_t *out_area) {
displayio_area_copy(&self->ephemeral_dirty_area, out_area);
return true; // For now just always redraw.
}
// This must be invoked each time a shape changes its position or its shape in any way.
void common_hal_vectorio_vector_shape_set_dirty(void *vector_shape) {
vectorio_vector_shape_t *self = vector_shape;

View File

@ -40,6 +40,8 @@ typedef struct {
displayio_area_t* vectorio_vector_shape_get_refresh_areas(vectorio_vector_shape_t *self, displayio_area_t *tail);
bool vectorio_vector_shape_get_dirty_area(vectorio_vector_shape_t *self, displayio_area_t *current_dirty_area);
// Area is always in absolute screen coordinates.
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);