mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-26 01:01:35 +01:00
Have some base types' methods accept const this
This commit is contained in:
1 parent
abd58b4414
commit
3ff7c707af
6 files changed
+446
-433
No files matched your search
@@ -336,13 +336,13 @@ typedef struct {
|
||||
uint32_t width,
|
||||
uint32_t height);
|
||||
inline void invalidate();
|
||||
inline bool is_valid();
|
||||
inline wuffs_base__pixel_format pixel_format();
|
||||
inline wuffs_base__pixel_subsampling pixel_subsampling();
|
||||
inline wuffs_base__rect_ie_u32 bounds();
|
||||
inline uint32_t width();
|
||||
inline uint32_t height();
|
||||
inline uint64_t pixbuf_len();
|
||||
inline bool is_valid() const;
|
||||
inline wuffs_base__pixel_format pixel_format() const;
|
||||
inline wuffs_base__pixel_subsampling pixel_subsampling() const;
|
||||
inline wuffs_base__rect_ie_u32 bounds() const;
|
||||
inline uint32_t width() const;
|
||||
inline uint32_t height() const;
|
||||
inline uint64_t pixbuf_len() const;
|
||||
#endif // __cplusplus
|
||||
|
||||
} wuffs_base__pixel_config;
|
||||
@@ -396,22 +396,22 @@ wuffs_base__pixel_config__invalidate(wuffs_base__pixel_config* c) {
|
||||
}
|
||||
|
||||
static inline bool //
|
||||
wuffs_base__pixel_config__is_valid(wuffs_base__pixel_config* c) {
|
||||
wuffs_base__pixel_config__is_valid(const wuffs_base__pixel_config* c) {
|
||||
return c && c->private_impl.pixfmt;
|
||||
}
|
||||
|
||||
static inline wuffs_base__pixel_format //
|
||||
wuffs_base__pixel_config__pixel_format(wuffs_base__pixel_config* c) {
|
||||
wuffs_base__pixel_config__pixel_format(const wuffs_base__pixel_config* c) {
|
||||
return c ? c->private_impl.pixfmt : 0;
|
||||
}
|
||||
|
||||
static inline wuffs_base__pixel_subsampling //
|
||||
wuffs_base__pixel_config__pixel_subsampling(wuffs_base__pixel_config* c) {
|
||||
wuffs_base__pixel_config__pixel_subsampling(const wuffs_base__pixel_config* c) {
|
||||
return c ? c->private_impl.pixsub : 0;
|
||||
}
|
||||
|
||||
static inline wuffs_base__rect_ie_u32 //
|
||||
wuffs_base__pixel_config__bounds(wuffs_base__pixel_config* c) {
|
||||
wuffs_base__pixel_config__bounds(const wuffs_base__pixel_config* c) {
|
||||
if (c) {
|
||||
wuffs_base__rect_ie_u32 ret;
|
||||
ret.min_incl_x = 0;
|
||||
@@ -430,12 +430,12 @@ wuffs_base__pixel_config__bounds(wuffs_base__pixel_config* c) {
|
||||
}
|
||||
|
||||
static inline uint32_t //
|
||||
wuffs_base__pixel_config__width(wuffs_base__pixel_config* c) {
|
||||
wuffs_base__pixel_config__width(const wuffs_base__pixel_config* c) {
|
||||
return c ? c->private_impl.width : 0;
|
||||
}
|
||||
|
||||
static inline uint32_t //
|
||||
wuffs_base__pixel_config__height(wuffs_base__pixel_config* c) {
|
||||
wuffs_base__pixel_config__height(const wuffs_base__pixel_config* c) {
|
||||
return c ? c->private_impl.height : 0;
|
||||
}
|
||||
|
||||
@@ -443,7 +443,7 @@ wuffs_base__pixel_config__height(wuffs_base__pixel_config* c) {
|
||||
// decoding into a color model different from the format's intrinsic one? For
|
||||
// example, decoding a JPEG image straight to RGBA instead of to YCbCr?
|
||||
static inline uint64_t //
|
||||
wuffs_base__pixel_config__pixbuf_len(wuffs_base__pixel_config* c) {
|
||||
wuffs_base__pixel_config__pixbuf_len(const wuffs_base__pixel_config* c) {
|
||||
if (!c) {
|
||||
return 0;
|
||||
}
|
||||
@@ -492,37 +492,37 @@ wuffs_base__pixel_config::invalidate() {
|
||||
}
|
||||
|
||||
inline bool //
|
||||
wuffs_base__pixel_config::is_valid() {
|
||||
wuffs_base__pixel_config::is_valid() const {
|
||||
return wuffs_base__pixel_config__is_valid(this);
|
||||
}
|
||||
|
||||
inline wuffs_base__pixel_format //
|
||||
wuffs_base__pixel_config::pixel_format() {
|
||||
wuffs_base__pixel_config::pixel_format() const {
|
||||
return wuffs_base__pixel_config__pixel_format(this);
|
||||
}
|
||||
|
||||
inline wuffs_base__pixel_subsampling //
|
||||
wuffs_base__pixel_config::pixel_subsampling() {
|
||||
wuffs_base__pixel_config::pixel_subsampling() const {
|
||||
return wuffs_base__pixel_config__pixel_subsampling(this);
|
||||
}
|
||||
|
||||
inline wuffs_base__rect_ie_u32 //
|
||||
wuffs_base__pixel_config::bounds() {
|
||||
wuffs_base__pixel_config::bounds() const {
|
||||
return wuffs_base__pixel_config__bounds(this);
|
||||
}
|
||||
|
||||
inline uint32_t //
|
||||
wuffs_base__pixel_config::width() {
|
||||
wuffs_base__pixel_config::width() const {
|
||||
return wuffs_base__pixel_config__width(this);
|
||||
}
|
||||
|
||||
inline uint32_t //
|
||||
wuffs_base__pixel_config::height() {
|
||||
wuffs_base__pixel_config::height() const {
|
||||
return wuffs_base__pixel_config__height(this);
|
||||
}
|
||||
|
||||
inline uint64_t //
|
||||
wuffs_base__pixel_config::pixbuf_len() {
|
||||
wuffs_base__pixel_config::pixbuf_len() const {
|
||||
return wuffs_base__pixel_config__pixbuf_len(this);
|
||||
}
|
||||
|
||||
@@ -548,9 +548,9 @@ typedef struct {
|
||||
uint64_t first_frame_io_position,
|
||||
bool first_frame_is_opaque);
|
||||
inline void invalidate();
|
||||
inline bool is_valid();
|
||||
inline uint64_t first_frame_io_position();
|
||||
inline bool first_frame_is_opaque();
|
||||
inline bool is_valid() const;
|
||||
inline uint64_t first_frame_io_position() const;
|
||||
inline bool first_frame_is_opaque() const;
|
||||
#endif // __cplusplus
|
||||
|
||||
} wuffs_base__image_config;
|
||||
@@ -607,17 +607,19 @@ wuffs_base__image_config__invalidate(wuffs_base__image_config* c) {
|
||||
}
|
||||
|
||||
static inline bool //
|
||||
wuffs_base__image_config__is_valid(wuffs_base__image_config* c) {
|
||||
wuffs_base__image_config__is_valid(const wuffs_base__image_config* c) {
|
||||
return c && wuffs_base__pixel_config__is_valid(&(c->pixcfg));
|
||||
}
|
||||
|
||||
static inline uint64_t //
|
||||
wuffs_base__image_config__first_frame_io_position(wuffs_base__image_config* c) {
|
||||
wuffs_base__image_config__first_frame_io_position(
|
||||
const wuffs_base__image_config* c) {
|
||||
return c ? c->private_impl.first_frame_io_position : 0;
|
||||
}
|
||||
|
||||
static inline bool //
|
||||
wuffs_base__image_config__first_frame_is_opaque(wuffs_base__image_config* c) {
|
||||
wuffs_base__image_config__first_frame_is_opaque(
|
||||
const wuffs_base__image_config* c) {
|
||||
return c ? c->private_impl.first_frame_is_opaque : false;
|
||||
}
|
||||
|
||||
@@ -640,17 +642,17 @@ wuffs_base__image_config::invalidate() {
|
||||
}
|
||||
|
||||
inline bool //
|
||||
wuffs_base__image_config::is_valid() {
|
||||
wuffs_base__image_config::is_valid() const {
|
||||
return wuffs_base__image_config__is_valid(this);
|
||||
}
|
||||
|
||||
inline uint64_t //
|
||||
wuffs_base__image_config::first_frame_io_position() {
|
||||
wuffs_base__image_config::first_frame_io_position() const {
|
||||
return wuffs_base__image_config__first_frame_io_position(this);
|
||||
}
|
||||
|
||||
inline bool //
|
||||
wuffs_base__image_config::first_frame_is_opaque() {
|
||||
wuffs_base__image_config::first_frame_is_opaque() const {
|
||||
return wuffs_base__image_config__first_frame_is_opaque(this);
|
||||
}
|
||||
|
||||
@@ -715,14 +717,14 @@ typedef struct {
|
||||
uint64_t io_position,
|
||||
wuffs_base__animation_blend blend,
|
||||
wuffs_base__animation_disposal disposal);
|
||||
inline wuffs_base__rect_ie_u32 bounds();
|
||||
inline uint32_t width();
|
||||
inline uint32_t height();
|
||||
inline wuffs_base__flicks duration();
|
||||
inline uint64_t index();
|
||||
inline uint64_t io_position();
|
||||
inline wuffs_base__animation_blend blend();
|
||||
inline wuffs_base__animation_disposal disposal();
|
||||
inline wuffs_base__rect_ie_u32 bounds() const;
|
||||
inline uint32_t width() const;
|
||||
inline uint32_t height() const;
|
||||
inline wuffs_base__flicks duration() const;
|
||||
inline uint64_t index() const;
|
||||
inline uint64_t io_position() const;
|
||||
inline wuffs_base__animation_blend blend() const;
|
||||
inline wuffs_base__animation_disposal disposal() const;
|
||||
#endif // __cplusplus
|
||||
|
||||
} wuffs_base__frame_config;
|
||||
@@ -760,7 +762,7 @@ wuffs_base__frame_config__update(wuffs_base__frame_config* c,
|
||||
}
|
||||
|
||||
static inline wuffs_base__rect_ie_u32 //
|
||||
wuffs_base__frame_config__bounds(wuffs_base__frame_config* c) {
|
||||
wuffs_base__frame_config__bounds(const wuffs_base__frame_config* c) {
|
||||
if (c) {
|
||||
return c->private_impl.bounds;
|
||||
}
|
||||
@@ -774,47 +776,47 @@ wuffs_base__frame_config__bounds(wuffs_base__frame_config* c) {
|
||||
}
|
||||
|
||||
static inline uint32_t //
|
||||
wuffs_base__frame_config__width(wuffs_base__frame_config* c) {
|
||||
wuffs_base__frame_config__width(const wuffs_base__frame_config* c) {
|
||||
return c ? wuffs_base__rect_ie_u32__width(&c->private_impl.bounds) : 0;
|
||||
}
|
||||
|
||||
static inline uint32_t //
|
||||
wuffs_base__frame_config__height(wuffs_base__frame_config* c) {
|
||||
wuffs_base__frame_config__height(const wuffs_base__frame_config* c) {
|
||||
return c ? wuffs_base__rect_ie_u32__height(&c->private_impl.bounds) : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__frame_config__duration returns the amount of time to display
|
||||
// this frame. Zero means to display forever - a still (non-animated) image.
|
||||
static inline wuffs_base__flicks //
|
||||
wuffs_base__frame_config__duration(wuffs_base__frame_config* c) {
|
||||
wuffs_base__frame_config__duration(const wuffs_base__frame_config* c) {
|
||||
return c ? c->private_impl.duration : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__frame_config__index returns the index of this frame. The first
|
||||
// frame in an image has index 0, the second frame has index 1, and so on.
|
||||
static inline uint64_t //
|
||||
wuffs_base__frame_config__index(wuffs_base__frame_config* c) {
|
||||
wuffs_base__frame_config__index(const wuffs_base__frame_config* c) {
|
||||
return c ? c->private_impl.index : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__frame_config__io_position returns the I/O stream position before
|
||||
// the frame config.
|
||||
static inline uint64_t //
|
||||
wuffs_base__frame_config__io_position(wuffs_base__frame_config* c) {
|
||||
wuffs_base__frame_config__io_position(const wuffs_base__frame_config* c) {
|
||||
return c ? c->private_impl.io_position : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__frame_config__blend returns, for an animated image, how to blend
|
||||
// the transparent pixels of this frame with the existing canvas.
|
||||
static inline wuffs_base__animation_blend //
|
||||
wuffs_base__frame_config__blend(wuffs_base__frame_config* c) {
|
||||
wuffs_base__frame_config__blend(const wuffs_base__frame_config* c) {
|
||||
return c ? c->private_impl.blend : 0;
|
||||
}
|
||||
|
||||
// wuffs_base__frame_config__disposal returns, for an animated image, how to
|
||||
// dispose of this frame after displaying it.
|
||||
static inline wuffs_base__animation_disposal //
|
||||
wuffs_base__frame_config__disposal(wuffs_base__frame_config* c) {
|
||||
wuffs_base__frame_config__disposal(const wuffs_base__frame_config* c) {
|
||||
return c ? c->private_impl.disposal : 0;
|
||||
}
|
||||
|
||||
@@ -832,42 +834,42 @@ wuffs_base__frame_config::update(wuffs_base__rect_ie_u32 bounds,
|
||||
}
|
||||
|
||||
inline wuffs_base__rect_ie_u32 //
|
||||
wuffs_base__frame_config::bounds() {
|
||||
wuffs_base__frame_config::bounds() const {
|
||||
return wuffs_base__frame_config__bounds(this);
|
||||
}
|
||||
|
||||
inline uint32_t //
|
||||
wuffs_base__frame_config::width() {
|
||||
wuffs_base__frame_config::width() const {
|
||||
return wuffs_base__frame_config__width(this);
|
||||
}
|
||||
|
||||
inline uint32_t //
|
||||
wuffs_base__frame_config::height() {
|
||||
wuffs_base__frame_config::height() const {
|
||||
return wuffs_base__frame_config__height(this);
|
||||
}
|
||||
|
||||
inline wuffs_base__flicks //
|
||||
wuffs_base__frame_config::duration() {
|
||||
wuffs_base__frame_config::duration() const {
|
||||
return wuffs_base__frame_config__duration(this);
|
||||
}
|
||||
|
||||
inline uint64_t //
|
||||
wuffs_base__frame_config::index() {
|
||||
wuffs_base__frame_config::index() const {
|
||||
return wuffs_base__frame_config__index(this);
|
||||
}
|
||||
|
||||
inline uint64_t //
|
||||
wuffs_base__frame_config::io_position() {
|
||||
wuffs_base__frame_config::io_position() const {
|
||||
return wuffs_base__frame_config__io_position(this);
|
||||
}
|
||||
|
||||
inline wuffs_base__animation_blend //
|
||||
wuffs_base__frame_config::blend() {
|
||||
wuffs_base__frame_config::blend() const {
|
||||
return wuffs_base__frame_config__blend(this);
|
||||
}
|
||||
|
||||
inline wuffs_base__animation_disposal //
|
||||
wuffs_base__frame_config::disposal() {
|
||||
wuffs_base__frame_config::disposal() const {
|
||||
return wuffs_base__frame_config__disposal(this);
|
||||
}
|
||||
|
||||
@@ -889,7 +891,7 @@ typedef struct {
|
||||
inline wuffs_base__status set_from_slice(wuffs_base__pixel_config* pixcfg,
|
||||
wuffs_base__slice_u8 pixbuf_memory);
|
||||
inline wuffs_base__slice_u8 palette();
|
||||
inline wuffs_base__pixel_format pixel_format();
|
||||
inline wuffs_base__pixel_format pixel_format() const;
|
||||
inline wuffs_base__table_u8 plane(uint32_t p);
|
||||
#endif // __cplusplus
|
||||
|
||||
@@ -986,7 +988,7 @@ wuffs_base__pixel_buffer__palette(wuffs_base__pixel_buffer* b) {
|
||||
}
|
||||
|
||||
static inline wuffs_base__pixel_format //
|
||||
wuffs_base__pixel_buffer__pixel_format(wuffs_base__pixel_buffer* b) {
|
||||
wuffs_base__pixel_buffer__pixel_format(const wuffs_base__pixel_buffer* b) {
|
||||
if (b) {
|
||||
return b->pixcfg.private_impl.pixfmt;
|
||||
}
|
||||
@@ -1021,7 +1023,7 @@ wuffs_base__pixel_buffer::palette() {
|
||||
}
|
||||
|
||||
inline wuffs_base__pixel_format //
|
||||
wuffs_base__pixel_buffer::pixel_format() {
|
||||
wuffs_base__pixel_buffer::pixel_format() const {
|
||||
return wuffs_base__pixel_buffer__pixel_format(this);
|
||||
}
|
||||
|
||||
@@ -1069,7 +1071,7 @@ typedef struct {
|
||||
wuffs_base__slice_u8 src_palette);
|
||||
inline uint64_t swizzle_packed(wuffs_base__slice_u8 dst,
|
||||
wuffs_base__slice_u8 dst_palette,
|
||||
wuffs_base__slice_u8 src);
|
||||
wuffs_base__slice_u8 src) const;
|
||||
#endif // __cplusplus
|
||||
|
||||
} wuffs_base__pixel_swizzler;
|
||||
@@ -1084,7 +1086,7 @@ wuffs_base__pixel_swizzler__prepare(wuffs_base__pixel_swizzler* p,
|
||||
wuffs_base__slice_u8 src_palette);
|
||||
|
||||
uint64_t //
|
||||
wuffs_base__pixel_swizzler__swizzle_packed(wuffs_base__pixel_swizzler* p,
|
||||
wuffs_base__pixel_swizzler__swizzle_packed(const wuffs_base__pixel_swizzler* p,
|
||||
wuffs_base__slice_u8 dst,
|
||||
wuffs_base__slice_u8 dst_palette,
|
||||
wuffs_base__slice_u8 src);
|
||||
@@ -1103,7 +1105,7 @@ wuffs_base__pixel_swizzler::prepare(wuffs_base__pixel_format dst_format,
|
||||
uint64_t //
|
||||
wuffs_base__pixel_swizzler::swizzle_packed(wuffs_base__slice_u8 dst,
|
||||
wuffs_base__slice_u8 dst_palette,
|
||||
wuffs_base__slice_u8 src) {
|
||||
wuffs_base__slice_u8 src) const {
|
||||
return wuffs_base__pixel_swizzler__swizzle_packed(this, dst, dst_palette,
|
||||
src);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user