1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 05:27:43 +00:00

LibPDF: Remember inline image stream bytes

We still don't process inline images, but now we have the pieces we need
for doing it (`map` and `stream_bytes`).
This commit is contained in:
Nico Weber 2023-12-10 10:44:25 -05:00 committed by Andreas Kling
parent cabc6a9d80
commit 11354dbf9e

View file

@ -560,6 +560,7 @@ PDFErrorOr<Vector<Operator>> Parser::parse_operators()
m_reader.consume(1);
// FIMXE: PDF 2.0 added support for `/L` / `/Length` in inline image dicts. If that's present, we don't have to scan for `EI`.
auto stream_start = m_reader.offset();
while (!m_reader.done()) {
// FIXME: Should we allow EI after matches_delimiter() too?
bool expecting_ei = m_reader.matches_whitespace();
@ -572,11 +573,17 @@ PDFErrorOr<Vector<Operator>> Parser::parse_operators()
if (m_reader.done())
return error("operator stream ended inside inline image");
// Points one past the end of the stream data.
// FIXME: If we add matches_delimiter() to expecting_ei above, this has to be 1 larger in the delimiter case.
auto stream_end = m_reader.offset();
m_reader.consume(2); // "EI"
m_reader.consume_whitespace();
auto stream_bytes = m_reader.bytes().slice(stream_start, stream_end - stream_start);
// FIXME: Do more with inline images than just skipping them.
(void)map;
(void)stream_bytes;
}
operators.append(Operator(operator_type, move(operator_args)));