Skip to content

Commit 1c56476

Browse files
committed
use draw protocol impl in parent hidden too
1 parent b6a5f42 commit 1c56476

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

shared-module/displayio/Group.c

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,6 @@
3232

3333
#if CIRCUITPY_VECTORIO
3434
#include "shared-bindings/vectorio/VectorShape.h"
35-
#include "shared-bindings/vectorio/Circle.h"
36-
#include "shared-bindings/vectorio/Rectangle.h"
37-
#include "shared-bindings/vectorio/Polygon.h"
3835
#endif
3936

4037

@@ -104,22 +101,10 @@ void displayio_group_set_hidden_by_parent(displayio_group_t *self, bool hidden)
104101
continue;
105102
}
106103
#if CIRCUITPY_VECTORIO
107-
layer = mp_obj_cast_to_native_base(
108-
self->members->items[i], &vectorio_circle_type);
109-
if (layer != MP_OBJ_NULL) {
110-
common_hal_vectorio_vector_shape_set_dirty(common_hal_vectorio_circle_get_draw_protocol(layer));
111-
continue;
112-
}
113-
layer = mp_obj_cast_to_native_base(
114-
self->members->items[i], &vectorio_rectangle_type);
115-
if (layer != MP_OBJ_NULL) {
116-
common_hal_vectorio_vector_shape_set_dirty(common_hal_vectorio_rectangle_get_draw_protocol(layer));
117-
continue;
118-
}
119-
layer = mp_obj_cast_to_native_base(
120-
self->members->items[i], &vectorio_polygon_type);
121-
if (layer != MP_OBJ_NULL) {
122-
common_hal_vectorio_vector_shape_set_dirty(common_hal_vectorio_polygon_get_draw_protocol(layer));
104+
const vectorio_draw_protocol_t *draw_protocol = mp_proto_get(MP_QSTR_protocol_draw, self->members->items[i]);
105+
if (draw_protocol != NULL) {
106+
layer = draw_protocol->draw_get_protocol_self(self->members->items[i]);
107+
draw_protocol->draw_protocol_impl->draw_set_dirty(layer);
123108
continue;
124109
}
125110
#endif

0 commit comments

Comments
 (0)