summaryrefslogtreecommitdiff
path: root/shared-module
diff options
context:
space:
mode:
authorwarriorofwire <3454741+WarriorOfWire@users.noreply.github.com>2020-05-10 15:36:23 -0700
committerwarriorofwire <3454741+WarriorOfWire@users.noreply.github.com>2020-05-10 15:36:23 -0700
commit58c8e00745064bd290fc9ec18a838960b27c1eea (patch)
treec48c977580d74366d9fe8db24e726d3a62eec949 /shared-module
parent6660311a96f063e935e85a228f8b12e3a07ca95c (diff)
vectorio: clean up after group removal
VectorShape tells the Group to redraw whatever it left behind when it is removed now.
Diffstat (limited to 'shared-module')
-rw-r--r--shared-module/displayio/Group.c2
-rw-r--r--shared-module/vectorio/VectorShape.c7
-rw-r--r--shared-module/vectorio/VectorShape.h4
3 files changed, 12 insertions, 1 deletions
diff --git a/shared-module/displayio/Group.c b/shared-module/displayio/Group.c
index d6df01f3d..15cf5b8e4 100644
--- a/shared-module/displayio/Group.c
+++ b/shared-module/displayio/Group.c
@@ -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
diff --git a/shared-module/vectorio/VectorShape.c b/shared-module/vectorio/VectorShape.c
index b23baa4cf..f57739047 100644
--- a/shared-module/vectorio/VectorShape.c
+++ b/shared-module/vectorio/VectorShape.c
@@ -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;
diff --git a/shared-module/vectorio/VectorShape.h b/shared-module/vectorio/VectorShape.h
index 8fc698dbc..56eb3d8a5 100644
--- a/shared-module/vectorio/VectorShape.h
+++ b/shared-module/vectorio/VectorShape.h
@@ -38,7 +38,9 @@ typedef struct {
displayio_area_t ephemeral_dirty_area;
} vectorio_vector_shape_t;
-displayio_area_t* vectorio_vector_shape_get_refresh_areas(vectorio_vector_shape_t *self, displayio_area_t* tail);
+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);