mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 08:55:11 +01:00
Let std/png decode (animated) APNG
The test/nia-checksums-of-data.txt checksums for the *.apng files now match the (multiple frame) *.gif files. Previously, they matched the (single frame) *.000000.nie files. Fixes #41
This commit is contained in:
1 parent
22eed1fd8d
commit
a4fa6a2554
6 files changed
+1645
-288
No files matched your search
@@ -18,7 +18,8 @@ pri func decoder.filter_and_swizzle!(dst: ptr base.pixel_buffer, workbuf: slice
|
||||
var dst_pixfmt : base.pixel_format
|
||||
var dst_bits_per_pixel : base.u32[..= 256]
|
||||
var dst_bytes_per_pixel : base.u64[..= 32]
|
||||
var dst_bytes_per_row : base.u64
|
||||
var dst_bytes_per_row0 : base.u64
|
||||
var dst_bytes_per_row1 : base.u64
|
||||
var dst_palette : slice base.u8
|
||||
var tab : table base.u8
|
||||
|
||||
@@ -36,15 +37,22 @@ pri func decoder.filter_and_swizzle!(dst: ptr base.pixel_buffer, workbuf: slice
|
||||
return base."#unsupported option"
|
||||
}
|
||||
dst_bytes_per_pixel = (dst_bits_per_pixel / 8) as base.u64
|
||||
dst_bytes_per_row = (this.width as base.u64) * dst_bytes_per_pixel
|
||||
dst_bytes_per_row0 = (this.frame_rect_x0 as base.u64) * dst_bytes_per_pixel
|
||||
dst_bytes_per_row1 = (this.frame_rect_x1 as base.u64) * dst_bytes_per_pixel
|
||||
dst_palette = args.dst.palette_or_else(fallback: this.dst_palette[..])
|
||||
tab = args.dst.plane(p: 0)
|
||||
|
||||
while y < this.height {
|
||||
assert y < 0x00FF_FFFF via "a < b: a < c; c <= b"(c: this.height)
|
||||
y = this.frame_rect_y0
|
||||
while y < this.frame_rect_y1 {
|
||||
assert y < 0x00FF_FFFF via "a < b: a < c; c <= b"(c: this.frame_rect_y1)
|
||||
dst = tab.row(y: y)
|
||||
if dst_bytes_per_row < dst.length() {
|
||||
dst = dst[.. dst_bytes_per_row]
|
||||
if dst_bytes_per_row1 < dst.length() {
|
||||
dst = dst[.. dst_bytes_per_row1]
|
||||
}
|
||||
if dst_bytes_per_row0 < dst.length() {
|
||||
dst = dst[dst_bytes_per_row0 ..]
|
||||
} else {
|
||||
dst = this.util.empty_slice_u8()
|
||||
}
|
||||
|
||||
if 1 > args.workbuf.length() {
|
||||
|
||||
Reference in new issue
Block a user