Calculate strip field size once

This commit is contained in:
Abdelrahman Said 2024-05-04 22:47:23 +01:00
parent c98802542d
commit b546ce9fa7

View File

@ -327,11 +327,14 @@ bool read_strip_data(TiffReader *reader, Arena *arena) {
return false; return false;
} }
u16 offset_size = reader->img.strip_offsets_type_byte_count;
u16 counts_size = reader->img.strip_byte_count_type_byte_count;
for (u32 i = 0; i < reader->img.strip_count; ++i) { for (u32 i = 0; i < reader->img.strip_count; ++i) {
TiffStrip *strip = &(reader->img.strips[i]); TiffStrip *strip = &(reader->img.strips[i]);
u16 offset_size = reader->img.strip_offsets_type_byte_count; // read_strip_field(reader, &(strip->offset), &(reader->img.strip_offsets),
u16 counts_size = reader->img.strip_byte_count_type_byte_count; // i, offsets_total_bytes, offset_size);
if (offsets_total_bytes > sizeof(u32)) { if (offsets_total_bytes > sizeof(u32)) {
u32 offset = reader->img.strip_offsets.long_val + offset_size * i; u32 offset = reader->img.strip_offsets.long_val + offset_size * i;