summaryrefslogtreecommitdiff
path: root/content/handlers
diff options
context:
space:
mode:
authorMichael Drake <tlsa@netsurf-browser.org>2023-11-26 17:01:03 +0000
committerMichael Drake <tlsa@netsurf-browser.org>2023-11-26 17:26:09 +0000
commitf68aca93b7e9f5dd05f1e49ba8ae70ada3ef3d1f (patch)
tree1bd969fdff9af91937dfe3ecab2d5fc25819cf02 /content/handlers
parentd59f30c683b9c65a3380a8276247141989359acb (diff)
downloadnetsurf-f68aca93b7e9f5dd05f1e49ba8ae70ada3ef3d1f.tar.gz
netsurf-f68aca93b7e9f5dd05f1e49ba8ae70ada3ef3d1f.tar.bz2
jpegxl: Ensure decoded bitmap format is converted to front end format
Diffstat (limited to 'content/handlers')
-rw-r--r--content/handlers/image/jpegxl.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/content/handlers/image/jpegxl.c b/content/handlers/image/jpegxl.c
index 0451e2a88..01c704577 100644
--- a/content/handlers/image/jpegxl.c
+++ b/content/handlers/image/jpegxl.c
@@ -97,6 +97,17 @@ jpegxl_cache_convert(struct content *c)
const uint8_t *src_data;
size_t src_size;
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);
if (jxldec == NULL) {
@@ -180,8 +191,9 @@ jpegxl_cache_convert(struct content *c)
JxlDecoderDestroy(jxldec);
+ bitmap_format_to_client(bitmap, &jxl_fmt);
guit->bitmap->modified(bitmap);
-
+
return bitmap;
}