NetSurf
|
implementation of content handling for image/jpegxl More...
#include <stdbool.h>
#include <stdlib.h>
#include <setjmp.h>
#include <string.h>
#include <jxl/decode.h>
#include "utils/utils.h"
#include "utils/log.h"
#include "utils/messages.h"
#include "netsurf/bitmap.h"
#include "content/llcache.h"
#include "content/content.h"
#include "content/content_protected.h"
#include "content/content_factory.h"
#include "desktop/gui_internal.h"
#include "desktop/bitmap.h"
#include "image/image_cache.h"
#include "image/jpegxl.h"
Go to the source code of this file.
Functions | |
static nserror | nsjpegxl_create (const content_handler *handler, lwc_string *imime_type, const struct http_parameter *params, llcache_handle *llcache, const char *fallback_charset, bool quirks, struct content **c) |
Content create entry point. More... | |
static struct bitmap * | jpegxl_cache_convert (struct content *c) |
create a bitmap from jpeg xl content. More... | |
static bool | jxl_report_fail (struct content *c, JxlDecoderStatus decstatus, const char *msg) |
report failiure More... | |
static bool | nsjpegxl_convert (struct content *c) |
Convert a CONTENT_JPEGXL for display. More... | |
static nserror | nsjpegxl_clone (const struct content *old, struct content **newc) |
Clone content. More... | |
CONTENT_FACTORY_REGISTER_TYPES (nsjpegxl, nsjpegxl_types, nsjpegxl_content_handler) | |
Variables | |
static const JxlPixelFormat | jxl_output_format |
output image format More... | |
static const content_handler | nsjpegxl_content_handler |
static const char * | nsjpegxl_types [] |
implementation of content handling for image/jpegxl
This implementation uses the JXL library.
Definition in file jpegxl.c.
CONTENT_FACTORY_REGISTER_TYPES | ( | nsjpegxl | , |
nsjpegxl_types | , | ||
nsjpegxl_content_handler | |||
) |
create a bitmap from jpeg xl content.
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
Definition at line 91 of file jpegxl.c.
References netsurf_table::bitmap, bitmap(), bitmap_format_to_client(), BITMAP_LAYOUT_R8G8B8A8, BITMAP_NONE, BITMAP_OPAQUE, content__get_source_data(), gui_bitmap_table::create, gui_bitmap_table::destroy, gui_bitmap_table::get_buffer, guit, content::height, jxl_output_format, bitmap_fmt::layout, gui_bitmap_table::modified, NSLOG, bitmap_fmt::pma, content::size, and content::width.
Referenced by nsjpegxl_convert().
|
static |
report failiure
Definition at line 203 of file jpegxl.c.
References content_broadcast(), CONTENT_MSG_ERROR, content_msg_data::errorcode, content_msg_data::errordata, content_msg_data::errormsg, content_msg_data::msg, NSERROR_UNKNOWN, and NSLOG.
Referenced by nsjpegxl_convert().
Clone content.
Definition at line 295 of file jpegxl.c.
References content__clone(), content_destroy(), CONTENT_STATUS_DONE, CONTENT_STATUS_READY, NSERROR_CLONE_FAILED, NSERROR_NOMEM, NSERROR_OK, nsjpegxl_convert(), and content::status.
|
static |
Convert a CONTENT_JPEGXL for display.
Definition at line 216 of file jpegxl.c.
References content__get_source_data(), content__set_title(), content_broadcast(), CONTENT_MSG_ERROR, content_set_done(), content_set_ready(), content_set_status(), content_msg_data::errorcode, content_msg_data::errordata, content_msg_data::errormsg, content::height, image_cache_add(), jpegxl_cache_convert(), jxl_output_format, jxl_report_fail(), content::llcache, llcache_handle_get_url(), messages_get_buff(), NSERROR_UNKNOWN, NSLOG, nsurl_access_leaf(), content::size, content_msg_data::title, and content::width.
Referenced by nsjpegxl_clone().
|
static |
Content create entry point.
Definition at line 63 of file jpegxl.c.
References content__init(), content::fallback_charset, content::handler, llcache, NSERROR_NOMEM, NSERROR_OK, and content::quirks.
|
static |
output image format
Definition at line 52 of file jpegxl.c.
Referenced by jpegxl_cache_convert(), and nsjpegxl_convert().
|
static |