Merge pull request #7611 from gamblor21/colorconverter-mem-fix
ColorConverter output colorspace non-initialization fix
This commit is contained in:
commit
3f66a0be83
@ -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);
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user