Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions shared-bindings/vectorio/VectorShape.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ vectorio_draw_protocol_impl_t vectorio_vector_shape_draw_protocol_impl = {
.draw_update_transform = (draw_update_transform_fun)vectorio_vector_shape_update_transform,
.draw_finish_refresh = (draw_finish_refresh_fun)vectorio_vector_shape_finish_refresh,
.draw_get_refresh_areas = (draw_get_refresh_areas_fun)vectorio_vector_shape_get_refresh_areas,
.draw_set_dirty = (draw_set_dirty_fun)common_hal_vectorio_vector_shape_set_dirty,
};

// Stub checker does not approve of these shared properties.
Expand Down
2 changes: 2 additions & 0 deletions shared-bindings/vectorio/__init__.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ typedef bool (*draw_fill_area_fun)(mp_obj_t draw_protocol_self, const _displayio
typedef bool (*draw_get_dirty_area_fun)(mp_obj_t draw_protocol_self, displayio_area_t *current_dirty_area);
typedef void (*draw_update_transform_fun)(mp_obj_t draw_protocol_self, displayio_buffer_transform_t *group_transform);
typedef void (*draw_finish_refresh_fun)(mp_obj_t draw_protocol_self);
typedef void (*draw_set_dirty_fun)(mp_obj_t draw_protocol_self);
typedef displayio_area_t *(*draw_get_refresh_areas_fun)(mp_obj_t draw_protocol_self, displayio_area_t *tail);

typedef struct _vectorio_draw_protocol_impl_t {
Expand All @@ -25,6 +26,7 @@ typedef struct _vectorio_draw_protocol_impl_t {
draw_update_transform_fun draw_update_transform;
draw_finish_refresh_fun draw_finish_refresh;
draw_get_refresh_areas_fun draw_get_refresh_areas;
draw_set_dirty_fun draw_set_dirty;
} vectorio_draw_protocol_impl_t;

// Draw protocol
Expand Down
66 changes: 42 additions & 24 deletions shared-module/displayio/Group.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ void common_hal_displayio_group_set_hidden(displayio_group_t *self, bool hidden)
displayio_group_set_hidden_by_parent(layer, hidden);
continue;
}
#if CIRCUITPY_VECTORIO
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, self->members->items[i]);
if (draw_protocol != NULL) {
layer = draw_protocol->draw_get_protocol_self(self->members->items[i]);
draw_protocol->draw_protocol_impl->draw_set_dirty(layer);
continue;
}
#endif
}
}

Expand All @@ -92,6 +100,14 @@ void displayio_group_set_hidden_by_parent(displayio_group_t *self, bool hidden)
displayio_group_set_hidden_by_parent(layer, hidden);
continue;
}
#if CIRCUITPY_VECTORIO
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, self->members->items[i]);
if (draw_protocol != NULL) {
layer = draw_protocol->draw_get_protocol_self(self->members->items[i]);
draw_protocol->draw_protocol_impl->draw_set_dirty(layer);
continue;
}
#endif
}
}

Expand Down Expand Up @@ -358,33 +374,35 @@ void displayio_group_construct(displayio_group_t *self, mp_obj_list_t *members,
bool displayio_group_fill_area(displayio_group_t *self, const _displayio_colorspace_t *colorspace, const displayio_area_t *area, uint32_t *mask, uint32_t *buffer) {
// Track if any of the layers finishes filling in the given area. We can ignore any remaining
// layers at that point.
for (int32_t i = self->members->len - 1; i >= 0; i--) {
mp_obj_t layer;
#if CIRCUITPY_VECTORIO
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, self->members->items[i]);
if (draw_protocol != NULL) {
layer = draw_protocol->draw_get_protocol_self(self->members->items[i]);
if (draw_protocol->draw_protocol_impl->draw_fill_area(layer, colorspace, area, mask, buffer)) {
return true;
if (self->hidden == false) {
for (int32_t i = self->members->len - 1; i >= 0; i--) {
mp_obj_t layer;
#if CIRCUITPY_VECTORIO
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, self->members->items[i]);
if (draw_protocol != NULL) {
layer = draw_protocol->draw_get_protocol_self(self->members->items[i]);
if (draw_protocol->draw_protocol_impl->draw_fill_area(layer, colorspace, area, mask, buffer)) {
return true;
}
continue;
}
continue;
}
#endif
layer = mp_obj_cast_to_native_base(
self->members->items[i], &displayio_tilegrid_type);
if (layer != MP_OBJ_NULL) {
if (displayio_tilegrid_fill_area(layer, colorspace, area, mask, buffer)) {
return true;
#endif
layer = mp_obj_cast_to_native_base(
self->members->items[i], &displayio_tilegrid_type);
if (layer != MP_OBJ_NULL) {
if (displayio_tilegrid_fill_area(layer, colorspace, area, mask, buffer)) {
return true;
}
continue;
}
continue;
}
layer = mp_obj_cast_to_native_base(
self->members->items[i], &displayio_group_type);
if (layer != MP_OBJ_NULL) {
if (displayio_group_fill_area(layer, colorspace, area, mask, buffer)) {
return true;
layer = mp_obj_cast_to_native_base(
self->members->items[i], &displayio_group_type);
if (layer != MP_OBJ_NULL) {
if (displayio_group_fill_area(layer, colorspace, area, mask, buffer)) {
return true;
}
continue;
}
continue;
}
}
return false;
Expand Down