Merge pull request #7611 from gamblor21/colorconverter-mem-fix

ColorConverter output colorspace non-initialization fix
This commit is contained in:
Dan Halbert 2023-02-19 20:34:30 -05:00 committed by GitHub
commit 3f66a0be83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 3 additions and 3 deletions

View File

@ -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);

View File

@ -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) {

View File

@ -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;