Remove std/png tricky field
diff --git a/release/c/wuffs-unsupported-snapshot.c b/release/c/wuffs-unsupported-snapshot.c
index 7132b96..c7073be 100644
--- a/release/c/wuffs-unsupported-snapshot.c
+++ b/release/c/wuffs-unsupported-snapshot.c
@@ -8525,7 +8525,6 @@
uint8_t f_interlace_pass;
bool f_seen_plte;
bool f_seen_trns;
- bool f_tricky;
uint32_t f_dst_pixfmt;
uint32_t f_src_pixfmt;
uint32_t f_chunk_type;
@@ -32662,9 +32661,12 @@
uint8_t t_6 = *iop_a_src++;
v_a8 = t_6;
}
- if (v_a8 <= 1) {
- self->private_impl.f_interlace_pass = v_a8;
- self->private_impl.f_tricky = (self->private_impl.f_tricky || (v_a8 >= 1));
+ if (v_a8 == 0) {
+ self->private_impl.f_interlace_pass = 0;
+ } else if (v_a8 == 1) {
+ self->private_impl.f_interlace_pass = 1;
+ self->private_impl.choosy_filter_and_swizzle = (
+ &wuffs_png__decoder__filter_and_swizzle_tricky);
} else {
status = wuffs_base__make_status(wuffs_png__error__bad_header);
goto exit;
@@ -32677,10 +32679,6 @@
}
self->private_impl.f_overall_workbuf_length = (((uint64_t)(self->private_impl.f_height)) * (1 + wuffs_png__decoder__calculate_bytes_per_row(self, self->private_impl.f_width)));
wuffs_png__decoder__choose_filter_implementations(self);
- if (self->private_impl.f_tricky) {
- self->private_impl.choosy_filter_and_swizzle = (
- &wuffs_png__decoder__filter_and_swizzle_tricky);
- }
goto ok;
ok:
@@ -32717,7 +32715,8 @@
return wuffs_base__make_empty_struct();
}
self->private_impl.f_filter_distance = 1;
- self->private_impl.f_tricky = true;
+ self->private_impl.choosy_filter_and_swizzle = (
+ &wuffs_png__decoder__filter_and_swizzle_tricky);
} else if (self->private_impl.f_color_type == 0) {
if (self->private_impl.f_depth == 8) {
self->private_impl.f_dst_pixfmt = 536870920;
@@ -33042,17 +33041,19 @@
}
v_i += 1;
}
- if (self->private_impl.f_color_type == 0) {
- self->private_impl.f_dst_pixfmt = 2164295816;
- self->private_impl.f_src_pixfmt = 2164308923;
- self->private_impl.f_tricky = true;
- } else if (self->private_impl.f_color_type == 2) {
- self->private_impl.f_dst_pixfmt = 2164295816;
- self->private_impl.f_src_pixfmt = 2164308923;
- self->private_impl.f_tricky = true;
- } else if (self->private_impl.f_color_type == 3) {
+ if (self->private_impl.f_color_type == 3) {
self->private_impl.f_dst_pixfmt = 2164523016;
self->private_impl.f_src_pixfmt = 2164523016;
+ } else {
+ self->private_impl.choosy_filter_and_swizzle = (
+ &wuffs_png__decoder__filter_and_swizzle_tricky);
+ if (self->private_impl.f_color_type == 0) {
+ self->private_impl.f_dst_pixfmt = 2164295816;
+ self->private_impl.f_src_pixfmt = 2164308923;
+ } else if (self->private_impl.f_color_type == 2) {
+ self->private_impl.f_dst_pixfmt = 2164295816;
+ self->private_impl.f_src_pixfmt = 2164308923;
+ }
}
goto ok;
diff --git a/std/png/decode_png.wuffs b/std/png/decode_png.wuffs
index dd77626..5d30a2a 100644
--- a/std/png/decode_png.wuffs
+++ b/std/png/decode_png.wuffs
@@ -77,8 +77,6 @@
seen_plte : base.bool,
seen_trns : base.bool,
- tricky : base.bool,
-
dst_pixfmt : base.u32,
src_pixfmt : base.u32,
@@ -264,9 +262,11 @@
// Interlace.
a8 = args.src.read_u8?()
- if a8 <= 1 {
- this.interlace_pass = a8
- this.tricky = this.tricky or (a8 >= 1)
+ if a8 == 0 {
+ this.interlace_pass = 0
+ } else if a8 == 1 {
+ this.interlace_pass = 1
+ choose filter_and_swizzle = [filter_and_swizzle_tricky]
} else {
return "#bad header"
}
@@ -280,9 +280,6 @@
this.overall_workbuf_length = (this.height as base.u64) *
(1 + this.calculate_bytes_per_row(width: this.width))
this.choose_filter_implementations!()
- if this.tricky {
- choose filter_and_swizzle = [filter_and_swizzle_tricky]
- }
}
pri func decoder.assign_filter_distance!() {
@@ -298,7 +295,7 @@
}
this.filter_distance = 1
- this.tricky = true
+ choose filter_and_swizzle = [filter_and_swizzle_tricky]
} else if this.color_type == 0 {
if this.depth == 8 {
@@ -441,18 +438,19 @@
i += 1
} endwhile
- if this.color_type == 0 {
- // TODO: PIXEL_FORMAT__YA_NONPREMUL
- this.dst_pixfmt = base.PIXEL_FORMAT__BGRA_NONPREMUL
- this.src_pixfmt = base.PIXEL_FORMAT__BGRA_NONPREMUL_4X16LE
- this.tricky = true
- } else if this.color_type == 2 {
- this.dst_pixfmt = base.PIXEL_FORMAT__BGRA_NONPREMUL
- this.src_pixfmt = base.PIXEL_FORMAT__BGRA_NONPREMUL_4X16LE
- this.tricky = true
- } else if this.color_type == 3 {
+ if this.color_type == 3 {
this.dst_pixfmt = base.PIXEL_FORMAT__INDEXED__BGRA_NONPREMUL
this.src_pixfmt = base.PIXEL_FORMAT__INDEXED__BGRA_NONPREMUL
+ } else {
+ choose filter_and_swizzle = [filter_and_swizzle_tricky]
+ if this.color_type == 0 {
+ // TODO: PIXEL_FORMAT__YA_NONPREMUL
+ this.dst_pixfmt = base.PIXEL_FORMAT__BGRA_NONPREMUL
+ this.src_pixfmt = base.PIXEL_FORMAT__BGRA_NONPREMUL_4X16LE
+ } else if this.color_type == 2 {
+ this.dst_pixfmt = base.PIXEL_FORMAT__BGRA_NONPREMUL
+ this.src_pixfmt = base.PIXEL_FORMAT__BGRA_NONPREMUL_4X16LE
+ }
}
}