jpegxl: Ensure decoded bitmap format is converted to front end format

This commit is contained in:
Michael Drake 2023-11-26 17:01:03 +00:00
parent d59f30c683
commit f68aca93b7

View File

@ -97,6 +97,17 @@ jpegxl_cache_convert(struct content *c)
const uint8_t *src_data; const uint8_t *src_data;
size_t src_size; size_t src_size;
uint8_t * output; uint8_t * output;
bitmap_fmt_t jxl_fmt = {
/** TODO: At the moment we have to set the layout to the only
* pixel layout that libjxl supports. It looks like they
* plan to add support for decoding to other layouts
* in the future, as shown by the TODO in the docs:
*
* https://libjxl.readthedocs.io/en/latest/api_common.html#_CPPv414JxlPixelFormat
*/
.layout = BITMAP_LAYOUT_R8G8B8A8,
.pma = bitmap_fmt.pma,
};
jxldec = JxlDecoderCreate(NULL); jxldec = JxlDecoderCreate(NULL);
if (jxldec == NULL) { if (jxldec == NULL) {
@ -180,8 +191,9 @@ jpegxl_cache_convert(struct content *c)
JxlDecoderDestroy(jxldec); JxlDecoderDestroy(jxldec);
bitmap_format_to_client(bitmap, &jxl_fmt);
guit->bitmap->modified(bitmap); guit->bitmap->modified(bitmap);
return bitmap; return bitmap;
} }