mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-18 00:32:11 +01:00
Split std/gif effectful expressions
This commit is contained in:
1 parent
d84d72ce27
commit
341c5f3770
2 files changed
+29
-16
No files matched your search
@@ -8150,8 +8150,9 @@ wuffs_gif__decoder__decode_lsd(wuffs_gif__decoder* self,
|
||||
*scratch |= ((uint64_t)(t_5));
|
||||
}
|
||||
}
|
||||
v_argb = (t_6 | 4278190080);
|
||||
v_argb = t_6;
|
||||
}
|
||||
v_argb |= 4278190080;
|
||||
self->private_impl.f_palettes[0][((4 * v_i) + 0)] =
|
||||
((uint8_t)(((v_argb >> 0) & 255)));
|
||||
self->private_impl.f_palettes[0][((4 * v_i) + 1)] =
|
||||
@@ -8610,6 +8611,7 @@ wuffs_gif__decoder__decode_gc(wuffs_gif__decoder* self,
|
||||
|
||||
uint8_t v_c;
|
||||
uint8_t v_flags;
|
||||
uint16_t v_gc_duration_centiseconds;
|
||||
|
||||
uint8_t* iop_a_src = NULL;
|
||||
uint8_t* io0_a_src = NULL;
|
||||
@@ -8632,6 +8634,7 @@ wuffs_gif__decoder__decode_gc(wuffs_gif__decoder* self,
|
||||
if (coro_susp_point) {
|
||||
v_c = 0;
|
||||
v_flags = 0;
|
||||
v_gc_duration_centiseconds = 0;
|
||||
} else {
|
||||
}
|
||||
switch (coro_susp_point) {
|
||||
@@ -8674,7 +8677,7 @@ wuffs_gif__decoder__decode_gc(wuffs_gif__decoder* self,
|
||||
}
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(3);
|
||||
uint64_t t_3;
|
||||
uint16_t t_3;
|
||||
if (WUFFS_BASE__LIKELY(io1_a_src - iop_a_src >= 2)) {
|
||||
t_3 = wuffs_base__load_u16le(iop_a_src);
|
||||
iop_a_src += 2;
|
||||
@@ -8699,8 +8702,10 @@ wuffs_gif__decoder__decode_gc(wuffs_gif__decoder* self,
|
||||
*scratch |= ((uint64_t)(t_2)) << 56;
|
||||
}
|
||||
}
|
||||
self->private_impl.f_gc_duration = (t_3 * 7056000);
|
||||
v_gc_duration_centiseconds = t_3;
|
||||
}
|
||||
self->private_impl.f_gc_duration =
|
||||
(((uint64_t)(v_gc_duration_centiseconds)) * 7056000);
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(5);
|
||||
if (WUFFS_BASE__UNLIKELY(iop_a_src == io1_a_src)) {
|
||||
@@ -8862,9 +8867,9 @@ wuffs_gif__decoder__decode_id_part0(wuffs_gif__decoder* self,
|
||||
*scratch |= ((uint64_t)(t_4)) << 56;
|
||||
}
|
||||
}
|
||||
self->private_impl.f_frame_rect_x1 =
|
||||
(self->private_impl.f_frame_rect_x0 + t_5);
|
||||
self->private_impl.f_frame_rect_x1 = t_5;
|
||||
}
|
||||
self->private_impl.f_frame_rect_x1 += self->private_impl.f_frame_rect_x0;
|
||||
{
|
||||
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(7);
|
||||
uint32_t t_7;
|
||||
@@ -8892,9 +8897,9 @@ wuffs_gif__decoder__decode_id_part0(wuffs_gif__decoder* self,
|
||||
*scratch |= ((uint64_t)(t_6)) << 56;
|
||||
}
|
||||
}
|
||||
self->private_impl.f_frame_rect_y1 =
|
||||
(self->private_impl.f_frame_rect_y0 + t_7);
|
||||
self->private_impl.f_frame_rect_y1 = t_7;
|
||||
}
|
||||
self->private_impl.f_frame_rect_y1 += self->private_impl.f_frame_rect_y0;
|
||||
self->private_impl.f_dst_x = self->private_impl.f_frame_rect_x0;
|
||||
self->private_impl.f_dst_y = self->private_impl.f_frame_rect_y0;
|
||||
if (self->private_impl.f_call_sequence == 0) {
|
||||
@@ -9029,8 +9034,9 @@ wuffs_gif__decoder__decode_id_part1(wuffs_gif__decoder* self,
|
||||
*scratch |= ((uint64_t)(t_1));
|
||||
}
|
||||
}
|
||||
v_argb = (t_2 | 4278190080);
|
||||
v_argb = t_2;
|
||||
}
|
||||
v_argb |= 4278190080;
|
||||
self->private_impl.f_palettes[1][((4 * v_i) + 0)] =
|
||||
((uint8_t)(((v_argb >> 0) & 255)));
|
||||
self->private_impl.f_palettes[1][((4 * v_i) + 1)] =
|
||||
@@ -9246,6 +9252,7 @@ wuffs_gif__decoder__copy_to_image_buffer(wuffs_gif__decoder* self,
|
||||
uint32_t v_n;
|
||||
uint32_t v_new_ri;
|
||||
wuffs_base__table_u8 v_tab;
|
||||
uint64_t v_n64;
|
||||
|
||||
v_dst = ((wuffs_base__slice_u8){});
|
||||
v_src = ((wuffs_base__slice_u8){});
|
||||
@@ -9279,8 +9286,8 @@ label_0_continue:;
|
||||
v_dst = wuffs_base__slice_u8__subslice_i(
|
||||
v_dst, ((uint64_t)(self->private_impl.f_dst_x)));
|
||||
}
|
||||
v_n = ((uint32_t)(
|
||||
(wuffs_base__slice_u8__copy_from_slice(v_dst, v_src) & 4294967295)));
|
||||
v_n64 = wuffs_base__slice_u8__copy_from_slice(v_dst, v_src);
|
||||
v_n = ((uint32_t)((v_n64 & 4294967295)));
|
||||
v_new_ri =
|
||||
wuffs_base__u32__sat_add(self->private_impl.f_uncompressed_ri, v_n);
|
||||
self->private_impl.f_uncompressed_ri =
|
||||
|
||||
@@ -336,7 +336,8 @@ pri func decoder.decode_lsd!??(src base.io_reader) {
|
||||
assert i < 256 via "a < b: a < c; c <= b"(c:num_palette_entries)
|
||||
// Convert from RGB (in memory order) to ARGB (in native u32 order)
|
||||
// to BGRA (in memory order).
|
||||
var argb base.u32 = args.src.read_u24be_as_u32!??() | 0xFF000000
|
||||
var argb base.u32 = args.src.read_u24be_as_u32!??()
|
||||
argb |= 0xFF000000
|
||||
this.palettes[0][(4 * i) + 0] = ((argb >> 0) & 0xFF) as base.u8
|
||||
this.palettes[0][(4 * i) + 1] = ((argb >> 8) & 0xFF) as base.u8
|
||||
this.palettes[0][(4 * i) + 2] = ((argb >> 16) & 0xFF) as base.u8
|
||||
@@ -494,7 +495,8 @@ pri func decoder.decode_gc!??(src base.io_reader) {
|
||||
}
|
||||
|
||||
// There are 7056000 flicks per centisecond.
|
||||
this.gc_duration = args.src.read_u16le_as_u64!??() * 7056000
|
||||
var gc_duration_centiseconds base.u16 = args.src.read_u16le!??()
|
||||
this.gc_duration = (gc_duration_centiseconds as base.u64) * 7056000
|
||||
this.gc_transparent_index = args.src.read_u8!??()
|
||||
|
||||
c = args.src.read_u8!??()
|
||||
@@ -515,8 +517,10 @@ pri func decoder.decode_gc!??(src base.io_reader) {
|
||||
pri func decoder.decode_id_part0!??(src base.io_reader) {
|
||||
this.frame_rect_x0 = args.src.read_u16le_as_u32!??()
|
||||
this.frame_rect_y0 = args.src.read_u16le_as_u32!??()
|
||||
this.frame_rect_x1 = this.frame_rect_x0 ~mod+ args.src.read_u16le_as_u32!??()
|
||||
this.frame_rect_y1 = this.frame_rect_y0 ~mod+ args.src.read_u16le_as_u32!??()
|
||||
this.frame_rect_x1 = args.src.read_u16le_as_u32!??()
|
||||
this.frame_rect_x1 ~mod+= this.frame_rect_x0
|
||||
this.frame_rect_y1 = args.src.read_u16le_as_u32!??()
|
||||
this.frame_rect_y1 ~mod+= this.frame_rect_y0
|
||||
this.dst_x = this.frame_rect_x0
|
||||
this.dst_y = this.frame_rect_y0
|
||||
|
||||
@@ -548,7 +552,8 @@ pri func decoder.decode_id_part1!??(dst ptr base.pixel_buffer, src base.io_reade
|
||||
assert i < 256 via "a < b: a < c; c <= b"(c:num_palette_entries)
|
||||
// Convert from RGB (in memory order) to ARGB (in native u32 order)
|
||||
// to BGRA (in memory order).
|
||||
var argb base.u32 = args.src.read_u24be_as_u32!??() | 0xFF000000
|
||||
var argb base.u32 = args.src.read_u24be_as_u32!??()
|
||||
argb |= 0xFF000000
|
||||
this.palettes[1][(4 * i) + 0] = ((argb >> 0) & 0xFF) as base.u8
|
||||
this.palettes[1][(4 * i) + 1] = ((argb >> 8) & 0xFF) as base.u8
|
||||
this.palettes[1][(4 * i) + 2] = ((argb >> 16) & 0xFF) as base.u8
|
||||
@@ -691,7 +696,8 @@ pri func decoder.copy_to_image_buffer!?(pb ptr base.pixel_buffer) {
|
||||
} else {
|
||||
dst = dst[this.dst_x as base.u64:]
|
||||
}
|
||||
n = (dst.copy_from_slice!(s:src) & 0xFFFFFFFF) as base.u32
|
||||
var n64 base.u64 = dst.copy_from_slice!(s:src)
|
||||
n = (n64 & 0xFFFFFFFF) as base.u32
|
||||
|
||||
new_ri = this.uncompressed_ri ~sat+ n
|
||||
this.uncompressed_ri = new_ri.min(x:4096)
|
||||
|
||||
Reference in new issue
Block a user