diff --git a/internal/cgen/base/image-public.h b/internal/cgen/base/image-public.h index 948075e6..10058006 100644 --- a/internal/cgen/base/image-public.h +++ b/internal/cgen/base/image-public.h @@ -729,6 +729,7 @@ typedef struct { uint64_t io_position; wuffs_base__animation_blend blend; wuffs_base__animation_disposal disposal; + wuffs_base__color_u32_argb_premul background_color; } private_impl; #ifdef __cplusplus @@ -737,7 +738,8 @@ typedef struct { uint64_t index, uint64_t io_position, wuffs_base__animation_blend blend, - wuffs_base__animation_disposal disposal); + wuffs_base__animation_disposal disposal, + wuffs_base__color_u32_argb_premul background_color); inline wuffs_base__rect_ie_u32 bounds() const; inline uint32_t width() const; inline uint32_t height() const; @@ -746,6 +748,7 @@ typedef struct { inline uint64_t io_position() const; inline wuffs_base__animation_blend blend() const; inline wuffs_base__animation_disposal disposal() const; + inline wuffs_base__color_u32_argb_premul background_color() const; #endif // __cplusplus } wuffs_base__frame_config; @@ -763,13 +766,15 @@ wuffs_base__null_frame_config() { } static inline void // -wuffs_base__frame_config__update(wuffs_base__frame_config* c, - wuffs_base__rect_ie_u32 bounds, - wuffs_base__flicks duration, - uint64_t index, - uint64_t io_position, - wuffs_base__animation_blend blend, - wuffs_base__animation_disposal disposal) { +wuffs_base__frame_config__update( + wuffs_base__frame_config* c, + wuffs_base__rect_ie_u32 bounds, + wuffs_base__flicks duration, + uint64_t index, + uint64_t io_position, + wuffs_base__animation_blend blend, + wuffs_base__animation_disposal disposal, + wuffs_base__color_u32_argb_premul background_color) { if (!c) { return; } @@ -780,6 +785,7 @@ wuffs_base__frame_config__update(wuffs_base__frame_config* c, c->private_impl.io_position = io_position; c->private_impl.blend = blend; c->private_impl.disposal = disposal; + c->private_impl.background_color = background_color; } static inline wuffs_base__rect_ie_u32 // @@ -841,17 +847,24 @@ wuffs_base__frame_config__disposal(const wuffs_base__frame_config* c) { return c ? c->private_impl.disposal : 0; } +static inline wuffs_base__color_u32_argb_premul // +wuffs_base__frame_config__background_color(const wuffs_base__frame_config* c) { + return c ? c->private_impl.background_color : 0; +} + #ifdef __cplusplus inline void // -wuffs_base__frame_config::update(wuffs_base__rect_ie_u32 bounds, - wuffs_base__flicks duration, - uint64_t index, - uint64_t io_position, - wuffs_base__animation_blend blend, - wuffs_base__animation_disposal disposal) { +wuffs_base__frame_config::update( + wuffs_base__rect_ie_u32 bounds, + wuffs_base__flicks duration, + uint64_t index, + uint64_t io_position, + wuffs_base__animation_blend blend, + wuffs_base__animation_disposal disposal, + wuffs_base__color_u32_argb_premul background_color) { wuffs_base__frame_config__update(this, bounds, duration, index, io_position, - blend, disposal); + blend, disposal, background_color); } inline wuffs_base__rect_ie_u32 // @@ -894,6 +907,11 @@ wuffs_base__frame_config::disposal() const { return wuffs_base__frame_config__disposal(this); } +inline wuffs_base__color_u32_argb_premul // +wuffs_base__frame_config::background_color() const { + return wuffs_base__frame_config__background_color(this); +} + #endif // __cplusplus // -------- diff --git a/internal/cgen/data.go b/internal/cgen/data.go index f05413e5..49a417eb 100644 --- a/internal/cgen/data.go +++ b/internal/cgen/data.go @@ -136,12 +136,13 @@ const baseImagePublicH = "" + "" + "// --------\n\n// wuffs_base__animation_disposal encodes, for an animated image, how to\n// dispose of a frame after displaying it:\n// - None means to draw the next frame on top of this one.\n// - Restore Background means to clear the frame's dirty rectangle to \"the\n// background color\" (in practice, this means transparent black) before\n// drawing the next frame.\n// - Restore Previous means to undo the current frame, so that the next frame\n// is drawn on top of the previous one.\ntypedef uint8_t wuffs_base__animation_disposal;\n\n#define WUFFS_BASE__ANIMATION_DISPOSAL__NONE ((wuffs_base__animation_disposal)0)\n#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_BACKGROUND \\\n ((wuffs_base__animation_disposal)1)\n#define WUFFS_BASE__ANIMATION_DISPOSAL__RESTORE_PREVIOUS \\\n ((wuffs_base__animation_disposal)2)\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__rect_ie_u32 bounds;\n wuffs_base__flicks duration;\n uint64_t index;\n uint64_t io_position;\n wuffs_base__animation_blend blend;\n wuffs_base__animation_disposal disposal;\n } private_impl;\n\n#ifdef __cplusplus\n inline void update(wuffs_base__rect_ie_u32 bounds,\n wuffs_base__flicks duration,\n uint64_t index,\n uint64_t io_position,\n wuffs_base__animation_blend blend,\n wuffs_base__animation_disposal disposal);\n inline wuffs_base__rect_ie_u32 bounds() const;\n inline uint32_t width() const;\n inline uint32_t height() const;\n inline wuffs_base__flicks duration() const;\n inline uint64_t index() const;\n inline uint64_t io_position() const;\n inline wuffs_base__animation_blend blend() const;\n inline wuffs_base__animation" + - "_disposal disposal() const;\n#endif // __cplusplus\n\n} wuffs_base__frame_config;\n\nstatic inline wuffs_base__frame_config //\nwuffs_base__null_frame_config() {\n wuffs_base__frame_config ret;\n ret.private_impl.bounds = wuffs_base__make_rect_ie_u32(0, 0, 0, 0);\n ret.private_impl.duration = 0;\n ret.private_impl.index = 0;\n ret.private_impl.io_position = 0;\n ret.private_impl.blend = 0;\n ret.private_impl.disposal = 0;\n return ret;\n}\n\nstatic inline void //\nwuffs_base__frame_config__update(wuffs_base__frame_config* c,\n wuffs_base__rect_ie_u32 bounds,\n wuffs_base__flicks duration,\n uint64_t index,\n uint64_t io_position,\n wuffs_base__animation_blend blend,\n wuffs_base__animation_disposal disposal) {\n if (!c) {\n return;\n }\n\n c->private_impl.bounds = bounds;\n c->private_impl.duration = duration;\n c->private_impl.inde" + - "x = index;\n c->private_impl.io_position = io_position;\n c->private_impl.blend = blend;\n c->private_impl.disposal = disposal;\n}\n\nstatic inline wuffs_base__rect_ie_u32 //\nwuffs_base__frame_config__bounds(const wuffs_base__frame_config* c) {\n if (c) {\n return c->private_impl.bounds;\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__frame_config__width(const wuffs_base__frame_config* c) {\n return c ? wuffs_base__rect_ie_u32__width(&c->private_impl.bounds) : 0;\n}\n\nstatic inline uint32_t //\nwuffs_base__frame_config__height(const wuffs_base__frame_config* c) {\n return c ? wuffs_base__rect_ie_u32__height(&c->private_impl.bounds) : 0;\n}\n\n// wuffs_base__frame_config__duration returns the amount of time to display\n// this frame. Zero means to display forever - a still (non-animated) image.\nstatic inline wuffs_base__flicks //\nwuffs_base__frame_config__duration(const wuffs_base__fra" + - "me_config* c) {\n return c ? c->private_impl.duration : 0;\n}\n\n// wuffs_base__frame_config__index returns the index of this frame. The first\n// frame in an image has index 0, the second frame has index 1, and so on.\nstatic inline uint64_t //\nwuffs_base__frame_config__index(const wuffs_base__frame_config* c) {\n return c ? c->private_impl.index : 0;\n}\n\n// wuffs_base__frame_config__io_position returns the I/O stream position before\n// the frame config.\nstatic inline uint64_t //\nwuffs_base__frame_config__io_position(const wuffs_base__frame_config* c) {\n return c ? c->private_impl.io_position : 0;\n}\n\n// wuffs_base__frame_config__blend returns, for an animated image, how to blend\n// the transparent pixels of this frame with the existing canvas.\nstatic inline wuffs_base__animation_blend //\nwuffs_base__frame_config__blend(const wuffs_base__frame_config* c) {\n return c ? c->private_impl.blend : 0;\n}\n\n// wuffs_base__frame_config__disposal returns, for an animated image, how to\n// dispose of this frame after displa" + - "ying it.\nstatic inline wuffs_base__animation_disposal //\nwuffs_base__frame_config__disposal(const wuffs_base__frame_config* c) {\n return c ? c->private_impl.disposal : 0;\n}\n\n#ifdef __cplusplus\n\ninline void //\nwuffs_base__frame_config::update(wuffs_base__rect_ie_u32 bounds,\n wuffs_base__flicks duration,\n uint64_t index,\n uint64_t io_position,\n wuffs_base__animation_blend blend,\n wuffs_base__animation_disposal disposal) {\n wuffs_base__frame_config__update(this, bounds, duration, index, io_position,\n blend, disposal);\n}\n\ninline wuffs_base__rect_ie_u32 //\nwuffs_base__frame_config::bounds() const {\n return wuffs_base__frame_config__bounds(this);\n}\n\ninline uint32_t //\nwuffs_base__frame_config::width() const {\n return wuffs_base__frame_config__width(this);\n}\n\ninline uint32_t //\nwuffs_base__frame_config::height() cons" + - "t {\n return wuffs_base__frame_config__height(this);\n}\n\ninline wuffs_base__flicks //\nwuffs_base__frame_config::duration() const {\n return wuffs_base__frame_config__duration(this);\n}\n\ninline uint64_t //\nwuffs_base__frame_config::index() const {\n return wuffs_base__frame_config__index(this);\n}\n\ninline uint64_t //\nwuffs_base__frame_config::io_position() const {\n return wuffs_base__frame_config__io_position(this);\n}\n\ninline wuffs_base__animation_blend //\nwuffs_base__frame_config::blend() const {\n return wuffs_base__frame_config__blend(this);\n}\n\ninline wuffs_base__animation_disposal //\nwuffs_base__frame_config::disposal() const {\n return wuffs_base__frame_config__disposal(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__rect_ie_u32 bounds;\n wuffs_base__flicks duration;\n uint64_t index;\n uint64_t io_position;\n wuffs_base__animation_blend blend;\n wuffs_base__animation_disposal disposal;\n wuffs_base__color_u32_argb_premul background_color;\n } private_impl;\n\n#ifdef __cplusplus\n inline void update(wuffs_base__rect_ie_u32 bounds,\n wuffs_base__flicks duration,\n uint64_t index,\n uint64_t io_position,\n wuffs_base__animation_blend blend,\n wuffs_base__animation_disposal disposal,\n wuffs_base__color_u32_argb_premul background_color);\n inline wuffs_base__rect_ie_u32 bounds() const;\n inline uint32_t width() const;\n inline uint32_t height() const;\n inline wuffs_base__flicks duration() const;\n inline uint64_t index()" + + " const;\n inline uint64_t io_position() const;\n inline wuffs_base__animation_blend blend() const;\n inline wuffs_base__animation_disposal disposal() const;\n inline wuffs_base__color_u32_argb_premul background_color() const;\n#endif // __cplusplus\n\n} wuffs_base__frame_config;\n\nstatic inline wuffs_base__frame_config //\nwuffs_base__null_frame_config() {\n wuffs_base__frame_config ret;\n ret.private_impl.bounds = wuffs_base__make_rect_ie_u32(0, 0, 0, 0);\n ret.private_impl.duration = 0;\n ret.private_impl.index = 0;\n ret.private_impl.io_position = 0;\n ret.private_impl.blend = 0;\n ret.private_impl.disposal = 0;\n return ret;\n}\n\nstatic inline void //\nwuffs_base__frame_config__update(\n wuffs_base__frame_config* c,\n wuffs_base__rect_ie_u32 bounds,\n wuffs_base__flicks duration,\n uint64_t index,\n uint64_t io_position,\n wuffs_base__animation_blend blend,\n wuffs_base__animation_disposal disposal,\n wuffs_base__color_u32_argb_premul background_color) {\n if (!c) {\n return;\n }\n\n c->privat" + + "e_impl.bounds = bounds;\n c->private_impl.duration = duration;\n c->private_impl.index = index;\n c->private_impl.io_position = io_position;\n c->private_impl.blend = blend;\n c->private_impl.disposal = disposal;\n c->private_impl.background_color = background_color;\n}\n\nstatic inline wuffs_base__rect_ie_u32 //\nwuffs_base__frame_config__bounds(const wuffs_base__frame_config* c) {\n if (c) {\n return c->private_impl.bounds;\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__frame_config__width(const wuffs_base__frame_config* c) {\n return c ? wuffs_base__rect_ie_u32__width(&c->private_impl.bounds) : 0;\n}\n\nstatic inline uint32_t //\nwuffs_base__frame_config__height(const wuffs_base__frame_config* c) {\n return c ? wuffs_base__rect_ie_u32__height(&c->private_impl.bounds) : 0;\n}\n\n// wuffs_base__frame_config__duration returns the amount of time to display\n// this frame. Zero means to d" + + "isplay forever - a still (non-animated) image.\nstatic inline wuffs_base__flicks //\nwuffs_base__frame_config__duration(const wuffs_base__frame_config* c) {\n return c ? c->private_impl.duration : 0;\n}\n\n// wuffs_base__frame_config__index returns the index of this frame. The first\n// frame in an image has index 0, the second frame has index 1, and so on.\nstatic inline uint64_t //\nwuffs_base__frame_config__index(const wuffs_base__frame_config* c) {\n return c ? c->private_impl.index : 0;\n}\n\n// wuffs_base__frame_config__io_position returns the I/O stream position before\n// the frame config.\nstatic inline uint64_t //\nwuffs_base__frame_config__io_position(const wuffs_base__frame_config* c) {\n return c ? c->private_impl.io_position : 0;\n}\n\n// wuffs_base__frame_config__blend returns, for an animated image, how to blend\n// the transparent pixels of this frame with the existing canvas.\nstatic inline wuffs_base__animation_blend //\nwuffs_base__frame_config__blend(const wuffs_base__frame_config* c) {\n return c ? c->p" + + "rivate_impl.blend : 0;\n}\n\n// wuffs_base__frame_config__disposal returns, for an animated image, how to\n// dispose of this frame after displaying it.\nstatic inline wuffs_base__animation_disposal //\nwuffs_base__frame_config__disposal(const wuffs_base__frame_config* c) {\n return c ? c->private_impl.disposal : 0;\n}\n\nstatic inline wuffs_base__color_u32_argb_premul //\nwuffs_base__frame_config__background_color(const wuffs_base__frame_config* c) {\n return c ? c->private_impl.background_color : 0;\n}\n\n#ifdef __cplusplus\n\ninline void //\nwuffs_base__frame_config::update(\n wuffs_base__rect_ie_u32 bounds,\n wuffs_base__flicks duration,\n uint64_t index,\n uint64_t io_position,\n wuffs_base__animation_blend blend,\n wuffs_base__animation_disposal disposal,\n wuffs_base__color_u32_argb_premul background_color) {\n wuffs_base__frame_config__update(this, bounds, duration, index, io_position,\n blend, disposal, background_color);\n}\n\ninline wuffs_base__rect_ie_u32 //\nwuffs_b" + + "ase__frame_config::bounds() const {\n return wuffs_base__frame_config__bounds(this);\n}\n\ninline uint32_t //\nwuffs_base__frame_config::width() const {\n return wuffs_base__frame_config__width(this);\n}\n\ninline uint32_t //\nwuffs_base__frame_config::height() const {\n return wuffs_base__frame_config__height(this);\n}\n\ninline wuffs_base__flicks //\nwuffs_base__frame_config::duration() const {\n return wuffs_base__frame_config__duration(this);\n}\n\ninline uint64_t //\nwuffs_base__frame_config::index() const {\n return wuffs_base__frame_config__index(this);\n}\n\ninline uint64_t //\nwuffs_base__frame_config::io_position() const {\n return wuffs_base__frame_config__io_position(this);\n}\n\ninline wuffs_base__animation_blend //\nwuffs_base__frame_config::blend() const {\n return wuffs_base__frame_config__blend(this);\n}\n\ninline wuffs_base__animation_disposal //\nwuffs_base__frame_config::disposal() const {\n return wuffs_base__frame_config__disposal(this);\n}\n\ninline wuffs_base__color_u32_argb_premul //\nwuffs_base__frame_confi" + + "g::background_color() const {\n return wuffs_base__frame_config__background_color(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 wuffs_base__table_u8 planes[WUFFS_BASE__PIXEL_FORMAT__NUM_PLANES_MAX];\n // TODO: color spaces.\n } private_impl;\n\n#ifdef __cplusplus\n inline wuffs_base__status set_from_slice(wuffs_base__pixel_config* pixcfg,\n wuffs_base__slice_u8 pixbuf_memory);\n inline wuffs_base__slice_u8 palette();\n inline wuffs_base__pixel_format pixel_format() const;\n inline wuffs_base__table_u8 plane(uint32_t p);\n#endif // __cplusplus\n\n} wuffs_base__pixel_buffer;\n\nstatic inline wuffs_base__pixel_buffer //\nwuffs_base__null_pixel_buffer() {\n wuffs_base__pixel_buffer ret;\n ret.pixcfg = wuffs_base__null_pixel_config();\n ret.private_impl.planes[0] = wuffs_base__null_table_u8();\n ret.private_impl.planes[1] = wuffs_base__null_table_u8();\n ret.private_impl.planes[2] = wuffs_base__nul" + "l_table_u8();\n ret.private_impl.planes[3] = wuffs_base__null_table_u8();\n return ret;\n}\n\nstatic inline wuffs_base__status //\nwuffs_base__pixel_buffer__set_from_slice(wuffs_base__pixel_buffer* b,\n wuffs_base__pixel_config* pixcfg,\n wuffs_base__slice_u8 pixbuf_memory) {\n if (!b) {\n return wuffs_base__error__bad_receiver;\n }\n memset(b, 0, sizeof(*b));\n if (!pixcfg) {\n return wuffs_base__error__bad_argument;\n }\n if (wuffs_base__pixel_format__is_planar(pixcfg->private_impl.pixfmt)) {\n // TODO: support planar pixel formats, concious of pixel subsampling.\n return wuffs_base__error__bad_argument;\n }\n uint32_t bits_per_pixel =\n wuffs_base__pixel_format__bits_per_pixel(pixcfg->private_impl.pixfmt);\n if ((bits_per_pixel == 0) || ((bits_per_pixel % 8) != 0)) {\n return wuffs_base__error__bad_argument;\n }\n uint64_t bytes_per_pixel = bits_per_pixel / 8;\n\n uint8_t* ptr = pixbuf_memory.ptr;\n uint64_t len = pixbu" + diff --git a/lang/builtin/builtin.go b/lang/builtin/builtin.go index 96f7a628..8d088f44 100644 --- a/lang/builtin/builtin.go +++ b/lang/builtin/builtin.go @@ -307,7 +307,7 @@ var Funcs = []string{ "frame_config.io_position() u64", "frame_config.update!(bounds rect_ie_u32, duration u64[..0x7FFFFFFFFFFFFFFF], " + - "index u64, io_position u64, blend u8, disposal u8)", + "index u64, io_position u64, blend u8, disposal u8, background_color u32)", // ---- image_config diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c index 05634ca0..9a3f3a2f 100644 --- a/release/c/wuffs-unsupported-snapshot.c +++ b/release/c/wuffs-unsupported-snapshot.c @@ -2259,6 +2259,7 @@ typedef struct { uint64_t io_position; wuffs_base__animation_blend blend; wuffs_base__animation_disposal disposal; + wuffs_base__color_u32_argb_premul background_color; } private_impl; #ifdef __cplusplus @@ -2267,7 +2268,8 @@ typedef struct { uint64_t index, uint64_t io_position, wuffs_base__animation_blend blend, - wuffs_base__animation_disposal disposal); + wuffs_base__animation_disposal disposal, + wuffs_base__color_u32_argb_premul background_color); inline wuffs_base__rect_ie_u32 bounds() const; inline uint32_t width() const; inline uint32_t height() const; @@ -2276,6 +2278,7 @@ typedef struct { inline uint64_t io_position() const; inline wuffs_base__animation_blend blend() const; inline wuffs_base__animation_disposal disposal() const; + inline wuffs_base__color_u32_argb_premul background_color() const; #endif // __cplusplus } wuffs_base__frame_config; @@ -2293,13 +2296,15 @@ wuffs_base__null_frame_config() { } static inline void // -wuffs_base__frame_config__update(wuffs_base__frame_config* c, - wuffs_base__rect_ie_u32 bounds, - wuffs_base__flicks duration, - uint64_t index, - uint64_t io_position, - wuffs_base__animation_blend blend, - wuffs_base__animation_disposal disposal) { +wuffs_base__frame_config__update( + wuffs_base__frame_config* c, + wuffs_base__rect_ie_u32 bounds, + wuffs_base__flicks duration, + uint64_t index, + uint64_t io_position, + wuffs_base__animation_blend blend, + wuffs_base__animation_disposal disposal, + wuffs_base__color_u32_argb_premul background_color) { if (!c) { return; } @@ -2310,6 +2315,7 @@ wuffs_base__frame_config__update(wuffs_base__frame_config* c, c->private_impl.io_position = io_position; c->private_impl.blend = blend; c->private_impl.disposal = disposal; + c->private_impl.background_color = background_color; } static inline wuffs_base__rect_ie_u32 // @@ -2371,17 +2377,24 @@ wuffs_base__frame_config__disposal(const wuffs_base__frame_config* c) { return c ? c->private_impl.disposal : 0; } +static inline wuffs_base__color_u32_argb_premul // +wuffs_base__frame_config__background_color(const wuffs_base__frame_config* c) { + return c ? c->private_impl.background_color : 0; +} + #ifdef __cplusplus inline void // -wuffs_base__frame_config::update(wuffs_base__rect_ie_u32 bounds, - wuffs_base__flicks duration, - uint64_t index, - uint64_t io_position, - wuffs_base__animation_blend blend, - wuffs_base__animation_disposal disposal) { +wuffs_base__frame_config::update( + wuffs_base__rect_ie_u32 bounds, + wuffs_base__flicks duration, + uint64_t index, + uint64_t io_position, + wuffs_base__animation_blend blend, + wuffs_base__animation_disposal disposal, + wuffs_base__color_u32_argb_premul background_color) { wuffs_base__frame_config__update(this, bounds, duration, index, io_position, - blend, disposal); + blend, disposal, background_color); } inline wuffs_base__rect_ie_u32 // @@ -2424,6 +2437,11 @@ wuffs_base__frame_config::disposal() const { return wuffs_base__frame_config__disposal(this); } +inline wuffs_base__color_u32_argb_premul // +wuffs_base__frame_config::background_color() const { + return wuffs_base__frame_config__background_color(this); +} + #endif // __cplusplus // -------- @@ -9162,6 +9180,7 @@ wuffs_gif__decoder__decode_frame_config(wuffs_gif__decoder* self, wuffs_base__status status = NULL; uint8_t v_blend = 0; + uint32_t v_background_color = 0; uint32_t coro_susp_point = self->private_impl.p_decode_frame_config[0]; if (coro_susp_point) { @@ -9199,8 +9218,11 @@ wuffs_gif__decoder__decode_frame_config(wuffs_gif__decoder* self, goto ok; } v_blend = 0; + v_background_color = 0; if (!self->private_impl.f_gc_has_transparent_index) { v_blend = 2; + v_background_color = + self->private_impl.f_background_color_u32_argb_premul; } if (a_dst != NULL) { wuffs_base__frame_config__update( @@ -9217,7 +9239,7 @@ wuffs_gif__decoder__decode_frame_config(wuffs_gif__decoder* self, ((wuffs_base__flicks)(self->private_impl.f_gc_duration)), self->private_impl.f_num_decoded_frame_configs_value, self->private_impl.f_frame_config_io_position, v_blend, - self->private_impl.f_gc_disposal); + self->private_impl.f_gc_disposal, v_background_color); } wuffs_base__u64__sat_add_indirect( &self->private_impl.f_num_decoded_frame_configs_value, 1); diff --git a/std/gif/decode_gif.wuffs b/std/gif/decode_gif.wuffs index 04200c38..403729be 100644 --- a/std/gif/decode_gif.wuffs +++ b/std/gif/decode_gif.wuffs @@ -396,7 +396,8 @@ pub func decoder.restart_frame!(index base.u64, io_position base.u64) base.statu } pub func decoder.decode_frame_config?(dst nptr base.frame_config, src base.io_reader) { - var blend base.u8 + var blend base.u8 + var background_color base.u32 this.ignore_metadata = true this.dirty_y.reset!() @@ -419,8 +420,10 @@ pub func decoder.decode_frame_config?(dst nptr base.frame_config, src base.io_re } blend = 0 + background_color = 0 if not this.gc_has_transparent_index { blend = 2 // 2 is WUFFS_BASE__ANIMATION_BLEND__OPAQUE. + background_color = this.background_color_u32_argb_premul } if args.dst <> nullptr { @@ -433,7 +436,8 @@ pub func decoder.decode_frame_config?(dst nptr base.frame_config, src base.io_re index:this.num_decoded_frame_configs_value, io_position:this.frame_config_io_position, blend:blend, - disposal:this.gc_disposal) + disposal:this.gc_disposal, + background_color:background_color) } this.num_decoded_frame_configs_value ~sat+= 1