mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-20 08:47:28 +01:00
Remove gif's previous_use_global_palette
This commit is contained in:
1 parent
132b54378c
commit
826b3e6c48
2 files changed
+8
-22
No files matched your search
@@ -2403,7 +2403,6 @@ typedef struct {
|
||||
uint8_t f_call_sequence;
|
||||
bool f_end_of_data;
|
||||
bool f_previous_lzw_decode_ended_abruptly;
|
||||
bool f_previous_use_global_palette;
|
||||
uint8_t f_local_palette_log2_size;
|
||||
uint8_t f_which_palette;
|
||||
uint8_t f_interlace;
|
||||
@@ -6539,14 +6538,9 @@ wuffs_gif__decoder__decode_frame_config(wuffs_gif__decoder* self,
|
||||
if ((self->private_impl.f_local_palette_log2_size != 0) ||
|
||||
self->private_impl.f_gc_has_transparent_index) {
|
||||
self->private_impl.f_which_palette = 1;
|
||||
} else if (!self->private_impl.f_previous_use_global_palette) {
|
||||
self->private_impl.f_which_palette = 0;
|
||||
} else {
|
||||
self->private_impl.f_which_palette = 2;
|
||||
self->private_impl.f_which_palette = 0;
|
||||
}
|
||||
self->private_impl.f_previous_use_global_palette =
|
||||
((self->private_impl.f_local_palette_log2_size == 0) &&
|
||||
!self->private_impl.f_gc_has_transparent_index);
|
||||
v_blend = 0;
|
||||
if (!self->private_impl.f_gc_has_transparent_index) {
|
||||
v_blend = 2;
|
||||
@@ -7999,10 +7993,10 @@ wuffs_gif__decoder__decode_id_part1(wuffs_gif__decoder* self,
|
||||
0;
|
||||
}
|
||||
wuffs_base__pixel_buffer__set_palette(
|
||||
a_dst,
|
||||
((wuffs_base__slice_u8){.ptr = self->private_impl.f_palettes[(
|
||||
self->private_impl.f_which_palette & 1)],
|
||||
.len = 1024}));
|
||||
a_dst, ((wuffs_base__slice_u8){
|
||||
.ptr = self->private_impl
|
||||
.f_palettes[self->private_impl.f_which_palette],
|
||||
.len = 1024}));
|
||||
if (self->private_impl.f_previous_lzw_decode_ended_abruptly) {
|
||||
(memset(&self->private_impl.f_lzw, 0, sizeof((wuffs_lzw__decoder){})),
|
||||
wuffs_base__ignore_check_wuffs_version_status(
|
||||
|
||||
@@ -74,11 +74,10 @@ pub struct decoder?(
|
||||
|
||||
end_of_data base.bool,
|
||||
previous_lzw_decode_ended_abruptly base.bool,
|
||||
previous_use_global_palette base.bool,
|
||||
|
||||
local_palette_log2_size base.u8[..8], // 0 means no local palette.
|
||||
|
||||
which_palette base.u8[..2],
|
||||
which_palette base.u8[..1],
|
||||
|
||||
// interlace indexes the interlace_start and interlace_delta arrays.
|
||||
interlace base.u8[..4],
|
||||
@@ -190,16 +189,9 @@ pub func decoder.decode_frame_config!??(dst nptr base.frame_config, src base.io_
|
||||
|
||||
if (this.local_palette_log2_size != 0) or this.gc_has_transparent_index {
|
||||
this.which_palette = 1
|
||||
} else if not this.previous_use_global_palette {
|
||||
// This frame uses the global palette but the previous one didn't.
|
||||
this.which_palette = 0
|
||||
} else {
|
||||
// Both this frame and the previous one used the global palette. No
|
||||
// palette update is necessary.
|
||||
this.which_palette = 2
|
||||
this.which_palette = 0
|
||||
}
|
||||
this.previous_use_global_palette =
|
||||
(this.local_palette_log2_size == 0) and not this.gc_has_transparent_index
|
||||
|
||||
var blend base.u8 = 0
|
||||
if not this.gc_has_transparent_index {
|
||||
@@ -559,7 +551,7 @@ 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)) + 2] = 0x00
|
||||
this.palettes[1][(4 * (this.gc_transparent_index as base.u32)) + 3] = 0x00
|
||||
}
|
||||
args.dst.set_palette!(palette:this.palettes[this.which_palette & 1][:])
|
||||
args.dst.set_palette!(palette:this.palettes[this.which_palette][:])
|
||||
|
||||
// Other GIF implementations accept GIF files that aren't completely spec
|
||||
// compliant. For example, the test/data/gifplayer-muybridge.gif file
|
||||
|
||||
Reference in new issue
Block a user