mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 15:07:45 +00:00
LibGfx/TIFF: Explore underlying Image File Directories
Every TIFF containers is composed of a main IFD. Some entries of this one can be a pointer to a sub-IFD. We are now capable of exploring these underlying structures. Note that we don't do anything with them yet.
This commit is contained in:
parent
4a7236cabf
commit
a43793ee0d
2 changed files with 19 additions and 4 deletions
|
@ -453,7 +453,6 @@ private:
|
|||
m_next_ifd = Optional<u32> { next_block_position };
|
||||
else
|
||||
m_next_ifd = OptionalNone {};
|
||||
dbgln_if(TIFF_DEBUG, "Setting image file directory pointer to {}", m_next_ifd);
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -491,6 +490,8 @@ private:
|
|||
if (!m_next_ifd.has_value())
|
||||
return Error::from_string_literal("TIFFImageDecoderPlugin: Missing an Image File Directory");
|
||||
|
||||
dbgln_if(TIFF_DEBUG, "Reading image file directory at offset {}", m_next_ifd);
|
||||
|
||||
TRY(m_stream->seek(m_next_ifd.value()));
|
||||
|
||||
auto const number_of_field = TRY(read_value<u16>());
|
||||
|
@ -597,7 +598,13 @@ private:
|
|||
return read_tiff_value(type, count, offset);
|
||||
}()));
|
||||
|
||||
TRY(handle_tag(m_metadata, tag, type, count, move(tiff_value)));
|
||||
auto subifd_handler = [&](u32 ifd_offset) -> ErrorOr<void> {
|
||||
m_next_ifd = ifd_offset;
|
||||
TRY(read_next_image_file_directory());
|
||||
return {};
|
||||
};
|
||||
|
||||
TRY(handle_tag(move(subifd_handler), m_metadata, tag, type, count, move(tiff_value)));
|
||||
|
||||
return {};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue