Skip to content

Commit 741cd9c

Browse files
committed
Get fill_area working
1 parent b6178c9 commit 741cd9c

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

shared-bindings/displayio/Display.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -451,9 +451,15 @@ STATIC mp_obj_t displayio_display_obj_fill_area(size_t n_args, const mp_obj_t *p
451451

452452
displayio_display_fill_area(self, &area, mask, buffer);
453453

454-
mp_obj_array_t *result = array_new(BYTEARRAY_TYPECODE, buffer_size);
455-
for (int offset = 0; offset < buffer_size; offset++) {
456-
array_subscr(result, MP_OBJ_NEW_SMALL_INT(offset), MP_OBJ_NEW_SMALL_INT(buffer[offset]));
454+
mp_obj_array_t *result = array_new(BYTEARRAY_TYPECODE, buffer_size * 4);
455+
int byte_offset = 0;
456+
for (int word_offset = 0; word_offset < buffer_size; word_offset++) {
457+
uint32_t word = buffer[word_offset];
458+
for (int byte_count = 0; byte_count < 4; byte_count++) {
459+
array_subscr(result, MP_OBJ_NEW_SMALL_INT(byte_offset), MP_OBJ_NEW_SMALL_INT(word & 0x000000FF));
460+
word >>= 8;
461+
byte_offset++;
462+
}
457463
}
458464
return result;
459465
}

0 commit comments

Comments
 (0)