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