Tweak pixel_format bits

This commit is contained in:
Nigel Tao committed 2020-05-16 10:12:16 +10:00
1 parent ddc41cb43f
commit 9a1b8def46
9 files changed
+212 -148

No files matched your search

+3 -3
View File
@@ -128,14 +128,14 @@ pub func decoder.decode_image_config?(dst: nptr base.image_config, src: base.io_
this.pad_per_row = this.width & 3
// TODO: a Wuffs (not just C) name for the
// WUFFS_BASE__PIXEL_FORMAT__BGR magic pixfmt constant.
this.pixfmt = this.util.make_pixel_format(repr: 0x4000_0888)
this.pixfmt = this.util.make_pixel_format(repr: 0x8000_0888)
} else if bits_per_pixel == 32 {
this.bits_per_pixel = 32
this.bytes_per_row = (this.width as base.u64) * 4
this.pad_per_row = 0
// TODO: a Wuffs (not just C) name for the
// WUFFS_BASE__PIXEL_FORMAT__BGRA_NONPREMUL magic pixfmt constant.
this.pixfmt = this.util.make_pixel_format(repr: 0x4500_8888)
this.pixfmt = this.util.make_pixel_format(repr: 0x8100_8888)
} else {
// TODO: support other bits_per_pixel's.
return "#unsupported BMP file"
@@ -181,7 +181,7 @@ pub func decoder.decode_image_config?(dst: nptr base.image_config, src: base.io_
// TODO: a Wuffs (not just C) name for the
// WUFFS_BASE__PIXEL_FORMAT__BGRA_NONPREMUL magic pixfmt constant.
args.dst.set!(
pixfmt: 0x4500_8888, // TODO: this.pixfmt instead?
pixfmt: 0x8100_8888, // TODO: this.pixfmt instead?
pixsub: 0,
width: this.width,
height: this.height,
+1 -1
View File
@@ -150,7 +150,7 @@ pub func config_decoder.decode_image_config?(dst: nptr base.image_config, src: b
// TODO: a Wuffs (not just C) name for the
// WUFFS_BASE__PIXEL_FORMAT__INDEXED__BGRA_BINARY magic pixfmt constant.
args.dst.set!(
pixfmt: 0x4704_0008,
pixfmt: 0x8304_0008,
pixsub: 0,
width: this.width,
height: this.height,
+2 -2
View File
@@ -189,7 +189,7 @@ pub func decoder.decode_image_config?(dst: nptr base.image_config, src: base.io_
// TODO: a Wuffs (not just C) name for the
// WUFFS_BASE__PIXEL_FORMAT__INDEXED__BGRA_BINARY magic pixfmt constant.
args.dst.set!(
pixfmt: 0x4704_0008,
pixfmt: 0x8304_0008,
pixsub: 0,
width: this.width,
height: this.height,
@@ -873,7 +873,7 @@ pri func decoder.decode_id_part1?(dst: ptr base.pixel_buffer, src: base.io_reade
status = this.swizzler.prepare!(
dst_pixfmt: args.dst.pixel_format(),
dst_palette: dst_palette,
src_pixfmt: this.util.make_pixel_format(repr: 0x4704_0008),
src_pixfmt: this.util.make_pixel_format(repr: 0x8304_0008),
src_palette: this.palettes[which_palette][..],
blend: args.blend)
if not status.is_ok() {
+2 -2
View File
@@ -85,7 +85,7 @@ pub func decoder.decode_image_config?(dst: nptr base.image_config, src: base.io_
// TODO: a Wuffs (not just C) name for the
// WUFFS_BASE__PIXEL_FORMAT__INDEXED__BGRA_BINARY magic pixfmt constant.
args.dst.set!(
pixfmt: 0x4704_0008,
pixfmt: 0x8304_0008,
pixsub: 0,
width: this.width,
height: this.height,
@@ -150,7 +150,7 @@ pub func decoder.decode_frame?(dst: ptr base.pixel_buffer, src: base.io_reader,
status = this.swizzler.prepare!(
dst_pixfmt: args.dst.pixel_format(),
dst_palette: args.dst.palette(),
src_pixfmt: this.util.make_pixel_format(repr: 0x1000_0008),
src_pixfmt: this.util.make_pixel_format(repr: 0x2000_0008),
src_palette: this.util.empty_slice_u8(),
blend: args.blend)
if not status.is_ok() {