Remove std/bmp redundant dst_y_end field

This commit is contained in:
Nigel Tao committed 2020-12-14 23:17:31 +11:00
1 parent 47b114e948
commit 59799ddcc5
2 files changed
+12 -18

No files matched your search

+6 -9
View File
@@ -5608,7 +5608,6 @@ struct wuffs_bmp__decoder__struct {
uint8_t f_channel_num_bits[4];
uint32_t f_dst_x;
uint32_t f_dst_y;
uint32_t f_dst_y_end;
uint32_t f_dst_y_inc;
uint32_t f_pending_pad;
uint32_t f_rle_state;
@@ -17436,11 +17435,9 @@ wuffs_bmp__decoder__decode_frame(
self->private_impl.f_dst_x = 0;
if (self->private_impl.f_top_down) {
self->private_impl.f_dst_y = 0;
self->private_impl.f_dst_y_end = self->private_impl.f_height;
self->private_impl.f_dst_y_inc = 1;
} else {
self->private_impl.f_dst_y = (self->private_impl.f_height - 1);
self->private_impl.f_dst_y_end = 4294967295;
self->private_impl.f_dst_y_inc = 4294967295;
}
v_status = wuffs_base__pixel_swizzler__prepare(&self->private_impl.f_swizzler,
@@ -17591,7 +17588,7 @@ wuffs_bmp__decoder__swizzle_none(
if (self->private_impl.f_dst_x == self->private_impl.f_width) {
self->private_impl.f_dst_x = 0;
self->private_impl.f_dst_y += self->private_impl.f_dst_y_inc;
if (self->private_impl.f_dst_y == self->private_impl.f_dst_y_end) {
if (self->private_impl.f_dst_y >= self->private_impl.f_height) {
goto label__outer__break;
} else if (self->private_impl.f_pad_per_row != 0) {
self->private_impl.f_pending_pad = self->private_impl.f_pad_per_row;
@@ -17745,7 +17742,7 @@ wuffs_bmp__decoder__swizzle_rle(
v_code = wuffs_base__load_u8be__no_bounds_check(iop_a_src);
(iop_a_src += 1, wuffs_base__make_empty_struct());
if (v_code < 2) {
if ((self->private_impl.f_dst_y == self->private_impl.f_dst_y_end) && (v_code == 0)) {
if ((self->private_impl.f_dst_y >= self->private_impl.f_height) && (v_code == 0)) {
status = wuffs_base__make_status(wuffs_bmp__error__bad_rle_compression);
goto exit;
}
@@ -17840,7 +17837,7 @@ wuffs_bmp__decoder__swizzle_rle(
#endif
while (true) {
self->private_impl.f_dst_y += self->private_impl.f_dst_y_inc;
if (self->private_impl.f_dst_y == self->private_impl.f_dst_y_end) {
if (self->private_impl.f_dst_y >= self->private_impl.f_height) {
status = wuffs_base__make_status(wuffs_bmp__error__bad_rle_compression);
goto exit;
}
@@ -17875,7 +17872,7 @@ wuffs_bmp__decoder__swizzle_rle(
}
}
label__outer__break:;
while (self->private_impl.f_dst_y != self->private_impl.f_dst_y_end) {
while (self->private_impl.f_dst_y < self->private_impl.f_height) {
v_row = wuffs_base__table_u8__row(v_tab, self->private_impl.f_dst_y);
if (v_dst_bytes_per_row < ((uint64_t)(v_row.len))) {
v_row = wuffs_base__slice_u8__subslice_j(v_row, v_dst_bytes_per_row);
@@ -17959,7 +17956,7 @@ wuffs_bmp__decoder__swizzle_bitfields(
if (self->private_impl.f_dst_x == self->private_impl.f_width) {
self->private_impl.f_dst_x = 0;
self->private_impl.f_dst_y += self->private_impl.f_dst_y_inc;
if (self->private_impl.f_dst_y == self->private_impl.f_dst_y_end) {
if (self->private_impl.f_dst_y >= self->private_impl.f_height) {
goto label__outer__break;
} else if (self->private_impl.f_pad_per_row != 0) {
self->private_impl.f_pending_pad = self->private_impl.f_pad_per_row;
@@ -18083,7 +18080,7 @@ wuffs_bmp__decoder__swizzle_low_bit_depth(
if (self->private_impl.f_dst_x == self->private_impl.f_width) {
self->private_impl.f_dst_x = 0;
self->private_impl.f_dst_y += self->private_impl.f_dst_y_inc;
if (self->private_impl.f_dst_y == self->private_impl.f_dst_y_end) {
if (self->private_impl.f_dst_y >= self->private_impl.f_height) {
goto label__loop__break;
}
}
+6 -9
View File
@@ -59,7 +59,6 @@ pub struct decoder? implements base.image_decoder(
dst_x : base.u32,
dst_y : base.u32,
dst_y_end : base.u32,
dst_y_inc : base.u32,
pending_pad : base.u32[..= 3],
@@ -425,11 +424,9 @@ pub func decoder.decode_frame?(dst: ptr base.pixel_buffer, src: base.io_reader,
this.dst_x = 0
if this.top_down {
this.dst_y = 0
this.dst_y_end = this.height
this.dst_y_inc = 1
} else {
this.dst_y = this.height ~mod- 1
this.dst_y_end = 0xFFFF_FFFF // -1 as a base.u32.
this.dst_y_inc = 0xFFFF_FFFF // -1 as a base.u32.
}
@@ -502,7 +499,7 @@ pri func decoder.swizzle_none!(dst: ptr base.pixel_buffer, src: base.io_reader)
if this.dst_x == this.width {
this.dst_x = 0
this.dst_y ~mod+= this.dst_y_inc
if this.dst_y == this.dst_y_end {
if this.dst_y >= this.height {
break.outer
} else if this.pad_per_row <> 0 {
this.pending_pad = this.pad_per_row
@@ -645,7 +642,7 @@ pri func decoder.swizzle_rle!(dst: ptr base.pixel_buffer, src: base.io_reader) b
code = args.src.peek_u8()
args.src.skip_u32_fast!(actual: 1, worst_case: 1)
if code < 2 { // 0=EOL, 1=EOF.
if (this.dst_y == this.dst_y_end) and (code == 0) {
if (this.dst_y >= this.height) and (code == 0) {
return "#bad RLE compression"
}
this.swizzler.swizzle_interleaved_transparent_black!(
@@ -748,7 +745,7 @@ pri func decoder.swizzle_rle!(dst: ptr base.pixel_buffer, src: base.io_reader) b
code -= 1
while true {
this.dst_y ~mod+= this.dst_y_inc
if this.dst_y == this.dst_y_end {
if this.dst_y >= this.height {
return "#bad RLE compression"
}
row = tab.row(y: this.dst_y)
@@ -780,7 +777,7 @@ pri func decoder.swizzle_rle!(dst: ptr base.pixel_buffer, src: base.io_reader) b
} endwhile.middle
} endwhile.outer
while this.dst_y <> this.dst_y_end {
while this.dst_y < this.height {
row = tab.row(y: this.dst_y)
if dst_bytes_per_row < row.length() {
row = row[.. dst_bytes_per_row]
@@ -840,7 +837,7 @@ pri func decoder.swizzle_bitfields!(dst: ptr base.pixel_buffer, src: base.io_rea
if this.dst_x == this.width {
this.dst_x = 0
this.dst_y ~mod+= this.dst_y_inc
if this.dst_y == this.dst_y_end {
if this.dst_y >= this.height {
break.outer
} else if this.pad_per_row <> 0 {
this.pending_pad = this.pad_per_row
@@ -955,7 +952,7 @@ pri func decoder.swizzle_low_bit_depth!(dst: ptr base.pixel_buffer, src: base.io
if this.dst_x == this.width {
this.dst_x = 0
this.dst_y ~mod+= this.dst_y_inc
if this.dst_y == this.dst_y_end {
if this.dst_y >= this.height {
break.loop
}
}