mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-19 16:47:28 +01:00
Let GIF decode BGR/RGB, not just BGRA/RGBA
This commit is contained in:
1 parent
7e5332cadf
commit
0b1f43834f
5 files changed
+236
-29
No files matched your search
@@ -1110,19 +1110,22 @@ pri func decoder.copy_to_image_buffer!(pb ptr base.pixel_buffer, src slice base.
|
||||
var n base.u64
|
||||
var src_ri base.u64
|
||||
var bytes_per_pixel base.u32[..64]
|
||||
var pixfmt base.u32
|
||||
var pixfmt_channels base.u32
|
||||
var tab table base.u8
|
||||
var i base.u64
|
||||
var j base.u64
|
||||
|
||||
// TODO: a Wuffs (not just C) name for the WUFFS_BASE__PIXEL_FORMAT__ETC
|
||||
// magic pixfmt constants. Also, support more formats.
|
||||
bytes_per_pixel = 1
|
||||
pixfmt = args.pb.pixel_format()
|
||||
if (pixfmt == 0x45008888) or (pixfmt == 0x55008888) or
|
||||
(pixfmt == 0x46008888) or (pixfmt == 0x56008888) or
|
||||
(pixfmt == 0x47008888) or (pixfmt == 0x57008888) {
|
||||
pixfmt_channels = args.pb.pixel_format() & 0xFFFF
|
||||
if (pixfmt_channels == 0x8888) {
|
||||
bytes_per_pixel = 4
|
||||
} else if (pixfmt_channels == 0x0888) {
|
||||
bytes_per_pixel = 3
|
||||
} else if (pixfmt_channels == 0x0008) {
|
||||
bytes_per_pixel = 1
|
||||
} else {
|
||||
return base."#unsupported option"
|
||||
}
|
||||
|
||||
tab = args.pb.plane(p:0)
|
||||
|
||||
Reference in new issue
Block a user