diff --git a/shared-bindings/displayio/ColorConverter.c b/shared-bindings/displayio/ColorConverter.c index 9c3d297fdc..06de5a4b09 100644 --- a/shared-bindings/displayio/ColorConverter.c +++ b/shared-bindings/displayio/ColorConverter.c @@ -73,10 +73,8 @@ STATIC mp_obj_t displayio_colorconverter_obj_convert(mp_obj_t self_in, mp_obj_t displayio_colorconverter_t *self = MP_OBJ_TO_PTR(self_in); mp_int_t color = mp_arg_validate_type_int(color_obj, MP_QSTR_color); - _displayio_colorspace_t colorspace; - colorspace.depth = 16; uint32_t output_color; - common_hal_displayio_colorconverter_convert(self, &colorspace, color, &output_color); + common_hal_displayio_colorconverter_convert(self, &self->output_colorspace, color, &output_color); return MP_OBJ_NEW_SMALL_INT(output_color); } MP_DEFINE_CONST_FUN_OBJ_2(displayio_colorconverter_convert_obj, displayio_colorconverter_obj_convert); diff --git a/shared-module/displayio/ColorConverter.c b/shared-module/displayio/ColorConverter.c index 707601a3e7..078c7876e4 100644 --- a/shared-module/displayio/ColorConverter.c +++ b/shared-module/displayio/ColorConverter.c @@ -45,6 +45,7 @@ void common_hal_displayio_colorconverter_construct(displayio_colorconverter_t *s self->dither = dither; self->transparent_color = NO_TRANSPARENT_COLOR; self->input_colorspace = input_colorspace; + self->output_colorspace.depth = 16; } uint16_t displayio_colorconverter_compute_rgb565(uint32_t color_rgb888) { diff --git a/shared-module/displayio/ColorConverter.h b/shared-module/displayio/ColorConverter.h index 7e4e9819ac..f67b1dbfda 100644 --- a/shared-module/displayio/ColorConverter.h +++ b/shared-module/displayio/ColorConverter.h @@ -37,6 +37,7 @@ typedef struct displayio_colorconverter { mp_obj_base_t base; bool dither; uint8_t input_colorspace; + _displayio_colorspace_t output_colorspace; uint32_t transparent_color; } displayio_colorconverter_t;