Remove frame_config.palette_changed

This commit is contained in:
Nigel Tao committed 2018-08-26 17:22:29 +10:00
1 parent 75195af7db
commit 132b54378c
5 files changed
+18 -59

No files matched your search

+5 -25
View File
@@ -595,7 +595,6 @@ typedef struct {
uint64_t io_position;
wuffs_base__animation_blend blend;
wuffs_base__animation_disposal disposal;
bool palette_changed;
} private_impl;
#ifdef __cplusplus
@@ -604,8 +603,7 @@ typedef struct {
uint64_t index,
uint64_t io_position,
wuffs_base__animation_blend blend,
wuffs_base__animation_disposal disposal,
bool palette_changed);
wuffs_base__animation_disposal disposal);
inline wuffs_base__rect_ie_u32 bounds();
inline uint32_t width();
inline uint32_t height();
@@ -614,7 +612,6 @@ typedef struct {
inline uint64_t io_position();
inline wuffs_base__animation_blend blend();
inline wuffs_base__animation_disposal disposal();
inline bool palette_changed();
#endif // __cplusplus
} wuffs_base__frame_config;
@@ -626,8 +623,7 @@ wuffs_base__frame_config__update(wuffs_base__frame_config* c,
uint64_t index,
uint64_t io_position,
wuffs_base__animation_blend blend,
wuffs_base__animation_disposal disposal,
bool palette_changed) {
wuffs_base__animation_disposal disposal) {
if (!c) {
return;
}
@@ -638,7 +634,6 @@ 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.palette_changed = palette_changed;
}
static inline wuffs_base__rect_ie_u32 //
@@ -691,14 +686,6 @@ wuffs_base__frame_config__disposal(wuffs_base__frame_config* c) {
return c ? c->private_impl.disposal : 0;
}
// wuffs_base__frame_config__palette_changed returns whether this frame's
// palette differs from the previous frame. It is conservative and may return
// false positives (but never false negatives).
static inline bool //
wuffs_base__frame_config__palette_changed(wuffs_base__frame_config* c) {
return c && c->private_impl.palette_changed;
}
#ifdef __cplusplus
inline void //
@@ -707,11 +694,9 @@ wuffs_base__frame_config::update(wuffs_base__rect_ie_u32 bounds,
uint64_t index,
uint64_t io_position,
wuffs_base__animation_blend blend,
wuffs_base__animation_disposal disposal,
bool palette_changed) {
wuffs_base__frame_config__update(this, bounds, duration, index,
io_position, blend, disposal,
palette_changed);
wuffs_base__animation_disposal disposal) {
wuffs_base__frame_config__update(this, bounds, duration, index, io_position,
blend, disposal);
}
inline wuffs_base__rect_ie_u32 //
@@ -754,11 +739,6 @@ wuffs_base__frame_config::disposal() {
return wuffs_base__frame_config__disposal(this);
}
inline bool //
wuffs_base__frame_config::palette_changed() {
return wuffs_base__frame_config__palette_changed(this);
}
#endif // __cplusplus
// --------
+6 -6
View File
@@ -146,12 +146,12 @@ 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 bool palette_changed;\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 bool palette_changed);\n inline wuffs_base__rect_ie_u32 bounds();\n inline uint32_t width();\n inline uint32_t height();\n inline wuffs_base__flicks duration();\n inline uint64_t index();\n inline uint64_t io_position();\n inline wuffs_base__animation_blend blend();\n i" +
"nline wuffs_base__animation_disposal disposal();\n inline bool palette_changed();\n#endif // __cplusplus\n\n} wuffs_base__frame_config;\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 bool palette_changed) {\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.blend = blend;\n c->private_impl.disposal = disposal;\n c->private_impl.palette_changed = palette_changed;\n}\n\nstatic inline wuffs_base__rect_ie_u32 //\nwuffs_base__frame_confi" +
"g__bounds(wuffs_base__frame_config* c) {\n return c ? c->private_impl.bounds : ((wuffs_base__rect_ie_u32){});\n}\n\nstatic inline uint32_t //\nwuffs_base__frame_config__width(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(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(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(wuffs_base__frame_config* c) {\n return c ? c->private_impl.i" +
"ndex : 0;\n}\n\n// wuffs_base__frame_config__io_position returns the I/O stream position after\n// the frame config but before the frame's pixel data.\nstatic inline uint64_t //\nwuffs_base__frame_config__io_position(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(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 displaying it.\nstatic inline wuffs_base__animation_disposal //\nwuffs_base__frame_config__disposal(wuffs_base__frame_config* c) {\n return c ? c->private_impl.disposal : 0;\n}\n\n// wuffs_base__frame_config__palette_changed returns whether this frame's\n// palette differs from the previous frame. It is conservative and may retur" +
"n\n// false positives (but never false negatives).\nstatic inline bool //\nwuffs_base__frame_config__palette_changed(wuffs_base__frame_config* c) {\n return c && c->private_impl.palette_changed;\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 bool palette_changed) {\n wuffs_base__frame_config__update(this, bounds, duration, index,\n io_position, blend, disposal,\n palette_changed);\n}\n\ninline wuffs_base__rect_ie_u32 //\nwuffs_base__frame_config::bounds() {\n return wuffs_base__frame_config__bounds(this);\n}\n\ninline uint32_t //\nwuffs_base__frame_config::width" +
"() {\n return wuffs_base__frame_config__width(this);\n}\n\ninline uint32_t //\nwuffs_base__frame_config::height() {\n return wuffs_base__frame_config__height(this);\n}\n\ninline wuffs_base__flicks //\nwuffs_base__frame_config::duration() {\n return wuffs_base__frame_config__duration(this);\n}\n\ninline uint64_t //\nwuffs_base__frame_config::index() {\n return wuffs_base__frame_config__index(this);\n}\n\ninline uint64_t //\nwuffs_base__frame_config::io_position() {\n return wuffs_base__frame_config__io_position(this);\n}\n\ninline wuffs_base__animation_blend //\nwuffs_base__frame_config::blend() {\n return wuffs_base__frame_config__blend(this);\n}\n\ninline wuffs_base__animation_disposal //\nwuffs_base__frame_config::disposal() {\n return wuffs_base__frame_config__disposal(this);\n}\n\ninline bool //\nwuffs_base__frame_config::palette_changed() {\n return wuffs_base__frame_config__palette_changed(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 } 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();\n inline uint32_t width();\n inline uint32_t height();\n inline wuffs_base__flicks duration();\n inline uint64_t index();\n inline uint64_t io_position();\n inline wuffs_base__animation_blend blend();\n inline wuffs_base__animation_disposal disposal();\n#endif // __cpluspl" +
"us\n\n} wuffs_base__frame_config;\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.index = 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(wuffs_base__frame_config* c) {\n return c ? c->private_impl.bounds : ((wuffs_base__rect_ie_u32){});\n}\n\nstatic inline uint32_t //\nwuffs_base__frame_config__width(wuffs_base__frame_config* c) {\n retur" +
"n c ? wuffs_base__rect_ie_u32__width(&c->private_impl.bounds) : 0;\n}\n\nstatic inline uint32_t //\nwuffs_base__frame_config__height(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(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(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 after\n// the frame config but before the frame's pixel data.\nstatic inline uint64_t //\nwuffs_base__frame_config__io_positio" +
"n(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(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 displaying it.\nstatic inline wuffs_base__animation_disposal //\nwuffs_base__frame_config__disposal(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() {\n return wuffs_base__frame_config__bounds(this);\n}\n\ninline uint32_t //\nwuffs_base__frame_config::width() {\n return wuffs_base__frame_config__width(this);\n}\n\ninline uint32_t //\nwuffs_base__frame_config::height() {\n return wuffs_base__frame_config__height(this);\n}\n\ninline wuffs_base__flicks //\nwuffs_base__frame_config::duration() {\n return wuffs_base__frame_config__duration(this);\n}\n\ninline uint64_t //\nwuffs_base__frame_config::index() {\n return wuffs_base__frame_config__index(this);\n}\n\ninline uint64_t //\nwuffs_base__frame_config::io_position() {\n return wuffs_base__frame_config__io_position(this);\n}\n\ninline wuffs_base__animation_blend //\nwuffs_base__frame_config::blend() {\n return wuffs_base__frame_config__blend(this);\n}\n\ninline wuffs_base__anim" +
"ation_disposal //\nwuffs_base__frame_config::disposal() {\n return wuffs_base__frame_config__disposal(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 uint8_t palette[1024];\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 void set_palette(wuffs_base__slice_u8 palette);\n inline wuffs_base__table_u8 plane(uint32_t p);\n inline wuffs_base__slice_u8 palette();\n#endif // __cplusplus\n\n} wuffs_base__pixel_buffer;\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 *b = ((wuffs_base__pixel_buffer){});\n if (!pixcfg) {\n return wuffs_base__error__bad_argument;\n }\n // TODO: don't assume 1 byte per pixel. Don't assume packed.\n uint64_t wh = ((uint64_t)pixcfg->private_impl.width) *\n ((uint64_t)pixcfg->private_impl.height);\n if (wh > pixbuf_memory.len) {\n return wuffs_base__error__bad_argument_length_too_short;\n }\n b->pixcfg = *pixcfg;\n wuffs_base__table_u8* tab = &b->private_impl.planes[0];\n tab->ptr = pixbuf_memory.ptr;\n tab->width = pixcfg->private_impl.width;\n tab->height = pixcfg->private_impl.height;\n tab->stride = pixcfg->private_impl.width;\n return NULL;\n}\n\n// The palette argument is ignored unless its length is exactly 1024.\nstatic inline void //\nwuffs_base__pixel_buffer__set_palette(wuffs_base__pixel_buffer* b,\n wuffs_base__slice_u8 palette) {\n if (b && palette.ptr && (palette.len == 1024)) {\n memmove(b->private_impl.palette, palette.ptr, 1024);\n }\n}\n\nstatic inlin" +
+1 -1
View File
@@ -230,7 +230,7 @@ var Funcs = []string{
// Duration's upper bound is the maximum possible i64 value.
"frame_config.update!(bounds rect_ie_u32, duration u64[..0x7FFFFFFFFFFFFFFF], " +
"index u64, io_position u64, blend u8, disposal u8, palette_changed bool)",
"index u64, io_position u64, blend u8, disposal u8)",
// ---- image_config
+5 -25
View File
@@ -1694,7 +1694,6 @@ typedef struct {
uint64_t io_position;
wuffs_base__animation_blend blend;
wuffs_base__animation_disposal disposal;
bool palette_changed;
} private_impl;
#ifdef __cplusplus
@@ -1703,8 +1702,7 @@ typedef struct {
uint64_t index,
uint64_t io_position,
wuffs_base__animation_blend blend,
wuffs_base__animation_disposal disposal,
bool palette_changed);
wuffs_base__animation_disposal disposal);
inline wuffs_base__rect_ie_u32 bounds();
inline uint32_t width();
inline uint32_t height();
@@ -1713,7 +1711,6 @@ typedef struct {
inline uint64_t io_position();
inline wuffs_base__animation_blend blend();
inline wuffs_base__animation_disposal disposal();
inline bool palette_changed();
#endif // __cplusplus
} wuffs_base__frame_config;
@@ -1725,8 +1722,7 @@ wuffs_base__frame_config__update(wuffs_base__frame_config* c,
uint64_t index,
uint64_t io_position,
wuffs_base__animation_blend blend,
wuffs_base__animation_disposal disposal,
bool palette_changed) {
wuffs_base__animation_disposal disposal) {
if (!c) {
return;
}
@@ -1737,7 +1733,6 @@ 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.palette_changed = palette_changed;
}
static inline wuffs_base__rect_ie_u32 //
@@ -1790,14 +1785,6 @@ wuffs_base__frame_config__disposal(wuffs_base__frame_config* c) {
return c ? c->private_impl.disposal : 0;
}
// wuffs_base__frame_config__palette_changed returns whether this frame's
// palette differs from the previous frame. It is conservative and may return
// false positives (but never false negatives).
static inline bool //
wuffs_base__frame_config__palette_changed(wuffs_base__frame_config* c) {
return c && c->private_impl.palette_changed;
}
#ifdef __cplusplus
inline void //
@@ -1806,10 +1793,9 @@ wuffs_base__frame_config::update(wuffs_base__rect_ie_u32 bounds,
uint64_t index,
uint64_t io_position,
wuffs_base__animation_blend blend,
wuffs_base__animation_disposal disposal,
bool palette_changed) {
wuffs_base__animation_disposal disposal) {
wuffs_base__frame_config__update(this, bounds, duration, index, io_position,
blend, disposal, palette_changed);
blend, disposal);
}
inline wuffs_base__rect_ie_u32 //
@@ -1852,11 +1838,6 @@ wuffs_base__frame_config::disposal() {
return wuffs_base__frame_config__disposal(this);
}
inline bool //
wuffs_base__frame_config::palette_changed() {
return wuffs_base__frame_config__palette_changed(this);
}
#endif // __cplusplus
// --------
@@ -6584,8 +6565,7 @@ wuffs_gif__decoder__decode_frame_config(wuffs_gif__decoder* self,
a_src.private_impl.buf->pos,
iop_a_src - a_src.private_impl.buf->ptr)
: 0),
v_blend, self->private_impl.f_gc_disposal,
(self->private_impl.f_which_palette != 2));
v_blend, self->private_impl.f_gc_disposal);
}
wuffs_base__u64__sat_add_indirect(
&self->private_impl.f_num_decoded_frame_configs_value, 1);
+1 -2
View File
@@ -216,8 +216,7 @@ pub func decoder.decode_frame_config!??(dst nptr base.frame_config, src base.io_
index:this.num_decoded_frame_configs_value,
io_position:args.src.position(),
blend:blend,
disposal:this.gc_disposal,
palette_changed:this.which_palette != 2)
disposal:this.gc_disposal)
}
this.num_decoded_frame_configs_value ~sat+= 1