mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:37:37 +00:00
LibPDF: Detect DCT images correctly
Images can have multiple filters, each one of them is processed sequentially. Only the last one will be relevant for the image format (DCT or JPXDecode), so use the last filter instead of the first one to detect that property.
This commit is contained in:
parent
f882a3ae37
commit
9e4d697d23
1 changed files with 2 additions and 1 deletions
|
@ -830,7 +830,8 @@ PDFErrorOr<NonnullRefPtr<Gfx::Bitmap>> Renderer::load_image(NonnullRefPtr<Stream
|
|||
if (filter_object->is<NameObject>())
|
||||
return filter_object->cast<NameObject>()->name() == name;
|
||||
auto filters = filter_object->cast<ArrayObject>();
|
||||
return MUST(filters->get_name_at(m_document, 0))->name() == name;
|
||||
auto last_filter_index = filters->elements().size() - 1;
|
||||
return MUST(filters->get_name_at(m_document, last_filter_index))->name() == name;
|
||||
};
|
||||
if (TRY(is_filter(CommonNames::JPXDecode))) {
|
||||
return Error(Error::Type::RenderingUnsupported, "JPXDecode filter");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue