mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-25 08:55:11 +01:00
Roll back 'dst_palette into the pixel_swizzler'
See the previous commit for the rationale.
This commit is contained in:
1 parent
2d8ec9ace9
commit
1239280ad8
9 files changed
+310
-236
No files matched your search
@@ -137,6 +137,8 @@ pub struct decoder? implements base.image_decoder(
|
||||
|
||||
// palettes[0] and palettes[1] are the Global and Local Color Table.
|
||||
palettes : array[2] array[4 * 256] base.u8,
|
||||
// dst_palette is the swizzled color table.
|
||||
dst_palette : array[4 * 256] base.u8,
|
||||
|
||||
lzw : lzw.decoder,
|
||||
//#WHEN PREPROC101 decode_config.wuffs
|
||||
@@ -819,6 +821,7 @@ pri func decoder.decode_id_part1?(dst: ptr base.pixel_buffer, src: base.io_reade
|
||||
var num_palette_entries : base.u32[..= 256]
|
||||
var i : base.u32
|
||||
var argb : base.u32
|
||||
var dst_palette : slice base.u8
|
||||
var status : base.status
|
||||
var lw : base.u8
|
||||
|
||||
@@ -870,11 +873,16 @@ pri func decoder.decode_id_part1?(dst: ptr base.pixel_buffer, src: base.io_reade
|
||||
this.palettes[1][(4 * (this.gc_transparent_index as base.u32)) + 3] = 0x00
|
||||
}
|
||||
|
||||
dst_palette = args.dst.palette()
|
||||
if dst_palette.length() == 0 {
|
||||
dst_palette = this.dst_palette[..]
|
||||
}
|
||||
|
||||
// TODO: a Wuffs (not just C) name for the
|
||||
// WUFFS_BASE__PIXEL_FORMAT__INDEXED__BGRA_BINARY magic pixfmt constant.
|
||||
status = this.swizzler.prepare!(
|
||||
dst_pixfmt: args.dst.pixel_format(),
|
||||
dst_palette: args.dst.palette(),
|
||||
dst_palette: dst_palette,
|
||||
src_pixfmt: this.util.make_pixel_format(repr: 0x8304_0008),
|
||||
src_palette: this.palettes[which_palette][..],
|
||||
blend: args.blend)
|
||||
@@ -1066,7 +1074,8 @@ pri func decoder.copy_to_image_buffer!(pb: ptr base.pixel_buffer, src: slice bas
|
||||
} else {
|
||||
dst = dst[i ..]
|
||||
}
|
||||
n = this.swizzler.swizzle_interleaved!(dst: dst, src: src)
|
||||
n = this.swizzler.swizzle_interleaved!(
|
||||
dst: dst, dst_palette: this.dst_palette[..], src: src)
|
||||
|
||||
src_ri ~sat+= n
|
||||
this.dst_x ~sat+= (n & 0xFFFF_FFFF) as base.u32
|
||||
|
||||
Reference in new issue
Block a user