base: rename min/max arg to no_more/less_than

This commit is contained in:
Nigel Tao committed 2023-04-16 12:12:27 +10:00
1 parent 95630b6677
commit bc86394bef
8 files changed
+45 -44

No files matched your search

+19 -19
View File
@@ -294,13 +294,13 @@ pub func decoder.num_decoded_frames() base.u64 {
}
pub func decoder.frame_dirty_rect() base.rect_ie_u32 {
// The "foo.min(a:this.width_or_height)" calls clip the nominal frame_rect
// to the image_rect.
// The "foo.min(no_more_than: this.width_or_height)" calls clip the nominal
// frame_rect to the image_rect.
return 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),
max_excl_y: this.dirty_max_excl_y.min(a: this.height))
min_incl_x: this.frame_rect_x0.min(no_more_than: this.width),
min_incl_y: this.frame_rect_y0.min(no_more_than: this.height),
max_excl_x: this.frame_rect_x1.min(no_more_than: this.width),
max_excl_y: this.dirty_max_excl_y.min(no_more_than: this.height))
}
pub func decoder.workbuf_len() base.range_ii_u64 {
@@ -390,13 +390,13 @@ pri func decoder.do_decode_frame_config?(dst: nptr base.frame_config, src: base.
}
if args.dst <> nullptr {
// The "foo.min(a:this.width_or_height)" calls clip the nominal
// frame_rect to the image_rect.
// The "foo.min(no_more_than: this.width_or_height)" calls clip the
// nominal frame_rect to the image_rect.
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),
max_excl_y: this.frame_rect_y1.min(a: this.height)),
min_incl_x: this.frame_rect_x0.min(no_more_than: this.width),
min_incl_y: this.frame_rect_y0.min(no_more_than: this.height),
max_excl_x: this.frame_rect_x1.min(no_more_than: this.width),
max_excl_y: this.frame_rect_y1.min(no_more_than: this.height)),
duration: this.gc_duration,
index: this.num_decoded_frame_configs_value,
io_position: this.frame_config_io_position,
@@ -804,8 +804,8 @@ pri func decoder.decode_id_part0?(src: base.io_reader) {
// test/data/artificial/gif-frame-out-of-bounds.gif.make-artificial.txt for
// more discussion.
if (this.num_decoded_frame_configs_value == 0) and (not this.quirks[QUIRK_IMAGE_BOUNDS_ARE_STRICT - QUIRKS_BASE]) {
this.width = this.width.max(a: this.frame_rect_x1)
this.height = this.height.max(a: this.frame_rect_y1)
this.width = this.width.max(no_less_than: this.frame_rect_x1)
this.height = this.height.max(no_less_than: this.frame_rect_y1)
}
}
@@ -936,7 +936,7 @@ pri func decoder.decode_id_part2?(dst: ptr base.pixel_buffer, src: base.io_reade
this.compressed_wi = 0
}
while this.compressed_wi <= (4096 - 255) {
n_compressed = block_size.min(a: args.src.length())
n_compressed = block_size.min(no_more_than: args.src.length())
if n_compressed <= 0 {
break
}
@@ -1078,7 +1078,7 @@ pri func decoder.copy_to_image_buffer!(pb: ptr base.pixel_buffer, src: slice bas
src_ri ~sat+= n
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)
this.dirty_max_excl_y = this.dirty_max_excl_y.max(no_less_than: this.dst_y ~sat+ 1)
}
if this.frame_rect_x1 <= this.dst_x {
@@ -1102,14 +1102,14 @@ pri func decoder.copy_to_image_buffer!(pb: ptr base.pixel_buffer, src: slice bas
replicate_src = tab.row_u32(y: this.dst_y)
replicate_y0 = this.dst_y ~sat+ 1
replicate_y1 = this.dst_y ~sat+ (INTERLACE_COUNT[this.interlace] as base.u32)
replicate_y1 = replicate_y1.min(a: this.frame_rect_y1)
replicate_y1 = replicate_y1.min(no_more_than: this.frame_rect_y1)
while replicate_y0 < replicate_y1 {
assert replicate_y0 < 0xFFFF_FFFF via "a < b: a < c; c <= b"(c: replicate_y1)
replicate_dst = tab.row_u32(y: replicate_y0)
replicate_dst.copy_from_slice!(s: replicate_src)
replicate_y0 += 1
} endwhile
this.dirty_max_excl_y = this.dirty_max_excl_y.max(a: replicate_y1)
this.dirty_max_excl_y = this.dirty_max_excl_y.max(no_less_than: replicate_y1)
}
this.dst_y ~sat+= INTERLACE_DELTA[this.interlace] as base.u32
@@ -1131,7 +1131,7 @@ pri func decoder.copy_to_image_buffer!(pb: ptr base.pixel_buffer, src: slice bas
// Set n to the number of pixels (i.e. the number of bytes) to skip.
n = (this.frame_rect_x1 - this.dst_x) as base.u64
n = n.min(a: args.src.length() - src_ri)
n = n.min(no_more_than: args.src.length() - src_ri)
src_ri ~sat+= n
this.dst_x ~sat+= (n & 0xFFFF_FFFF) as base.u32