Fix std/png Paeth filter for the top row

This commit is contained in:
Nigel Tao committed 2020-12-27 23:02:07 +11:00
1 parent ad311dac93
commit 5ad6238f34
2 files changed
+12

No files matched your search

+8
View File
@@ -365,7 +365,15 @@ pub func decoder.decode_frame?(dst: ptr base.pixel_buffer, src: base.io_reader,
if this.workbuf_wi <> this.workbuf_length {
return base."#not enough data"
} else if 0 < args.workbuf.length() {
// For the top row, the Paeth filter (4) is equivalent to the Sub
// filter (1), but the Paeth implementation is simpler if it can assume
// that there is a previous row.
if args.workbuf[0] == 4 {
args.workbuf[0] = 1
}
}
swizzler_status = this.swizzler.prepare!(
dst_pixfmt: args.dst.pixel_format(),
dst_palette: args.dst.palette_or_else(fallback: this.dst_palette[..]),