diff options
author | Michael Drake <tlsa@netsurf-browser.org> | 2023-11-26 16:54:42 +0000 |
---|---|---|
committer | Michael Drake <tlsa@netsurf-browser.org> | 2023-11-26 17:26:09 +0000 |
commit | d59f30c683b9c65a3380a8276247141989359acb (patch) | |
tree | b130fbded85fb3b05056f4621d0c1da60d2854f5 /content/handlers | |
parent | 6fa4c04deaf516e938ab0f458cc931318b42ea32 (diff) | |
download | netsurf-d59f30c683b9c65a3380a8276247141989359acb.tar.gz netsurf-d59f30c683b9c65a3380a8276247141989359acb.tar.bz2 |
jpegxl: Tell libjxl to decode unpremultiply alpha if needed
On some platforms our bitmap format does not use premultiplied alpha.
Diffstat (limited to 'content/handlers')
-rw-r--r-- | content/handlers/image/jpegxl.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/content/handlers/image/jpegxl.c b/content/handlers/image/jpegxl.c index d5152fb7a..0451e2a88 100644 --- a/content/handlers/image/jpegxl.c +++ b/content/handlers/image/jpegxl.c @@ -103,6 +103,15 @@ jpegxl_cache_convert(struct content *c) NSLOG(netsurf, ERROR, "Unable to allocate decoder"); return NULL; } + + decstatus = JxlDecoderSetUnpremultiplyAlpha(jxldec, !bitmap_fmt.pma); + if (decstatus != JXL_DEC_SUCCESS) { + NSLOG(netsurf, ERROR, "unable to set premultiplied alpha status: %d", + decstatus); + JxlDecoderDestroy(jxldec); + return NULL; + } + decstatus= JxlDecoderSubscribeEvents(jxldec, JXL_DEC_FULL_IMAGE); if (decstatus != JXL_DEC_SUCCESS) { NSLOG(netsurf, ERROR, "Unable to subscribe"); |