diff --git a/example/imageviewer/imageviewer.cc b/example/imageviewer/imageviewer.cc index 4b9d18cd..027e6a62 100644 --- a/example/imageviewer/imageviewer.cc +++ b/example/imageviewer/imageviewer.cc @@ -39,6 +39,7 @@ The Escape key quits. */ #include +#include #include #include @@ -100,6 +101,7 @@ wuffs_base__color_u32_argb_premul g_background_colors[NUM_BACKGROUND_COLORS] = { 0xFFA9009A, }; +double g_screen_gamma = 2.2; // TODO: make a command-line flag. uint32_t g_width = 0; uint32_t g_height = 0; wuffs_aux::MemOwner g_pixbuf_mem_owner(nullptr, &free); @@ -108,6 +110,69 @@ uint32_t g_background_color_index = 0; int32_t g_zoom = 0; bool g_filter = false; +class MyDecodeImageCallbacks : public wuffs_aux::DecodeImageCallbacks { + public: + MyDecodeImageCallbacks() : m_combined_gamma(1.0) {} + + private: + std::string // + HandleMetadata(const wuffs_base__more_information& minfo, + std::vector&& raw) override { + if (minfo.flavor == WUFFS_BASE__MORE_INFORMATION__FLAVOR__METADATA_PARSED) { + switch (minfo.metadata__fourcc()) { + case WUFFS_BASE__FOURCC__GAMA: + // metadata_parsed__gama returns the inverse gamma scaled by 1e5. + m_combined_gamma = + 1e5 / (g_screen_gamma * minfo.metadata_parsed__gama()); + break; + } + } + return ""; + } + + void // + Done(wuffs_aux::DecodeImageResult& result, + wuffs_aux::sync_io::Input& input, + wuffs_aux::IOBuffer& buffer, + wuffs_base__image_decoder::unique_ptr image_decoder) override { + // Apply basic color correction - gamma correction. Proper color correction + // should also involve considering any CHRM, ICCP and SRGB metadata but + // that requires a non-trivial amount of code (such as skcms, Skia's Color + // Management System). To keep this example program simple, we only + // consider GAMA metadata (and 8-bit color channels) here. + // + // This code also assumes that wuffs_aux::DecodeImageCallbacks defaults to + // producing a WUFFS_BASE__PIXEL_FORMAT__BGRA_PREMUL pixel buffer. + if ((result.pixbuf.pixel_format().repr == + WUFFS_BASE__PIXEL_FORMAT__BGRA_PREMUL) && + ((m_combined_gamma < 0.9999) || (1.0001 < m_combined_gamma))) { + uint8_t lut[256]; + lut[0x00] = 0x00; + lut[0xFF] = 0xFF; + for (uint32_t i = 1; i < 0xFF; i++) { + lut[i] = + (uint8_t)(floor(255.0 * pow(i / 255.0, m_combined_gamma) + 0.5)); + } + + wuffs_base__table_u8 t = result.pixbuf.plane(0); + size_t w4 = t.width / 4; + for (size_t y = 0; y < t.height; y++) { + uint8_t* ptr = t.ptr + (y * t.stride); + for (size_t x = 0; x < w4; x++) { + ptr[0] = lut[ptr[0]]; + ptr[1] = lut[ptr[1]]; + ptr[2] = lut[ptr[2]]; + ptr += 4; + } + } + } + } + + // m_combined_gamma holds the product of the screen gamma and the image + // file's inverse gamma. + double m_combined_gamma; +}; + bool // load_image(const char* filename) { FILE* file = stdin; @@ -127,10 +192,12 @@ load_image(const char* filename) { g_pixbuf_mem_owner.reset(); g_pixbuf = wuffs_base__null_pixel_buffer(); - wuffs_aux::DecodeImageCallbacks callbacks; + MyDecodeImageCallbacks callbacks; wuffs_aux::sync_io::FileInput input(file); wuffs_aux::DecodeImageResult res = wuffs_aux::DecodeImage( callbacks, input, wuffs_aux::DecodeImageArgQuirks::DefaultValue(), + wuffs_aux::DecodeImageArgFlags( + wuffs_aux::DecodeImageArgFlags::REPORT_METADATA_GAMA), // Use PIXEL_BLEND__SRC_OVER, not the default PIXEL_BLEND__SRC, because // we also pass a background color. wuffs_aux::DecodeImageArgPixelBlend(WUFFS_BASE__PIXEL_BLEND__SRC_OVER), diff --git a/internal/cgen/auxiliary/base.hh b/internal/cgen/auxiliary/base.hh index 6b1eeac6..f1a60ea9 100644 --- a/internal/cgen/auxiliary/base.hh +++ b/internal/cgen/auxiliary/base.hh @@ -20,6 +20,7 @@ #include #include +#include namespace wuffs_aux { diff --git a/internal/cgen/auxiliary/image.cc b/internal/cgen/auxiliary/image.cc index a2f1403b..a30f7c2c 100644 --- a/internal/cgen/auxiliary/image.cc +++ b/internal/cgen/auxiliary/image.cc @@ -93,6 +93,12 @@ DecodeImageCallbacks::SelectDecoder(uint32_t fourcc, return wuffs_base__image_decoder::unique_ptr(nullptr, &free); } +std::string // +DecodeImageCallbacks::HandleMetadata(const wuffs_base__more_information& minfo, + std::vector&& raw) { + return ""; +} + wuffs_base__pixel_format // DecodeImageCallbacks::SelectPixfmt( const wuffs_base__image_config& image_config) { @@ -181,6 +187,13 @@ DecodeImageArgQuirks::DefaultValue() { return DecodeImageArgQuirks(wuffs_base__empty_slice_u32()); } +DecodeImageArgFlags::DecodeImageArgFlags(uint64_t repr0) : repr(repr0) {} + +DecodeImageArgFlags // +DecodeImageArgFlags::DefaultValue() { + return DecodeImageArgFlags(0); +} + DecodeImageArgPixelBlend::DecodeImageArgPixelBlend( wuffs_base__pixel_blend repr0) : repr(repr0) {} @@ -241,12 +254,29 @@ DecodeImageAdvanceIOBuf(sync_io::Input& input, return ""; } +std::string // +DecodeImageHandleMetadata(wuffs_base__image_decoder::unique_ptr& image_decoder, + DecodeImageCallbacks& callbacks, + sync_io::Input& input, + wuffs_base__io_buffer& io_buf) { + std::vector raw; + wuffs_base__io_buffer empty = wuffs_base__empty_io_buffer(); + wuffs_base__more_information minfo = wuffs_base__empty_more_information(); + wuffs_base__status status = + image_decoder->tell_me_more(&empty, &minfo, &io_buf); + if (status.repr != NULL) { + return status.message(); + } + return callbacks.HandleMetadata(minfo, std::move(raw)); +} + DecodeImageResult // DecodeImage0(wuffs_base__image_decoder::unique_ptr& image_decoder, DecodeImageCallbacks& callbacks, sync_io::Input& input, wuffs_base__io_buffer& io_buf, wuffs_base__slice_u32 quirks, + uint64_t flags, wuffs_base__pixel_blend pixel_blend, wuffs_base__color_u32_argb_premul background_color, uint32_t max_incl_dimension) { @@ -319,6 +349,19 @@ redirect: image_decoder->set_quirk_enabled(quirks.ptr[i], true); } + // Apply flags. + if (flags != 0) { + if (flags & DecodeImageArgFlags::REPORT_METADATA_CHRM) { + image_decoder->set_report_metadata(WUFFS_BASE__FOURCC__CHRM, true); + } + if (flags & DecodeImageArgFlags::REPORT_METADATA_GAMA) { + image_decoder->set_report_metadata(WUFFS_BASE__FOURCC__GAMA, true); + } + if (flags & DecodeImageArgFlags::REPORT_METADATA_SRGB) { + image_decoder->set_report_metadata(WUFFS_BASE__FOURCC__SRGB, true); + } + } + // Decode the image config. while (true) { wuffs_base__status id_dic_status = @@ -331,6 +374,12 @@ redirect: } redirected = true; goto redirect; + } else if (id_dic_status.repr == wuffs_base__note__metadata_reported) { + std::string error_message = + DecodeImageHandleMetadata(image_decoder, callbacks, input, io_buf); + if (!error_message.empty()) { + return DecodeImageResult(std::move(error_message)); + } } else if (id_dic_status.repr != wuffs_base__suspension__short_read) { return DecodeImageResult(id_dic_status.message()); } else if (io_buf.meta.closed) { @@ -454,6 +503,7 @@ DecodeImageResult // DecodeImage(DecodeImageCallbacks& callbacks, sync_io::Input& input, DecodeImageArgQuirks quirks, + DecodeImageArgFlags flags, DecodeImageArgPixelBlend pixel_blend, DecodeImageArgBackgroundColor background_color, DecodeImageArgMaxInclDimension max_incl_dimension) { @@ -469,8 +519,8 @@ DecodeImage(DecodeImageCallbacks& callbacks, wuffs_base__image_decoder::unique_ptr image_decoder(nullptr, &free); DecodeImageResult result = DecodeImage0( - image_decoder, callbacks, input, *io_buf, quirks.repr, pixel_blend.repr, - background_color.repr, max_incl_dimension.repr); + image_decoder, callbacks, input, *io_buf, quirks.repr, flags.repr, + pixel_blend.repr, background_color.repr, max_incl_dimension.repr); callbacks.Done(result, input, *io_buf, std::move(image_decoder)); return result; } diff --git a/internal/cgen/auxiliary/image.hh b/internal/cgen/auxiliary/image.hh index a827ad5b..3686ad07 100644 --- a/internal/cgen/auxiliary/image.hh +++ b/internal/cgen/auxiliary/image.hh @@ -30,10 +30,11 @@ struct DecodeImageResult { // DecodeImageCallbacks are the callbacks given to DecodeImage. They are always // called in this order: // 1. SelectDecoder -// 2. SelectPixfmt -// 3. AllocPixbuf -// 4. AllocWorkbuf -// 5. Done +// 2. HandleMetadata +// 3. SelectPixfmt +// 4. AllocPixbuf +// 5. AllocWorkbuf +// 6. Done // // It may return early - the third callback might not be invoked if the second // one fails - but the final callback (Done) is always invoked. @@ -90,6 +91,21 @@ class DecodeImageCallbacks { virtual wuffs_base__image_decoder::unique_ptr // SelectDecoder(uint32_t fourcc, wuffs_base__slice_u8 prefix); + // HandleMetadata acknowledges image metadata. minfo.flavor will be one of: + // - WUFFS_BASE__MORE_INFORMATION__FLAVOR__METADATA_RAW + // - WUFFS_BASE__MORE_INFORMATION__FLAVOR__METADATA_PARSED + // If it is ETC__METADATA_RAW then raw contains the metadata bytes. + // + // minfo.metadata__fourcc() will typically match one of the + // DecodeImageArgFlags bits. For example, if (REPORT_METADATA_CHRM | + // REPORT_METADATA_GAMA) was passed to DecodeImage then the metadata FourCC + // will be either WUFFS_BASE__FOURCC__CHRM or WUFFS_BASE__FOURCC__GAMA. + // + // It returns an error message, or an empty string on success. + virtual std::string // + HandleMetadata(const wuffs_base__more_information& minfo, + std::vector&& raw); + // SelectPixfmt returns the destination pixel format for AllocPixbuf. It // should return wuffs_base__make_pixel_format(etc) called with one of: // - WUFFS_BASE__PIXEL_FORMAT__BGR_565 @@ -183,6 +199,42 @@ struct DecodeImageArgQuirks { wuffs_base__slice_u32 repr; }; +// DecodeImageArgFlags wraps an optional argument to DecodeImage. +struct DecodeImageArgFlags { + explicit DecodeImageArgFlags(uint64_t repr0); + + // DefaultValue returns 0. + static DecodeImageArgFlags DefaultValue(); + + // TODO: support all of the REPORT_METADATA_ETC flags, not just CHRM, GAMA + // and SRGB. + + // Background Color. + static constexpr uint64_t REPORT_METADATA_BGCL = 0x0001; + // Primary Chromaticities and White Point. + static constexpr uint64_t REPORT_METADATA_CHRM = 0x0002; + // Exchangeable Image File Format. + static constexpr uint64_t REPORT_METADATA_EXIF = 0x0004; + // Gamma Correction. + static constexpr uint64_t REPORT_METADATA_GAMA = 0x0008; + // International Color Consortium Profile. + static constexpr uint64_t REPORT_METADATA_ICCP = 0x0010; + // Modification Time. + static constexpr uint64_t REPORT_METADATA_MTIM = 0x0020; + // Offset (2-Dimensional). + static constexpr uint64_t REPORT_METADATA_OFS2 = 0x0040; + // Physical Dimensions. + static constexpr uint64_t REPORT_METADATA_PHYD = 0x0080; + // Standard Red Green Blue (Rendering Intent). + static constexpr uint64_t REPORT_METADATA_SRGB = 0x0100; + // Text. + static constexpr uint64_t REPORT_METADATA_TEXT = 0x0200; + // Extensible Metadata Platform. + static constexpr uint64_t REPORT_METADATA_XMP = 0x0400; + + uint64_t repr; +}; + // DecodeImageArgPixelBlend wraps an optional argument to DecodeImage. struct DecodeImageArgPixelBlend { explicit DecodeImageArgPixelBlend(wuffs_base__pixel_blend repr0); @@ -261,6 +313,7 @@ DecodeImageResult // DecodeImage(DecodeImageCallbacks& callbacks, sync_io::Input& input, DecodeImageArgQuirks quirks = DecodeImageArgQuirks::DefaultValue(), + DecodeImageArgFlags flags = DecodeImageArgFlags::DefaultValue(), DecodeImageArgPixelBlend pixel_blend = DecodeImageArgPixelBlend::DefaultValue(), DecodeImageArgBackgroundColor background_color = diff --git a/lang/builtin/builtin.go b/lang/builtin/builtin.go index 45863077..72bfe45f 100644 --- a/lang/builtin/builtin.go +++ b/lang/builtin/builtin.go @@ -28,6 +28,7 @@ import ( ) var FourCCs = [...][2]string{ + {"BGCL", "Background Color"}, {"BMP ", "Bitmap"}, {"BRTL", "Brotli"}, {"BZ2 ", "Bzip2"}, @@ -52,10 +53,13 @@ var FourCCs = [...][2]string{ {"JWCC", "JSON With Commas and Comments"}, {"LZ4 ", "Lempel–Ziv 4"}, {"MD ", "Markdown"}, + {"MTIM", "Modification Time"}, {"MP3 ", "MPEG-1 Audio Layer III"}, {"NIE ", "Naive Image"}, + {"OFS2", "Offset (2-Dimensional)"}, {"OTF ", "Open Type Format"}, {"PDF ", "Portable Document Format"}, + {"PHYD", "Physical Dimensions"}, {"PNG ", "Portable Network Graphics"}, {"PNM ", "Portable Anymap"}, {"PS ", "PostScript"}, @@ -67,6 +71,7 @@ var FourCCs = [...][2]string{ {"SRGB", "Standard Red Green Blue (Rendering Intent)"}, {"SVG ", "Scalable Vector Graphics"}, {"TAR ", "Tape Archive"}, + {"TEXT", "Text"}, {"TIFF", "Tagged Image File Format"}, {"TOML", "Tom's Obvious Minimal Language"}, {"WAVE", "Waveform"}, diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c index 54f5c9b7..fd34bf34 100644 --- a/release/c/wuffs-unsupported-snapshot.c +++ b/release/c/wuffs-unsupported-snapshot.c @@ -572,6 +572,9 @@ typedef struct wuffs_base__transform__output__struct { // Wuffs' u32 values are big-endian ("JPEG" is 0x4A504547 not 0x4745504A) to // preserve ordering: "JPEG" < "MP3 " and 0x4A504547 < 0x4D503320. +// Background Color. +#define WUFFS_BASE__FOURCC__BGCL 0x4247434C + // Bitmap. #define WUFFS_BASE__FOURCC__BMP 0x424D5020 @@ -644,18 +647,27 @@ typedef struct wuffs_base__transform__output__struct { // Markdown. #define WUFFS_BASE__FOURCC__MD 0x4D442020 +// Modification Time. +#define WUFFS_BASE__FOURCC__MTIM 0x4D54494D + // MPEG-1 Audio Layer III. #define WUFFS_BASE__FOURCC__MP3 0x4D503320 // Naive Image. #define WUFFS_BASE__FOURCC__NIE 0x4E494520 +// Offset (2-Dimensional). +#define WUFFS_BASE__FOURCC__OFS2 0x4F465332 + // Open Type Format. #define WUFFS_BASE__FOURCC__OTF 0x4F544620 // Portable Document Format. #define WUFFS_BASE__FOURCC__PDF 0x50444620 +// Physical Dimensions. +#define WUFFS_BASE__FOURCC__PHYD 0x50485944 + // Portable Network Graphics. #define WUFFS_BASE__FOURCC__PNG 0x504E4720 @@ -689,6 +701,9 @@ typedef struct wuffs_base__transform__output__struct { // Tape Archive. #define WUFFS_BASE__FOURCC__TAR 0x54415220 +// Text. +#define WUFFS_BASE__FOURCC__TEXT 0x54455854 + // Tagged Image File Format. #define WUFFS_BASE__FOURCC__TIFF 0x54494646 @@ -9849,6 +9864,7 @@ struct wuffs_wbmp__decoder__struct { #include #include +#include namespace wuffs_aux { @@ -10026,10 +10042,11 @@ struct DecodeImageResult { // DecodeImageCallbacks are the callbacks given to DecodeImage. They are always // called in this order: // 1. SelectDecoder -// 2. SelectPixfmt -// 3. AllocPixbuf -// 4. AllocWorkbuf -// 5. Done +// 2. HandleMetadata +// 3. SelectPixfmt +// 4. AllocPixbuf +// 5. AllocWorkbuf +// 6. Done // // It may return early - the third callback might not be invoked if the second // one fails - but the final callback (Done) is always invoked. @@ -10086,6 +10103,21 @@ class DecodeImageCallbacks { virtual wuffs_base__image_decoder::unique_ptr // SelectDecoder(uint32_t fourcc, wuffs_base__slice_u8 prefix); + // HandleMetadata acknowledges image metadata. minfo.flavor will be one of: + // - WUFFS_BASE__MORE_INFORMATION__FLAVOR__METADATA_RAW + // - WUFFS_BASE__MORE_INFORMATION__FLAVOR__METADATA_PARSED + // If it is ETC__METADATA_RAW then raw contains the metadata bytes. + // + // minfo.metadata__fourcc() will typically match one of the + // DecodeImageArgFlags bits. For example, if (REPORT_METADATA_CHRM | + // REPORT_METADATA_GAMA) was passed to DecodeImage then the metadata FourCC + // will be either WUFFS_BASE__FOURCC__CHRM or WUFFS_BASE__FOURCC__GAMA. + // + // It returns an error message, or an empty string on success. + virtual std::string // + HandleMetadata(const wuffs_base__more_information& minfo, + std::vector&& raw); + // SelectPixfmt returns the destination pixel format for AllocPixbuf. It // should return wuffs_base__make_pixel_format(etc) called with one of: // - WUFFS_BASE__PIXEL_FORMAT__BGR_565 @@ -10179,6 +10211,42 @@ struct DecodeImageArgQuirks { wuffs_base__slice_u32 repr; }; +// DecodeImageArgFlags wraps an optional argument to DecodeImage. +struct DecodeImageArgFlags { + explicit DecodeImageArgFlags(uint64_t repr0); + + // DefaultValue returns 0. + static DecodeImageArgFlags DefaultValue(); + + // TODO: support all of the REPORT_METADATA_ETC flags, not just CHRM, GAMA + // and SRGB. + + // Background Color. + static constexpr uint64_t REPORT_METADATA_BGCL = 0x0001; + // Primary Chromaticities and White Point. + static constexpr uint64_t REPORT_METADATA_CHRM = 0x0002; + // Exchangeable Image File Format. + static constexpr uint64_t REPORT_METADATA_EXIF = 0x0004; + // Gamma Correction. + static constexpr uint64_t REPORT_METADATA_GAMA = 0x0008; + // International Color Consortium Profile. + static constexpr uint64_t REPORT_METADATA_ICCP = 0x0010; + // Modification Time. + static constexpr uint64_t REPORT_METADATA_MTIM = 0x0020; + // Offset (2-Dimensional). + static constexpr uint64_t REPORT_METADATA_OFS2 = 0x0040; + // Physical Dimensions. + static constexpr uint64_t REPORT_METADATA_PHYD = 0x0080; + // Standard Red Green Blue (Rendering Intent). + static constexpr uint64_t REPORT_METADATA_SRGB = 0x0100; + // Text. + static constexpr uint64_t REPORT_METADATA_TEXT = 0x0200; + // Extensible Metadata Platform. + static constexpr uint64_t REPORT_METADATA_XMP = 0x0400; + + uint64_t repr; +}; + // DecodeImageArgPixelBlend wraps an optional argument to DecodeImage. struct DecodeImageArgPixelBlend { explicit DecodeImageArgPixelBlend(wuffs_base__pixel_blend repr0); @@ -10257,6 +10325,7 @@ DecodeImageResult // DecodeImage(DecodeImageCallbacks& callbacks, sync_io::Input& input, DecodeImageArgQuirks quirks = DecodeImageArgQuirks::DefaultValue(), + DecodeImageArgFlags flags = DecodeImageArgFlags::DefaultValue(), DecodeImageArgPixelBlend pixel_blend = DecodeImageArgPixelBlend::DefaultValue(), DecodeImageArgBackgroundColor background_color = @@ -40594,6 +40663,12 @@ DecodeImageCallbacks::SelectDecoder(uint32_t fourcc, return wuffs_base__image_decoder::unique_ptr(nullptr, &free); } +std::string // +DecodeImageCallbacks::HandleMetadata(const wuffs_base__more_information& minfo, + std::vector&& raw) { + return ""; +} + wuffs_base__pixel_format // DecodeImageCallbacks::SelectPixfmt( const wuffs_base__image_config& image_config) { @@ -40682,6 +40757,13 @@ DecodeImageArgQuirks::DefaultValue() { return DecodeImageArgQuirks(wuffs_base__empty_slice_u32()); } +DecodeImageArgFlags::DecodeImageArgFlags(uint64_t repr0) : repr(repr0) {} + +DecodeImageArgFlags // +DecodeImageArgFlags::DefaultValue() { + return DecodeImageArgFlags(0); +} + DecodeImageArgPixelBlend::DecodeImageArgPixelBlend( wuffs_base__pixel_blend repr0) : repr(repr0) {} @@ -40742,12 +40824,29 @@ DecodeImageAdvanceIOBuf(sync_io::Input& input, return ""; } +std::string // +DecodeImageHandleMetadata(wuffs_base__image_decoder::unique_ptr& image_decoder, + DecodeImageCallbacks& callbacks, + sync_io::Input& input, + wuffs_base__io_buffer& io_buf) { + std::vector raw; + wuffs_base__io_buffer empty = wuffs_base__empty_io_buffer(); + wuffs_base__more_information minfo = wuffs_base__empty_more_information(); + wuffs_base__status status = + image_decoder->tell_me_more(&empty, &minfo, &io_buf); + if (status.repr != NULL) { + return status.message(); + } + return callbacks.HandleMetadata(minfo, std::move(raw)); +} + DecodeImageResult // DecodeImage0(wuffs_base__image_decoder::unique_ptr& image_decoder, DecodeImageCallbacks& callbacks, sync_io::Input& input, wuffs_base__io_buffer& io_buf, wuffs_base__slice_u32 quirks, + uint64_t flags, wuffs_base__pixel_blend pixel_blend, wuffs_base__color_u32_argb_premul background_color, uint32_t max_incl_dimension) { @@ -40820,6 +40919,19 @@ redirect: image_decoder->set_quirk_enabled(quirks.ptr[i], true); } + // Apply flags. + if (flags != 0) { + if (flags & DecodeImageArgFlags::REPORT_METADATA_CHRM) { + image_decoder->set_report_metadata(WUFFS_BASE__FOURCC__CHRM, true); + } + if (flags & DecodeImageArgFlags::REPORT_METADATA_GAMA) { + image_decoder->set_report_metadata(WUFFS_BASE__FOURCC__GAMA, true); + } + if (flags & DecodeImageArgFlags::REPORT_METADATA_SRGB) { + image_decoder->set_report_metadata(WUFFS_BASE__FOURCC__SRGB, true); + } + } + // Decode the image config. while (true) { wuffs_base__status id_dic_status = @@ -40832,6 +40944,12 @@ redirect: } redirected = true; goto redirect; + } else if (id_dic_status.repr == wuffs_base__note__metadata_reported) { + std::string error_message = + DecodeImageHandleMetadata(image_decoder, callbacks, input, io_buf); + if (!error_message.empty()) { + return DecodeImageResult(std::move(error_message)); + } } else if (id_dic_status.repr != wuffs_base__suspension__short_read) { return DecodeImageResult(id_dic_status.message()); } else if (io_buf.meta.closed) { @@ -40955,6 +41073,7 @@ DecodeImageResult // DecodeImage(DecodeImageCallbacks& callbacks, sync_io::Input& input, DecodeImageArgQuirks quirks, + DecodeImageArgFlags flags, DecodeImageArgPixelBlend pixel_blend, DecodeImageArgBackgroundColor background_color, DecodeImageArgMaxInclDimension max_incl_dimension) { @@ -40970,8 +41089,8 @@ DecodeImage(DecodeImageCallbacks& callbacks, wuffs_base__image_decoder::unique_ptr image_decoder(nullptr, &free); DecodeImageResult result = DecodeImage0( - image_decoder, callbacks, input, *io_buf, quirks.repr, pixel_blend.repr, - background_color.repr, max_incl_dimension.repr); + image_decoder, callbacks, input, *io_buf, quirks.repr, flags.repr, + pixel_blend.repr, background_color.repr, max_incl_dimension.repr); callbacks.Done(result, input, *io_buf, std::move(image_decoder)); return result; }