Re-org gif's which_palette determination

This commit is contained in:
Nigel Tao committed 2018-08-26 17:30:36 +10:00
1 parent 826b3e6c48
commit 0066d6ac9b
2 files changed
+12 -12

No files matched your search

+6 -6
View File
@@ -6535,12 +6535,6 @@ wuffs_gif__decoder__decode_frame_config(wuffs_gif__decoder* self,
WUFFS_BASE__COROUTINE_SUSPENSION_POINT_MAYBE_SUSPEND(4);
}
}
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 {
self->private_impl.f_which_palette = 0;
}
v_blend = 0;
if (!self->private_impl.f_gc_has_transparent_index) {
v_blend = 2;
@@ -7992,6 +7986,12 @@ wuffs_gif__decoder__decode_id_part1(wuffs_gif__decoder* self,
(4 * ((uint32_t)(self->private_impl.f_gc_transparent_index))) + 3)] =
0;
}
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 {
self->private_impl.f_which_palette = 0;
}
wuffs_base__pixel_buffer__set_palette(
a_dst, ((wuffs_base__slice_u8){
.ptr = self->private_impl
+6 -6
View File
@@ -187,12 +187,6 @@ 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 {
this.which_palette = 0
}
var blend base.u8 = 0
if not this.gc_has_transparent_index {
blend = 2 // 2 is WUFFS_BASE__ANIMATION_BLEND__OPAQUE.
@@ -551,6 +545,12 @@ 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
}
if (this.local_palette_log2_size != 0) or this.gc_has_transparent_index {
this.which_palette = 1
} else {
this.which_palette = 0
}
args.dst.set_palette!(palette:this.palettes[this.which_palette][:])
// Other GIF implementations accept GIF files that aren't completely spec