mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-26 17:01:35 +01:00
Have wuffsfmt put underscores in long numbers
This commit is contained in:
1 parent
22be1c0da0
commit
b40671ec84
11 files changed
+636
-592
No files matched your search
+17
-17
@@ -112,8 +112,8 @@ pub struct decoder? implements base.image_decoder(
|
||||
gc_has_transparent_index : base.bool,
|
||||
gc_transparent_index : base.u8,
|
||||
gc_disposal : base.u8,
|
||||
// There are 7056000 flicks per centisecond.
|
||||
gc_duration : base.u64[..= 0xFFFF * 7056000],
|
||||
// There are 7_056000 flicks per centisecond.
|
||||
gc_duration : base.u64[..= 0xFFFF * 7_056000],
|
||||
|
||||
frame_config_io_position : base.u64,
|
||||
num_decoded_frame_configs_value : base.u64,
|
||||
@@ -196,7 +196,7 @@ pub func decoder.decode_image_config?(dst: nptr base.image_config, src: base.io_
|
||||
(this.frame_rect_y1 == this.height)
|
||||
} else if ffio {
|
||||
// Use opaque black, not transparent black.
|
||||
this.black_color_u32_argb_premul = 0xFF000000
|
||||
this.black_color_u32_argb_premul = 0xFF00_0000
|
||||
}
|
||||
|
||||
if this.background_color_u32_argb_premul == 77 {
|
||||
@@ -207,7 +207,7 @@ pub func decoder.decode_image_config?(dst: nptr base.image_config, src: base.io_
|
||||
// TODO: a Wuffs (not just C) name for the
|
||||
// WUFFS_BASE__PIXEL_FORMAT__INDEXED__BGRA_BINARY magic pixfmt constant.
|
||||
args.dst.set!(
|
||||
pixfmt: 0x47040008,
|
||||
pixfmt: 0x4704_0008,
|
||||
pixsub: 0,
|
||||
width: this.width,
|
||||
height: this.height,
|
||||
@@ -219,9 +219,9 @@ pub func decoder.decode_image_config?(dst: nptr base.image_config, src: base.io_
|
||||
}
|
||||
|
||||
pub func decoder.set_report_metadata!(fourcc: base.u32, report: base.bool) {
|
||||
if args.fourcc == 0x49434350 { // "ICCP"
|
||||
if args.fourcc == 0x4943_4350 { // "ICCP"
|
||||
this.report_metadata_iccp = args.report
|
||||
} else if args.fourcc == 0x584D5020 { // "XMP "
|
||||
} else if args.fourcc == 0x584D_5020 { // "XMP "
|
||||
this.report_metadata_xmp = args.report
|
||||
}
|
||||
}
|
||||
@@ -243,7 +243,7 @@ pub func decoder.ack_metadata_chunk?(src: base.io_reader) {
|
||||
|
||||
this.metadata_chunk_length_value = args.src.peek_u8_as_u64()
|
||||
if this.metadata_chunk_length_value > 0 {
|
||||
if this.metadata_fourcc_value == 0x584D5020 { // "XMP "
|
||||
if this.metadata_fourcc_value == 0x584D_5020 { // "XMP "
|
||||
// The +1 is because XMP metadata's encoding includes each
|
||||
// block's leading byte (the block size) as part of the
|
||||
// metadata passed to the caller.
|
||||
@@ -536,7 +536,7 @@ pri func decoder.decode_lsd?(src: base.io_reader) {
|
||||
// Convert from RGB (in memory order) to ARGB (in native u32 order)
|
||||
// to BGRA (in memory order).
|
||||
argb = args.src.read_u24be_as_u32?()
|
||||
argb |= 0xFF000000
|
||||
argb |= 0xFF00_0000
|
||||
this.palettes[0][(4 * i) + 0] = ((argb >> 0) & 0xFF) as base.u8
|
||||
this.palettes[0][(4 * i) + 1] = ((argb >> 8) & 0xFF) as base.u8
|
||||
this.palettes[0][(4 * i) + 2] = ((argb >> 16) & 0xFF) as base.u8
|
||||
@@ -692,7 +692,7 @@ pri func decoder.decode_ae?(src: base.io_reader) {
|
||||
}
|
||||
this.metadata_chunk_length_value = args.src.peek_u8_as_u64()
|
||||
args.src.skip32_fast!(actual: 1, worst_case: 1)
|
||||
this.metadata_fourcc_value = 0x49434350 // "ICCP"
|
||||
this.metadata_fourcc_value = 0x4943_4350 // "ICCP"
|
||||
this.metadata_io_position = args.src.position() ~sat+ this.metadata_chunk_length_value
|
||||
this.call_sequence = 1
|
||||
return base."@metadata reported"
|
||||
@@ -712,7 +712,7 @@ pri func decoder.decode_ae?(src: base.io_reader) {
|
||||
} else {
|
||||
args.src.skip32_fast!(actual: 1, worst_case: 1)
|
||||
}
|
||||
this.metadata_fourcc_value = 0x584D5020 // "XMP "
|
||||
this.metadata_fourcc_value = 0x584D_5020 // "XMP "
|
||||
this.metadata_io_position = args.src.position() ~sat+ this.metadata_chunk_length_value
|
||||
this.call_sequence = 1
|
||||
return base."@metadata reported"
|
||||
@@ -755,9 +755,9 @@ pri func decoder.decode_gc?(src: base.io_reader) {
|
||||
this.gc_disposal = 0
|
||||
}
|
||||
|
||||
// There are 7056000 flicks per centisecond.
|
||||
// There are 7_056000 flicks per centisecond.
|
||||
gc_duration_centiseconds = args.src.read_u16le?()
|
||||
this.gc_duration = (gc_duration_centiseconds as base.u64) * 7056000
|
||||
this.gc_duration = (gc_duration_centiseconds as base.u64) * 7_056000
|
||||
this.gc_transparent_index = args.src.read_u8?()
|
||||
|
||||
c = args.src.read_u8?()
|
||||
@@ -830,7 +830,7 @@ pri func decoder.decode_id_part1?(dst: ptr base.pixel_buffer, src: base.io_reade
|
||||
// Convert from RGB (in memory order) to ARGB (in native u32 order)
|
||||
// to BGRA (in memory order).
|
||||
argb = args.src.read_u24be_as_u32?()
|
||||
argb |= 0xFF000000
|
||||
argb |= 0xFF00_0000
|
||||
this.palettes[1][(4 * i) + 0] = ((argb >> 0) & 0xFF) as base.u8
|
||||
this.palettes[1][(4 * i) + 1] = ((argb >> 8) & 0xFF) as base.u8
|
||||
this.palettes[1][(4 * i) + 2] = ((argb >> 16) & 0xFF) as base.u8
|
||||
@@ -871,7 +871,7 @@ pri func decoder.decode_id_part1?(dst: ptr base.pixel_buffer, src: base.io_reade
|
||||
status = this.swizzler.prepare!(
|
||||
dst_pixfmt: args.dst.pixel_format(),
|
||||
dst_palette: dst_palette,
|
||||
src_pixfmt: this.util.make_pixel_format(repr: 0x47040008),
|
||||
src_pixfmt: this.util.make_pixel_format(repr: 0x4704_0008),
|
||||
src_palette: this.palettes[which_palette][..],
|
||||
blend: args.blend)
|
||||
if not status.is_ok() {
|
||||
@@ -1066,7 +1066,7 @@ pri func decoder.copy_to_image_buffer!(pb: ptr base.pixel_buffer, src: slice bas
|
||||
dst: dst, dst_palette: this.dst_palette[..], src: src)
|
||||
|
||||
src_ri ~sat+= n
|
||||
this.dst_x ~sat+= (n & 0xFFFFFFFF) as base.u32
|
||||
this.dst_x ~sat+= (n & 0xFFFF_FFFF) as base.u32
|
||||
|
||||
this.dirty_max_excl_y = this.dirty_max_excl_y.max(a: this.dst_y ~sat+ 1)
|
||||
}
|
||||
@@ -1094,7 +1094,7 @@ pri func decoder.copy_to_image_buffer!(pb: ptr base.pixel_buffer, src: slice bas
|
||||
replicate_y1 = this.dst_y ~sat+ (interlace_count[this.interlace] as base.u32)
|
||||
replicate_y1 = replicate_y1.min(a: this.frame_rect_y1)
|
||||
while replicate_y0 < replicate_y1 {
|
||||
assert replicate_y0 < 0xFFFFFFFF via "a < b: a < c; c <= b"(c: replicate_y1)
|
||||
assert replicate_y0 < 0xFFFF_FFFF via "a < b: a < c; c <= b"(c: replicate_y1)
|
||||
replicate_dst = tab.row(y: replicate_y0)
|
||||
replicate_dst.copy_from_slice!(s: replicate_src)
|
||||
replicate_y0 += 1
|
||||
@@ -1124,7 +1124,7 @@ pri func decoder.copy_to_image_buffer!(pb: ptr base.pixel_buffer, src: slice bas
|
||||
n = n.min(a: args.src.length() - src_ri)
|
||||
|
||||
src_ri ~sat+= n
|
||||
this.dst_x ~sat+= (n & 0xFFFFFFFF) as base.u32
|
||||
this.dst_x ~sat+= (n & 0xFFFF_FFFF) as base.u32
|
||||
|
||||
if this.frame_rect_x1 <= this.dst_x {
|
||||
this.dst_x = this.frame_rect_x0
|
||||
|
||||
Reference in new issue
Block a user