Gitweb links:

...log 
http://git.netsurf-browser.org/netsurf.git/shortlog/794d9b00260ea23a1ed935fbf6ad0a994b6a1d1f
...commit 
http://git.netsurf-browser.org/netsurf.git/commit/794d9b00260ea23a1ed935fbf6ad0a994b6a1d1f
...tree 
http://git.netsurf-browser.org/netsurf.git/tree/794d9b00260ea23a1ed935fbf6ad0a994b6a1d1f

The branch, vince/libjxl has been updated
       via  794d9b00260ea23a1ed935fbf6ad0a994b6a1d1f (commit)
      from  9d5ebb857caa8561972f0c2395e2176ce2b03146 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commitdiff 
http://git.netsurf-browser.org/netsurf.git/commit/?id=794d9b00260ea23a1ed935fbf6ad0a994b6a1d1f
commit 794d9b00260ea23a1ed935fbf6ad0a994b6a1d1f
Author: Vincent Sanders <[email protected]>
Commit: Vincent Sanders <[email protected]>

    avoid the unecessary callback API

diff --git a/content/handlers/image/jpegxl.c b/content/handlers/image/jpegxl.c
index 4bba02d..ba385f3 100644
--- a/content/handlers/image/jpegxl.c
+++ b/content/handlers/image/jpegxl.c
@@ -79,20 +79,6 @@ nsjpegxl_create(const content_handler *handler,
        return NSERROR_OK;
 }
 
-static void image_out_callback(void *opaque, size_t x, size_t y, size_t 
num_pixels, const void *pixels)
-{
-       struct bitmap * bitmap = opaque;
-       uint8_t * output;
-
-       output = guit->bitmap->get_buffer(bitmap);
-       if (output != NULL) {
-               /* bitmap buffer available */
-               memcpy(output + (x*jxl_output_format.num_channels) + (y * 
guit->bitmap->get_rowstride(bitmap)),
-                      pixels,
-                      num_pixels*jxl_output_format.num_channels);
-       }
-}
-
 /**
  * create a bitmap from jpeg xl content.
  */
@@ -105,6 +91,7 @@ jpegxl_cache_convert(struct content *c)
        JxlBasicInfo binfo;
        const uint8_t *src_data;
        size_t src_size;
+       uint8_t * output;
 
        jxldec = JxlDecoderCreate(NULL);
        if (jxldec == NULL) {
@@ -154,14 +141,14 @@ jpegxl_cache_convert(struct content *c)
        }
 
        /* ensure buffer was allocated */
-       if (guit->bitmap->get_buffer(bitmap) == NULL) {
+       output = guit->bitmap->get_buffer(bitmap);
+       if (output == NULL) {
                /* bitmap with no buffer available */
                guit->bitmap->destroy(bitmap);
                JxlDecoderDestroy(jxldec);
                return NULL;
        }
-
-       decstatus = JxlDecoderSetImageOutCallback(jxldec, &jxl_output_format, 
image_out_callback, bitmap);
+       decstatus = JxlDecoderSetImageOutBuffer(jxldec, &jxl_output_format, 
output, c->size);
        if (decstatus != JXL_DEC_SUCCESS) {
                NSLOG(netsurf, ERROR, "unable to set output buffer callback 
status:%d",decstatus);
                guit->bitmap->destroy(bitmap);


-----------------------------------------------------------------------

Summary of changes:
 content/handlers/image/jpegxl.c |   21 ++++-----------------
 1 file changed, 4 insertions(+), 17 deletions(-)

diff --git a/content/handlers/image/jpegxl.c b/content/handlers/image/jpegxl.c
index 4bba02d..ba385f3 100644
--- a/content/handlers/image/jpegxl.c
+++ b/content/handlers/image/jpegxl.c
@@ -79,20 +79,6 @@ nsjpegxl_create(const content_handler *handler,
        return NSERROR_OK;
 }
 
-static void image_out_callback(void *opaque, size_t x, size_t y, size_t 
num_pixels, const void *pixels)
-{
-       struct bitmap * bitmap = opaque;
-       uint8_t * output;
-
-       output = guit->bitmap->get_buffer(bitmap);
-       if (output != NULL) {
-               /* bitmap buffer available */
-               memcpy(output + (x*jxl_output_format.num_channels) + (y * 
guit->bitmap->get_rowstride(bitmap)),
-                      pixels,
-                      num_pixels*jxl_output_format.num_channels);
-       }
-}
-
 /**
  * create a bitmap from jpeg xl content.
  */
@@ -105,6 +91,7 @@ jpegxl_cache_convert(struct content *c)
        JxlBasicInfo binfo;
        const uint8_t *src_data;
        size_t src_size;
+       uint8_t * output;
 
        jxldec = JxlDecoderCreate(NULL);
        if (jxldec == NULL) {
@@ -154,14 +141,14 @@ jpegxl_cache_convert(struct content *c)
        }
 
        /* ensure buffer was allocated */
-       if (guit->bitmap->get_buffer(bitmap) == NULL) {
+       output = guit->bitmap->get_buffer(bitmap);
+       if (output == NULL) {
                /* bitmap with no buffer available */
                guit->bitmap->destroy(bitmap);
                JxlDecoderDestroy(jxldec);
                return NULL;
        }
-
-       decstatus = JxlDecoderSetImageOutCallback(jxldec, &jxl_output_format, 
image_out_callback, bitmap);
+       decstatus = JxlDecoderSetImageOutBuffer(jxldec, &jxl_output_format, 
output, c->size);
        if (decstatus != JXL_DEC_SUCCESS) {
                NSLOG(netsurf, ERROR, "unable to set output buffer callback 
status:%d",decstatus);
                guit->bitmap->destroy(bitmap);


-- 
NetSurf Browser
_______________________________________________
netsurf-commits mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to