From 9e802a5f84d1b329c904d191578e7fc81a49ea28 Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Sun, 5 Jan 2020 15:34:05 +1100 Subject: [PATCH] Have wuffs_base__pixel_config__set take repr args --- example/gifplayer/gifplayer.c | 6 ++---- internal/cgen/base/image-public.h | 20 ++++++++++---------- internal/cgen/data.go | 12 ++++++------ release/c/wuffs-unsupported-snapshot.c | 20 ++++++++++---------- test/c/std/gif.c | 20 +++++++++----------- 5 files changed, 37 insertions(+), 41 deletions(-) diff --git a/example/gifplayer/gifplayer.c b/example/gifplayer/gifplayer.c index f33f73c0..8658bf35 100644 --- a/example/gifplayer/gifplayer.c +++ b/example/gifplayer/gifplayer.c @@ -328,10 +328,8 @@ const char* play() { // Override the source's indexed pixel format to be non-indexed. wuffs_base__pixel_config__set( - &ic.pixcfg, - wuffs_base__make_pixel_format(WUFFS_BASE__PIXEL_FORMAT__BGRA_PREMUL), - wuffs_base__make_pixel_subsampling(WUFFS_BASE__PIXEL_SUBSAMPLING__NONE), - width, height); + &ic.pixcfg, WUFFS_BASE__PIXEL_FORMAT__BGRA_PREMUL, + WUFFS_BASE__PIXEL_SUBSAMPLING__NONE, width, height); const char* msg = allocate(&dec, &ic); if (msg) { diff --git a/internal/cgen/base/image-public.h b/internal/cgen/base/image-public.h index 968d39b0..40d8f3e6 100644 --- a/internal/cgen/base/image-public.h +++ b/internal/cgen/base/image-public.h @@ -272,8 +272,8 @@ typedef struct { } private_impl; #ifdef __cplusplus - inline void set(wuffs_base__pixel_format pixfmt, - wuffs_base__pixel_subsampling pixsub, + inline void set(uint32_t pixfmt_repr, + uint32_t pixsub_repr, uint32_t width, uint32_t height); inline void invalidate(); @@ -301,19 +301,19 @@ wuffs_base__null_pixel_config() { // TODO: Should this function return bool? An error type? static inline void // wuffs_base__pixel_config__set(wuffs_base__pixel_config* c, - wuffs_base__pixel_format pixfmt, - wuffs_base__pixel_subsampling pixsub, + uint32_t pixfmt_repr, + uint32_t pixsub_repr, uint32_t width, uint32_t height) { if (!c) { return; } - if (pixfmt.repr) { + if (pixfmt_repr) { uint64_t wh = ((uint64_t)width) * ((uint64_t)height); // TODO: handle things other than 1 byte per pixel. if (wh <= ((uint64_t)SIZE_MAX)) { - c->private_impl.pixfmt = pixfmt; - c->private_impl.pixsub = pixsub; + c->private_impl.pixfmt.repr = pixfmt_repr; + c->private_impl.pixsub.repr = pixsub_repr; c->private_impl.width = width; c->private_impl.height = height; return; @@ -420,11 +420,11 @@ wuffs_base__pixel_config__pixbuf_len(const wuffs_base__pixel_config* c) { #ifdef __cplusplus inline void // -wuffs_base__pixel_config::set(wuffs_base__pixel_format pixfmt, - wuffs_base__pixel_subsampling pixsub, +wuffs_base__pixel_config::set(uint32_t pixfmt_repr, + uint32_t pixsub_repr, uint32_t width, uint32_t height) { - wuffs_base__pixel_config__set(this, pixfmt, pixsub, width, height); + wuffs_base__pixel_config__set(this, pixfmt_repr, pixsub_repr, width, height); } inline void // diff --git a/internal/cgen/data.go b/internal/cgen/data.go index e3578f2d..69310d1a 100644 --- a/internal/cgen/data.go +++ b/internal/cgen/data.go @@ -117,12 +117,12 @@ const baseImagePublicH = "" + "PIXEL_SUBSAMPLING__422 0x101000\n#define WUFFS_BASE__PIXEL_SUBSAMPLING__420 0x111100\n#define WUFFS_BASE__PIXEL_SUBSAMPLING__411 0x303000\n#define WUFFS_BASE__PIXEL_SUBSAMPLING__410 0x313100\n\nstatic inline uint32_t //\nwuffs_base__pixel_subsampling__bias_x(const wuffs_base__pixel_subsampling* s,\n uint32_t plane) {\n uint32_t shift = ((plane & 0x03) * 8) + 6;\n return (s->repr >> shift) & 0x03;\n}\n\nstatic inline uint32_t //\nwuffs_base__pixel_subsampling__denominator_x(\n const wuffs_base__pixel_subsampling* s,\n uint32_t plane) {\n uint32_t shift = ((plane & 0x03) * 8) + 4;\n return ((s->repr >> shift) & 0x03) + 1;\n}\n\nstatic inline uint32_t //\nwuffs_base__pixel_subsampling__bias_y(const wuffs_base__pixel_subsampling* s,\n uint32_t plane) {\n uint32_t shift = ((plane & 0x03) * 8) + 2;\n return (s->repr >> shift) & 0x03;\n}\n\nstatic inline uint32_t //\nwuffs_base__pixel_subsampling__denominator_y(\n const wuffs_base__pixel_subsampling* s," + "\n uint32_t plane) {\n uint32_t shift = ((plane & 0x03) * 8) + 0;\n return ((s->repr >> shift) & 0x03) + 1;\n}\n\n#ifdef __cplusplus\n\ninline uint32_t //\nwuffs_base__pixel_subsampling::bias_x(uint32_t plane) const {\n return wuffs_base__pixel_subsampling__bias_x(this, plane);\n}\n\ninline uint32_t //\nwuffs_base__pixel_subsampling::denominator_x(uint32_t plane) const {\n return wuffs_base__pixel_subsampling__denominator_x(this, plane);\n}\n\ninline uint32_t //\nwuffs_base__pixel_subsampling::bias_y(uint32_t plane) const {\n return wuffs_base__pixel_subsampling__bias_y(this, plane);\n}\n\ninline uint32_t //\nwuffs_base__pixel_subsampling::denominator_y(uint32_t plane) const {\n return wuffs_base__pixel_subsampling__denominator_y(this, plane);\n}\n\n#endif // __cplusplus\n\n" + "" + - "// --------\n\ntypedef struct {\n // Do not access the private_impl's fields directly. There is no API/ABI\n // compatibility or safety guarantee if you do so.\n struct {\n wuffs_base__pixel_format pixfmt;\n wuffs_base__pixel_subsampling pixsub;\n uint32_t width;\n uint32_t height;\n } private_impl;\n\n#ifdef __cplusplus\n inline void set(wuffs_base__pixel_format pixfmt,\n wuffs_base__pixel_subsampling pixsub,\n uint32_t width,\n uint32_t height);\n inline void invalidate();\n inline bool is_valid() const;\n inline wuffs_base__pixel_format pixel_format() const;\n inline wuffs_base__pixel_subsampling pixel_subsampling() const;\n inline wuffs_base__rect_ie_u32 bounds() const;\n inline uint32_t width() const;\n inline uint32_t height() const;\n inline uint64_t pixbuf_len() const;\n#endif // __cplusplus\n\n} wuffs_base__pixel_config;\n\nstatic inline wuffs_base__pixel_config //\nwuffs_base__null_pixel_config() {\n wuffs_base__pixel_config ret;\n ret.private_impl.pix" + - "fmt.repr = 0;\n ret.private_impl.pixsub.repr = 0;\n ret.private_impl.width = 0;\n ret.private_impl.height = 0;\n return ret;\n}\n\n// TODO: Should this function return bool? An error type?\nstatic inline void //\nwuffs_base__pixel_config__set(wuffs_base__pixel_config* c,\n wuffs_base__pixel_format pixfmt,\n wuffs_base__pixel_subsampling pixsub,\n uint32_t width,\n uint32_t height) {\n if (!c) {\n return;\n }\n if (pixfmt.repr) {\n uint64_t wh = ((uint64_t)width) * ((uint64_t)height);\n // TODO: handle things other than 1 byte per pixel.\n if (wh <= ((uint64_t)SIZE_MAX)) {\n c->private_impl.pixfmt = pixfmt;\n c->private_impl.pixsub = pixsub;\n c->private_impl.width = width;\n c->private_impl.height = height;\n return;\n }\n }\n\n c->private_impl.pixfmt.repr = 0;\n c->private_impl.pixsub.repr = 0;\n c->private_impl.width = 0;\n c->private_impl.height = 0;\n}\n\nstatic inline void" + - " //\nwuffs_base__pixel_config__invalidate(wuffs_base__pixel_config* c) {\n if (c) {\n c->private_impl.pixfmt.repr = 0;\n c->private_impl.pixsub.repr = 0;\n c->private_impl.width = 0;\n c->private_impl.height = 0;\n }\n}\n\nstatic inline bool //\nwuffs_base__pixel_config__is_valid(const wuffs_base__pixel_config* c) {\n return c && c->private_impl.pixfmt.repr;\n}\n\nstatic inline wuffs_base__pixel_format //\nwuffs_base__pixel_config__pixel_format(const wuffs_base__pixel_config* c) {\n return c ? c->private_impl.pixfmt : wuffs_base__make_pixel_format(0);\n}\n\nstatic inline wuffs_base__pixel_subsampling //\nwuffs_base__pixel_config__pixel_subsampling(const wuffs_base__pixel_config* c) {\n return c ? c->private_impl.pixsub : wuffs_base__make_pixel_subsampling(0);\n}\n\nstatic inline wuffs_base__rect_ie_u32 //\nwuffs_base__pixel_config__bounds(const wuffs_base__pixel_config* c) {\n if (c) {\n wuffs_base__rect_ie_u32 ret;\n ret.min_incl_x = 0;\n ret.min_incl_y = 0;\n ret.max_excl_x = c->private_impl.width;\n " + - "ret.max_excl_y = c->private_impl.height;\n return ret;\n }\n\n wuffs_base__rect_ie_u32 ret;\n ret.min_incl_x = 0;\n ret.min_incl_y = 0;\n ret.max_excl_x = 0;\n ret.max_excl_y = 0;\n return ret;\n}\n\nstatic inline uint32_t //\nwuffs_base__pixel_config__width(const wuffs_base__pixel_config* c) {\n return c ? c->private_impl.width : 0;\n}\n\nstatic inline uint32_t //\nwuffs_base__pixel_config__height(const wuffs_base__pixel_config* c) {\n return c ? c->private_impl.height : 0;\n}\n\n// TODO: this is the right API for planar (not interleaved) pixbufs? Should it\n// allow decoding into a color model different from the format's intrinsic one?\n// For example, decoding a JPEG image straight to RGBA instead of to YCbCr?\nstatic inline uint64_t //\nwuffs_base__pixel_config__pixbuf_len(const wuffs_base__pixel_config* c) {\n if (!c) {\n return 0;\n }\n if (wuffs_base__pixel_format__is_planar(&c->private_impl.pixfmt)) {\n // TODO: support planar pixel formats, concious of pixel subsampling.\n return 0;\n }\n uint32_t bits_pe" + - "r_pixel =\n wuffs_base__pixel_format__bits_per_pixel(&c->private_impl.pixfmt);\n if ((bits_per_pixel == 0) || ((bits_per_pixel % 8) != 0)) {\n // TODO: support fraction-of-byte pixels, e.g. 1 bit per pixel?\n return 0;\n }\n uint64_t bytes_per_pixel = bits_per_pixel / 8;\n\n uint64_t n =\n ((uint64_t)c->private_impl.width) * ((uint64_t)c->private_impl.height);\n if (n > (UINT64_MAX / bytes_per_pixel)) {\n return 0;\n }\n n *= bytes_per_pixel;\n\n if (wuffs_base__pixel_format__is_indexed(&c->private_impl.pixfmt)) {\n if (n > (UINT64_MAX - 1024)) {\n return 0;\n }\n n += 1024;\n }\n\n return n;\n}\n\n#ifdef __cplusplus\n\ninline void //\nwuffs_base__pixel_config::set(wuffs_base__pixel_format pixfmt,\n wuffs_base__pixel_subsampling pixsub,\n uint32_t width,\n uint32_t height) {\n wuffs_base__pixel_config__set(this, pixfmt, pixsub, width, height);\n}\n\ninline void //\nwuffs_base__pixel_config::invalidate() {\n wuffs_" + - "base__pixel_config__invalidate(this);\n}\n\ninline bool //\nwuffs_base__pixel_config::is_valid() const {\n return wuffs_base__pixel_config__is_valid(this);\n}\n\ninline wuffs_base__pixel_format //\nwuffs_base__pixel_config::pixel_format() const {\n return wuffs_base__pixel_config__pixel_format(this);\n}\n\ninline wuffs_base__pixel_subsampling //\nwuffs_base__pixel_config::pixel_subsampling() const {\n return wuffs_base__pixel_config__pixel_subsampling(this);\n}\n\ninline wuffs_base__rect_ie_u32 //\nwuffs_base__pixel_config::bounds() const {\n return wuffs_base__pixel_config__bounds(this);\n}\n\ninline uint32_t //\nwuffs_base__pixel_config::width() const {\n return wuffs_base__pixel_config__width(this);\n}\n\ninline uint32_t //\nwuffs_base__pixel_config::height() const {\n return wuffs_base__pixel_config__height(this);\n}\n\ninline uint64_t //\nwuffs_base__pixel_config::pixbuf_len() const {\n return wuffs_base__pixel_config__pixbuf_len(this);\n}\n\n#endif // __cplusplus\n\n" + + "// --------\n\ntypedef struct {\n // Do not access the private_impl's fields directly. There is no API/ABI\n // compatibility or safety guarantee if you do so.\n struct {\n wuffs_base__pixel_format pixfmt;\n wuffs_base__pixel_subsampling pixsub;\n uint32_t width;\n uint32_t height;\n } private_impl;\n\n#ifdef __cplusplus\n inline void set(uint32_t pixfmt_repr,\n uint32_t pixsub_repr,\n uint32_t width,\n uint32_t height);\n inline void invalidate();\n inline bool is_valid() const;\n inline wuffs_base__pixel_format pixel_format() const;\n inline wuffs_base__pixel_subsampling pixel_subsampling() const;\n inline wuffs_base__rect_ie_u32 bounds() const;\n inline uint32_t width() const;\n inline uint32_t height() const;\n inline uint64_t pixbuf_len() const;\n#endif // __cplusplus\n\n} wuffs_base__pixel_config;\n\nstatic inline wuffs_base__pixel_config //\nwuffs_base__null_pixel_config() {\n wuffs_base__pixel_config ret;\n ret.private_impl.pixfmt.repr = 0;\n ret.private" + + "_impl.pixsub.repr = 0;\n ret.private_impl.width = 0;\n ret.private_impl.height = 0;\n return ret;\n}\n\n// TODO: Should this function return bool? An error type?\nstatic inline void //\nwuffs_base__pixel_config__set(wuffs_base__pixel_config* c,\n uint32_t pixfmt_repr,\n uint32_t pixsub_repr,\n uint32_t width,\n uint32_t height) {\n if (!c) {\n return;\n }\n if (pixfmt_repr) {\n uint64_t wh = ((uint64_t)width) * ((uint64_t)height);\n // TODO: handle things other than 1 byte per pixel.\n if (wh <= ((uint64_t)SIZE_MAX)) {\n c->private_impl.pixfmt.repr = pixfmt_repr;\n c->private_impl.pixsub.repr = pixsub_repr;\n c->private_impl.width = width;\n c->private_impl.height = height;\n return;\n }\n }\n\n c->private_impl.pixfmt.repr = 0;\n c->private_impl.pixsub.repr = 0;\n c->private_impl.width = 0;\n c->private_impl.height = 0;\n}\n\nstatic inline void //\nwuffs_base__pixel_config__inv" + + "alidate(wuffs_base__pixel_config* c) {\n if (c) {\n c->private_impl.pixfmt.repr = 0;\n c->private_impl.pixsub.repr = 0;\n c->private_impl.width = 0;\n c->private_impl.height = 0;\n }\n}\n\nstatic inline bool //\nwuffs_base__pixel_config__is_valid(const wuffs_base__pixel_config* c) {\n return c && c->private_impl.pixfmt.repr;\n}\n\nstatic inline wuffs_base__pixel_format //\nwuffs_base__pixel_config__pixel_format(const wuffs_base__pixel_config* c) {\n return c ? c->private_impl.pixfmt : wuffs_base__make_pixel_format(0);\n}\n\nstatic inline wuffs_base__pixel_subsampling //\nwuffs_base__pixel_config__pixel_subsampling(const wuffs_base__pixel_config* c) {\n return c ? c->private_impl.pixsub : wuffs_base__make_pixel_subsampling(0);\n}\n\nstatic inline wuffs_base__rect_ie_u32 //\nwuffs_base__pixel_config__bounds(const wuffs_base__pixel_config* c) {\n if (c) {\n wuffs_base__rect_ie_u32 ret;\n ret.min_incl_x = 0;\n ret.min_incl_y = 0;\n ret.max_excl_x = c->private_impl.width;\n ret.max_excl_y = c->private_impl.h" + + "eight;\n return ret;\n }\n\n wuffs_base__rect_ie_u32 ret;\n ret.min_incl_x = 0;\n ret.min_incl_y = 0;\n ret.max_excl_x = 0;\n ret.max_excl_y = 0;\n return ret;\n}\n\nstatic inline uint32_t //\nwuffs_base__pixel_config__width(const wuffs_base__pixel_config* c) {\n return c ? c->private_impl.width : 0;\n}\n\nstatic inline uint32_t //\nwuffs_base__pixel_config__height(const wuffs_base__pixel_config* c) {\n return c ? c->private_impl.height : 0;\n}\n\n// TODO: this is the right API for planar (not interleaved) pixbufs? Should it\n// allow decoding into a color model different from the format's intrinsic one?\n// For example, decoding a JPEG image straight to RGBA instead of to YCbCr?\nstatic inline uint64_t //\nwuffs_base__pixel_config__pixbuf_len(const wuffs_base__pixel_config* c) {\n if (!c) {\n return 0;\n }\n if (wuffs_base__pixel_format__is_planar(&c->private_impl.pixfmt)) {\n // TODO: support planar pixel formats, concious of pixel subsampling.\n return 0;\n }\n uint32_t bits_per_pixel =\n wuffs_base__pixel_" + + "format__bits_per_pixel(&c->private_impl.pixfmt);\n if ((bits_per_pixel == 0) || ((bits_per_pixel % 8) != 0)) {\n // TODO: support fraction-of-byte pixels, e.g. 1 bit per pixel?\n return 0;\n }\n uint64_t bytes_per_pixel = bits_per_pixel / 8;\n\n uint64_t n =\n ((uint64_t)c->private_impl.width) * ((uint64_t)c->private_impl.height);\n if (n > (UINT64_MAX / bytes_per_pixel)) {\n return 0;\n }\n n *= bytes_per_pixel;\n\n if (wuffs_base__pixel_format__is_indexed(&c->private_impl.pixfmt)) {\n if (n > (UINT64_MAX - 1024)) {\n return 0;\n }\n n += 1024;\n }\n\n return n;\n}\n\n#ifdef __cplusplus\n\ninline void //\nwuffs_base__pixel_config::set(uint32_t pixfmt_repr,\n uint32_t pixsub_repr,\n uint32_t width,\n uint32_t height) {\n wuffs_base__pixel_config__set(this, pixfmt_repr, pixsub_repr, width, height);\n}\n\ninline void //\nwuffs_base__pixel_config::invalidate() {\n wuffs_base__pixel_config__invalidate(this);\n}\n\ninline boo" + + "l //\nwuffs_base__pixel_config::is_valid() const {\n return wuffs_base__pixel_config__is_valid(this);\n}\n\ninline wuffs_base__pixel_format //\nwuffs_base__pixel_config::pixel_format() const {\n return wuffs_base__pixel_config__pixel_format(this);\n}\n\ninline wuffs_base__pixel_subsampling //\nwuffs_base__pixel_config::pixel_subsampling() const {\n return wuffs_base__pixel_config__pixel_subsampling(this);\n}\n\ninline wuffs_base__rect_ie_u32 //\nwuffs_base__pixel_config::bounds() const {\n return wuffs_base__pixel_config__bounds(this);\n}\n\ninline uint32_t //\nwuffs_base__pixel_config::width() const {\n return wuffs_base__pixel_config__width(this);\n}\n\ninline uint32_t //\nwuffs_base__pixel_config::height() const {\n return wuffs_base__pixel_config__height(this);\n}\n\ninline uint64_t //\nwuffs_base__pixel_config::pixbuf_len() const {\n return wuffs_base__pixel_config__pixbuf_len(this);\n}\n\n#endif // __cplusplus\n\n" + "" + "// --------\n\ntypedef struct {\n wuffs_base__pixel_config pixcfg;\n\n // Do not access the private_impl's fields directly. There is no API/ABI\n // compatibility or safety guarantee if you do so.\n struct {\n uint64_t first_frame_io_position;\n bool first_frame_is_opaque;\n } private_impl;\n\n#ifdef __cplusplus\n inline void set(uint32_t pixfmt_repr,\n uint32_t pixsub_repr,\n uint32_t width,\n uint32_t height,\n uint64_t first_frame_io_position,\n bool first_frame_is_opaque);\n inline void invalidate();\n inline bool is_valid() const;\n inline uint64_t first_frame_io_position() const;\n inline bool first_frame_is_opaque() const;\n#endif // __cplusplus\n\n} wuffs_base__image_config;\n\nstatic inline wuffs_base__image_config //\nwuffs_base__null_image_config() {\n wuffs_base__image_config ret;\n ret.pixcfg = wuffs_base__null_pixel_config();\n ret.private_impl.first_frame_io_position = 0;\n ret.private_impl.first_frame_is_opaque = false;" + "\n return ret;\n}\n\n// TODO: Should this function return bool? An error type?\nstatic inline void //\nwuffs_base__image_config__set(wuffs_base__image_config* c,\n uint32_t pixfmt_repr,\n uint32_t pixsub_repr,\n uint32_t width,\n uint32_t height,\n uint64_t first_frame_io_position,\n bool first_frame_is_opaque) {\n if (!c) {\n return;\n }\n if (pixfmt_repr) {\n c->pixcfg.private_impl.pixfmt.repr = pixfmt_repr;\n c->pixcfg.private_impl.pixsub.repr = pixsub_repr;\n c->pixcfg.private_impl.width = width;\n c->pixcfg.private_impl.height = height;\n c->private_impl.first_frame_io_position = first_frame_io_position;\n c->private_impl.first_frame_is_opaque = first_frame_is_opaque;\n return;\n }\n\n c->pixcfg.private_impl.pixfmt.repr = 0;\n c->pixcfg.private_impl.pixsub.repr = 0;\n c->pixcfg.private_impl.width = 0;\n c->pixcfg.private_impl.he" + diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c index 96b44e5a..98f6e6f2 100644 --- a/release/c/wuffs-unsupported-snapshot.c +++ b/release/c/wuffs-unsupported-snapshot.c @@ -1714,8 +1714,8 @@ typedef struct { } private_impl; #ifdef __cplusplus - inline void set(wuffs_base__pixel_format pixfmt, - wuffs_base__pixel_subsampling pixsub, + inline void set(uint32_t pixfmt_repr, + uint32_t pixsub_repr, uint32_t width, uint32_t height); inline void invalidate(); @@ -1743,19 +1743,19 @@ wuffs_base__null_pixel_config() { // TODO: Should this function return bool? An error type? static inline void // wuffs_base__pixel_config__set(wuffs_base__pixel_config* c, - wuffs_base__pixel_format pixfmt, - wuffs_base__pixel_subsampling pixsub, + uint32_t pixfmt_repr, + uint32_t pixsub_repr, uint32_t width, uint32_t height) { if (!c) { return; } - if (pixfmt.repr) { + if (pixfmt_repr) { uint64_t wh = ((uint64_t)width) * ((uint64_t)height); // TODO: handle things other than 1 byte per pixel. if (wh <= ((uint64_t)SIZE_MAX)) { - c->private_impl.pixfmt = pixfmt; - c->private_impl.pixsub = pixsub; + c->private_impl.pixfmt.repr = pixfmt_repr; + c->private_impl.pixsub.repr = pixsub_repr; c->private_impl.width = width; c->private_impl.height = height; return; @@ -1862,11 +1862,11 @@ wuffs_base__pixel_config__pixbuf_len(const wuffs_base__pixel_config* c) { #ifdef __cplusplus inline void // -wuffs_base__pixel_config::set(wuffs_base__pixel_format pixfmt, - wuffs_base__pixel_subsampling pixsub, +wuffs_base__pixel_config::set(uint32_t pixfmt_repr, + uint32_t pixsub_repr, uint32_t width, uint32_t height) { - wuffs_base__pixel_config__set(this, pixfmt, pixsub, width, height); + wuffs_base__pixel_config__set(this, pixfmt_repr, pixsub_repr, width, height); } inline void // diff --git a/test/c/std/gif.c b/test/c/std/gif.c index c4f348ce..4fdd5ce2 100644 --- a/test/c/std/gif.c +++ b/test/c/std/gif.c @@ -209,11 +209,10 @@ const char* wuffs_gif_decode(wuffs_base__io_buffer* dst, CHECK_STATUS("decode_image_config", wuffs_gif__decoder__decode_image_config(&dec, &ic, src)); - wuffs_base__pixel_config__set( - &ic.pixcfg, pixfmt, - wuffs_base__make_pixel_subsampling(WUFFS_BASE__PIXEL_SUBSAMPLING__NONE), - wuffs_base__pixel_config__width(&ic.pixcfg), - wuffs_base__pixel_config__height(&ic.pixcfg)); + wuffs_base__pixel_config__set(&ic.pixcfg, pixfmt.repr, + WUFFS_BASE__PIXEL_SUBSAMPLING__NONE, + wuffs_base__pixel_config__width(&ic.pixcfg), + wuffs_base__pixel_config__height(&ic.pixcfg)); wuffs_base__pixel_buffer pb = ((wuffs_base__pixel_buffer){}); CHECK_STATUS("set_from_slice", wuffs_base__pixel_buffer__set_from_slice( @@ -282,10 +281,9 @@ const char* do_test_wuffs_gif_decode(const char* filename, RETURN_FAIL("first_frame_is_opaque: got false, want true"); } - wuffs_base__pixel_config__set( - &ic.pixcfg, dst_pixfmt, - wuffs_base__make_pixel_subsampling(WUFFS_BASE__PIXEL_SUBSAMPLING__NONE), - 160, 120); + wuffs_base__pixel_config__set(&ic.pixcfg, dst_pixfmt.repr, + WUFFS_BASE__PIXEL_SUBSAMPLING__NONE, 160, + 120); CHECK_STATUS("set_from_slice", wuffs_base__pixel_buffer__set_from_slice( &pb, &ic.pixcfg, global_pixel_slice)); @@ -913,8 +911,8 @@ const char* test_wuffs_gif_decode_frame_out_of_bounds() { wuffs_base__pixel_config five_by_five = ((wuffs_base__pixel_config){}); wuffs_base__pixel_config__set( - &five_by_five, wuffs_base__pixel_config__pixel_format(&ic.pixcfg), - wuffs_base__pixel_config__pixel_subsampling(&ic.pixcfg), 5, 5); + &five_by_five, wuffs_base__pixel_config__pixel_format(&ic.pixcfg).repr, + wuffs_base__pixel_config__pixel_subsampling(&ic.pixcfg).repr, 5, 5); wuffs_base__pixel_buffer pb = ((wuffs_base__pixel_buffer){}); status = wuffs_base__pixel_buffer__set_from_slice(&pb, &five_by_five, global_pixel_slice);