From 71528b33dd25be2f6abe80a45f05c2230df83aae Mon Sep 17 00:00:00 2001 From: Nigel Tao Date: Wed, 3 Jun 2020 11:34:57 +1000 Subject: [PATCH] Rename frame_config.update to frame_config.set --- internal/cgen/base/image-public.h | 26 ++++++++++---------- internal/cgen/builtin.go | 13 ++++++---- internal/cgen/data.go | 16 ++++++------ lang/builtin/builtin.go | 2 +- release/c/wuffs-unsupported-snapshot.c | 34 +++++++++++++------------- std/bmp/decode_bmp.wuffs | 2 +- std/gif/decode_config.wuffs | 2 +- std/gif/decode_gif.wuffs | 2 +- std/wbmp/decode_wbmp.wuffs | 2 +- 9 files changed, 51 insertions(+), 48 deletions(-) diff --git a/internal/cgen/base/image-public.h b/internal/cgen/base/image-public.h index 74ff4336..3f97e61a 100644 --- a/internal/cgen/base/image-public.h +++ b/internal/cgen/base/image-public.h @@ -791,14 +791,14 @@ typedef struct { } private_impl; #ifdef __cplusplus - inline void update(wuffs_base__rect_ie_u32 bounds, - wuffs_base__flicks duration, - uint64_t index, - uint64_t io_position, - wuffs_base__animation_disposal disposal, - bool opaque_within_bounds, - bool overwrite_instead_of_blend, - wuffs_base__color_u32_argb_premul background_color); + inline void set(wuffs_base__rect_ie_u32 bounds, + wuffs_base__flicks duration, + uint64_t index, + uint64_t io_position, + wuffs_base__animation_disposal disposal, + bool opaque_within_bounds, + bool overwrite_instead_of_blend, + 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; @@ -827,7 +827,7 @@ wuffs_base__null_frame_config() { } static inline void // -wuffs_base__frame_config__update( +wuffs_base__frame_config__set( wuffs_base__frame_config* c, wuffs_base__rect_ie_u32 bounds, wuffs_base__flicks duration, @@ -942,7 +942,7 @@ wuffs_base__frame_config__background_color(const wuffs_base__frame_config* c) { #ifdef __cplusplus inline void // -wuffs_base__frame_config::update( +wuffs_base__frame_config::set( wuffs_base__rect_ie_u32 bounds, wuffs_base__flicks duration, uint64_t index, @@ -951,9 +951,9 @@ wuffs_base__frame_config::update( bool opaque_within_bounds, bool overwrite_instead_of_blend, wuffs_base__color_u32_argb_premul background_color) { - wuffs_base__frame_config__update( - this, bounds, duration, index, io_position, disposal, - opaque_within_bounds, overwrite_instead_of_blend, background_color); + wuffs_base__frame_config__set(this, bounds, duration, index, io_position, + disposal, opaque_within_bounds, + overwrite_instead_of_blend, background_color); } inline wuffs_base__rect_ie_u32 // diff --git a/internal/cgen/builtin.go b/internal/cgen/builtin.go index 5a2e1a08..8846a34e 100644 --- a/internal/cgen/builtin.go +++ b/internal/cgen/builtin.go @@ -45,11 +45,14 @@ func (g *gen) writeBuiltinCall(b *buffer, n *a.Expr, depth uint32) error { u64ToFlicksIndex := -1 // TODO: don't hard-code these, or a_dst. - switch meth := method.Ident(); { - case (meth == t.IDSet) && (recvTyp.Inner().QID() == t.QID{t.IDBase, t.IDImageConfig}): + if method.Ident() != t.IDSet { + return errNoSuchBuiltin + } + switch recvTyp.Inner().QID() { + case t.QID{t.IDBase, t.IDImageConfig}: b.writes("wuffs_base__image_config__set(a_dst") - case (meth == t.IDUpdate) && (recvTyp.Inner().QID() == t.QID{t.IDBase, t.IDFrameConfig}): - b.writes("wuffs_base__frame_config__update(a_dst") + case t.QID{t.IDBase, t.IDFrameConfig}: + b.writes("wuffs_base__frame_config__set(a_dst") u64ToFlicksIndex = 1 default: return errNoSuchBuiltin @@ -59,7 +62,7 @@ func (g *gen) writeBuiltinCall(b *buffer, n *a.Expr, depth uint32) error { b.writeb(',') if i == u64ToFlicksIndex { if o.AsArg().Name().Str(g.tm) != "duration" { - return errors.New("cgen: internal error: inconsistent frame_config.update argument") + return errors.New("cgen: internal error: inconsistent frame_config.set argument") } b.writes("((wuffs_base__flicks)(") } diff --git a/internal/cgen/data.go b/internal/cgen/data.go index d921b797..b841f1c1 100644 --- a/internal/cgen/data.go +++ b/internal/cgen/data.go @@ -301,14 +301,14 @@ 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_disposal disposal;\n bool opaque_within_bounds;\n bool overwrite_instead_of_blend;\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_disposal disposal,\n bool opaque_within_bounds,\n bool overwrite_instead_of_blend,\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() con" + - "st;\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_disposal disposal() const;\n inline bool opaque_within_bounds() const;\n inline bool overwrite_instead_of_blend() 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.disposal = 0;\n ret.private_impl.opaque_within_bounds = false;\n ret.private_impl.overwrite_instead_of_blend = false;\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_p" + - "osition,\n wuffs_base__animation_disposal disposal,\n bool opaque_within_bounds,\n bool overwrite_instead_of_blend,\n wuffs_base__color_u32_argb_premul background_color) {\n if (!c) {\n return;\n }\n\n c->private_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.disposal = disposal;\n c->private_impl.opaque_within_bounds = opaque_within_bounds;\n c->private_impl.overwrite_instead_of_blend = overwrite_instead_of_blend;\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 display 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__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\n// wuffs_base__frame_config__opaque_within_bounds returns whether all pixels\n// within the frame's bounds are fully opaque. It makes no claim about pixels\n// outside the frame bounds but still inside the overall image. The two\n// bounding rectangles can differ for animated images.\n//\n// Its semantics are conservative. It is valid for a fully opaque frame to have\n// this value be false: a false negative.\n//\n// If true, drawing the frame with WUFFS_BASE__PIXEL_BLEND__SRC and\n// WUFFS_BASE__PIXEL_BLEND__SRC_OVER should be equivalent, in terms of\n// resultant pixels, but the former may be faster.\nstatic inline bool //\nwuffs_base__frame_config__opaque_within_bounds(\n const wuffs_" + - "base__frame_config* c) {\n return c && c->private_impl.opaque_within_bounds;\n}\n\n// wuffs_base__frame_config__overwrite_instead_of_blend returns, for an\n// animated image, whether to ignore the previous image state (within the frame\n// bounds) when drawing this incremental frame. Equivalently, whether to use\n// WUFFS_BASE__PIXEL_BLEND__SRC instead of WUFFS_BASE__PIXEL_BLEND__SRC_OVER.\n//\n// The WebP spec (https://developers.google.com/speed/webp/docs/riff_container)\n// calls this the \"Blending method\" bit. WebP's \"Do not blend\" corresponds to\n// Wuffs' \"overwrite_instead_of_blend\".\nstatic inline bool //\nwuffs_base__frame_config__overwrite_instead_of_blend(\n const wuffs_base__frame_config* c) {\n return c && c->private_impl.overwrite_instead_of_blend;\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_disposal disposal,\n bool opaque_within_bounds,\n bool overwrite_instead_of_blend,\n wuffs_base__color_u32_argb_premul background_color) {\n wuffs_base__frame_config__update(\n this, bounds, duration, index, io_position, disposal,\n opaque_within_bounds, overwrite_instead_of_blend, background_color);\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() 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_b" + - "ase__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_disposal //\nwuffs_base__frame_config::disposal() const {\n return wuffs_base__frame_config__disposal(this);\n}\n\ninline bool //\nwuffs_base__frame_config::opaque_within_bounds() const {\n return wuffs_base__frame_config__opaque_within_bounds(this);\n}\n\ninline bool //\nwuffs_base__frame_config::overwrite_instead_of_blend() const {\n return wuffs_base__frame_config__overwrite_instead_of_blend(this);\n}\n\ninline wuffs_base__color_u32_argb_premul //\nwuffs_base__frame_config::background_color() const {\n return wuffs_base__frame_config__background_color(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_disposal disposal;\n bool opaque_within_bounds;\n bool overwrite_instead_of_blend;\n wuffs_base__color_u32_argb_premul background_color;\n } private_impl;\n\n#ifdef __cplusplus\n inline void set(wuffs_base__rect_ie_u32 bounds,\n wuffs_base__flicks duration,\n uint64_t index,\n uint64_t io_position,\n wuffs_base__animation_disposal disposal,\n bool opaque_within_bounds,\n bool overwrite_instead_of_blend,\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_disposal disposal() const;\n inline bool opaque_within_bounds() const;\n inline bool overwrite_instead_of_blend() 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.disposal = 0;\n ret.private_impl.opaque_within_bounds = false;\n ret.private_impl.overwrite_instead_of_blend = false;\n return ret;\n}\n\nstatic inline void //\nwuffs_base__frame_config__set(\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__an" + + "imation_disposal disposal,\n bool opaque_within_bounds,\n bool overwrite_instead_of_blend,\n wuffs_base__color_u32_argb_premul background_color) {\n if (!c) {\n return;\n }\n\n c->private_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.disposal = disposal;\n c->private_impl.opaque_within_bounds = opaque_within_bounds;\n c->private_impl.overwrite_instead_of_blend = overwrite_instead_of_blend;\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 display 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__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\n// wuffs_base__frame_config__opaque_within_bounds returns whether all pixels\n// within the frame's bounds are fully opaque. It makes no claim about pixels\n// outside the frame bounds but still inside the overall image. The two\n// bounding rectangles can differ for animated images.\n//\n// Its semantics are conservative. It is valid for a fully opaque frame to have\n// this value be false: a false negative.\n//\n// If true, drawing the frame with WUFFS_BASE__PIXEL_BLEND__SRC and\n// WUFFS_BASE__PIXEL_BLEND__SRC_OVER should be equivalent, in terms of\n// resultant pixels, but the former may be faster.\nstatic inline bool //\nwuffs_base__frame_config__opaque_within_bounds(\n const wuffs_base__frame_config* c) {\n " + + "return c && c->private_impl.opaque_within_bounds;\n}\n\n// wuffs_base__frame_config__overwrite_instead_of_blend returns, for an\n// animated image, whether to ignore the previous image state (within the frame\n// bounds) when drawing this incremental frame. Equivalently, whether to use\n// WUFFS_BASE__PIXEL_BLEND__SRC instead of WUFFS_BASE__PIXEL_BLEND__SRC_OVER.\n//\n// The WebP spec (https://developers.google.com/speed/webp/docs/riff_container)\n// calls this the \"Blending method\" bit. WebP's \"Do not blend\" corresponds to\n// Wuffs' \"overwrite_instead_of_blend\".\nstatic inline bool //\nwuffs_base__frame_config__overwrite_instead_of_blend(\n const wuffs_base__frame_config* c) {\n return c && c->private_impl.overwrite_instead_of_blend;\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::set(\n wuffs_base__rect_ie_u32 bou" + + "nds,\n wuffs_base__flicks duration,\n uint64_t index,\n uint64_t io_position,\n wuffs_base__animation_disposal disposal,\n bool opaque_within_bounds,\n bool overwrite_instead_of_blend,\n wuffs_base__color_u32_argb_premul background_color) {\n wuffs_base__frame_config__set(this, bounds, duration, index, io_position,\n disposal, opaque_within_bounds,\n overwrite_instead_of_blend, background_color);\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() 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_disposal //\nwuffs_base__frame_config::disposal() const {\n return wuffs_base__frame_config__disposal(this);\n}\n\ninline bool //\nwuffs_base__frame_config::opaque_within_bounds() const {\n return wuffs_base__frame_config__opaque_within_bounds(this);\n}\n\ninline bool //\nwuffs_base__frame_config::overwrite_instead_of_blend() const {\n return wuffs_base__frame_config__overwrite_instead_of_blend(this);\n}\n\ninline wuffs_base__color_u32_argb_premul //\nwuffs_base__frame_config::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(\n const wuffs_base__pixel_config* pixcfg,\n wuffs_base__slice_u8 pixbuf_memory);\n inline wuffs_base__status set_from_table(\n const wuffs_base__pixel_config* pixcfg,\n wuffs_base__table_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 inline wuffs_base__color_u32_argb_premul color_u32_at(uint32_t x,\n uint32_t y) const;\n inline wuffs_base__status set_color_u32_at(\n uint32_t x,\n uint32_t y,\n wuffs_base__color_u32_argb_premul co" + "lor);\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__empty_table_u8();\n ret.private_impl.planes[1] = wuffs_base__empty_table_u8();\n ret.private_impl.planes[2] = wuffs_base__empty_table_u8();\n ret.private_impl.planes[3] = wuffs_base__empty_table_u8();\n return ret;\n}\n\nstatic inline wuffs_base__status //\nwuffs_base__pixel_buffer__set_from_slice(wuffs_base__pixel_buffer* pb,\n const wuffs_base__pixel_config* pixcfg,\n wuffs_base__slice_u8 pixbuf_memory) {\n if (!pb) {\n return wuffs_base__make_status(wuffs_base__error__bad_receiver);\n }\n memset(pb, 0, sizeof(*pb));\n if (!pixcfg) {\n return wuffs_base__make_status(wuffs_base__error__bad_argument);\n }\n if (wuffs_base__pixel_format__is_planar(&pixcfg->private_impl.pixfmt)) " + diff --git a/lang/builtin/builtin.go b/lang/builtin/builtin.go index f065f523..340c3e61 100644 --- a/lang/builtin/builtin.go +++ b/lang/builtin/builtin.go @@ -359,7 +359,7 @@ var Funcs = []string{ "frame_config.index() u64", "frame_config.io_position() u64", - "frame_config.update!(bounds: rect_ie_u32, duration: u64[..= 0x7FFF_FFFF_FFFF_FFFF]," + + "frame_config.set!(bounds: rect_ie_u32, duration: u64[..= 0x7FFF_FFFF_FFFF_FFFF]," + "index: u64, io_position: u64, disposal: u8, opaque_within_bounds: bool," + "overwrite_instead_of_blend: bool, background_color: u32)", diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c index 283c0ab9..d6e5e622 100644 --- a/release/c/wuffs-unsupported-snapshot.c +++ b/release/c/wuffs-unsupported-snapshot.c @@ -3284,14 +3284,14 @@ typedef struct { } private_impl; #ifdef __cplusplus - inline void update(wuffs_base__rect_ie_u32 bounds, - wuffs_base__flicks duration, - uint64_t index, - uint64_t io_position, - wuffs_base__animation_disposal disposal, - bool opaque_within_bounds, - bool overwrite_instead_of_blend, - wuffs_base__color_u32_argb_premul background_color); + inline void set(wuffs_base__rect_ie_u32 bounds, + wuffs_base__flicks duration, + uint64_t index, + uint64_t io_position, + wuffs_base__animation_disposal disposal, + bool opaque_within_bounds, + bool overwrite_instead_of_blend, + 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; @@ -3320,7 +3320,7 @@ wuffs_base__null_frame_config() { } static inline void // -wuffs_base__frame_config__update( +wuffs_base__frame_config__set( wuffs_base__frame_config* c, wuffs_base__rect_ie_u32 bounds, wuffs_base__flicks duration, @@ -3435,7 +3435,7 @@ wuffs_base__frame_config__background_color(const wuffs_base__frame_config* c) { #ifdef __cplusplus inline void // -wuffs_base__frame_config::update( +wuffs_base__frame_config::set( wuffs_base__rect_ie_u32 bounds, wuffs_base__flicks duration, uint64_t index, @@ -3444,9 +3444,9 @@ wuffs_base__frame_config::update( bool opaque_within_bounds, bool overwrite_instead_of_blend, wuffs_base__color_u32_argb_premul background_color) { - wuffs_base__frame_config__update( - this, bounds, duration, index, io_position, disposal, - opaque_within_bounds, overwrite_instead_of_blend, background_color); + wuffs_base__frame_config__set(this, bounds, duration, index, io_position, + disposal, opaque_within_bounds, + overwrite_instead_of_blend, background_color); } inline wuffs_base__rect_ie_u32 // @@ -12888,7 +12888,7 @@ wuffs_bmp__decoder__decode_frame_config(wuffs_bmp__decoder* self, goto ok; } if (a_dst != NULL) { - wuffs_base__frame_config__update( + wuffs_base__frame_config__set( a_dst, wuffs_base__utility__make_rect_ie_u32( 0, 0, self->private_impl.f_width, self->private_impl.f_height), @@ -17932,7 +17932,7 @@ wuffs_gif__config_decoder__decode_frame_config(wuffs_gif__config_decoder* self, } } if (a_dst != NULL) { - wuffs_base__frame_config__update( + wuffs_base__frame_config__set( a_dst, wuffs_base__utility__make_rect_ie_u32( wuffs_base__u32__min(self->private_impl.f_frame_rect_x0, @@ -19761,7 +19761,7 @@ wuffs_gif__decoder__decode_frame_config(wuffs_gif__decoder* self, } } if (a_dst != NULL) { - wuffs_base__frame_config__update( + wuffs_base__frame_config__set( a_dst, wuffs_base__utility__make_rect_ie_u32( wuffs_base__u32__min(self->private_impl.f_frame_rect_x0, @@ -24915,7 +24915,7 @@ wuffs_wbmp__decoder__decode_frame_config(wuffs_wbmp__decoder* self, goto ok; } if (a_dst != NULL) { - wuffs_base__frame_config__update( + wuffs_base__frame_config__set( a_dst, wuffs_base__utility__make_rect_ie_u32( 0, 0, self->private_impl.f_width, self->private_impl.f_height), diff --git a/std/bmp/decode_bmp.wuffs b/std/bmp/decode_bmp.wuffs index 394b2d73..f2377440 100644 --- a/std/bmp/decode_bmp.wuffs +++ b/std/bmp/decode_bmp.wuffs @@ -214,7 +214,7 @@ pub func decoder.decode_frame_config?(dst: nptr base.frame_config, src: base.io_ } if args.dst <> nullptr { - args.dst.update!(bounds: this.util.make_rect_ie_u32( + args.dst.set!(bounds: this.util.make_rect_ie_u32( min_incl_x: 0, min_incl_y: 0, max_excl_x: this.width, diff --git a/std/gif/decode_config.wuffs b/std/gif/decode_config.wuffs index aac04d8b..8e773dd8 100644 --- a/std/gif/decode_config.wuffs +++ b/std/gif/decode_config.wuffs @@ -339,7 +339,7 @@ pub func config_decoder.decode_frame_config?(dst: nptr base.frame_config, src: b if args.dst <> nullptr { // The "foo.min(a:this.width_or_height)" calls clip the nominal // frame_rect to the image_rect. - args.dst.update!(bounds: this.util.make_rect_ie_u32( + args.dst.set!(bounds: this.util.make_rect_ie_u32( min_incl_x: this.frame_rect_x0.min(a: this.width), min_incl_y: this.frame_rect_y0.min(a: this.height), max_excl_x: this.frame_rect_x1.min(a: this.width), diff --git a/std/gif/decode_gif.wuffs b/std/gif/decode_gif.wuffs index 53cb8c92..600d6a93 100644 --- a/std/gif/decode_gif.wuffs +++ b/std/gif/decode_gif.wuffs @@ -398,7 +398,7 @@ pub func decoder.decode_frame_config?(dst: nptr base.frame_config, src: base.io_ if args.dst <> nullptr { // The "foo.min(a:this.width_or_height)" calls clip the nominal // frame_rect to the image_rect. - args.dst.update!(bounds: this.util.make_rect_ie_u32( + args.dst.set!(bounds: this.util.make_rect_ie_u32( min_incl_x: this.frame_rect_x0.min(a: this.width), min_incl_y: this.frame_rect_y0.min(a: this.height), max_excl_x: this.frame_rect_x1.min(a: this.width), diff --git a/std/wbmp/decode_wbmp.wuffs b/std/wbmp/decode_wbmp.wuffs index 21b1b16a..c27e52c6 100644 --- a/std/wbmp/decode_wbmp.wuffs +++ b/std/wbmp/decode_wbmp.wuffs @@ -111,7 +111,7 @@ pub func decoder.decode_frame_config?(dst: nptr base.frame_config, src: base.io_ } if args.dst <> nullptr { - args.dst.update!(bounds: this.util.make_rect_ie_u32( + args.dst.set!(bounds: this.util.make_rect_ie_u32( min_incl_x: 0, min_incl_y: 0, max_excl_x: this.width,