mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-22 09:19:03 +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:
@@ -830,7 +830,8 @@ PDFErrorOr<NonnullRefPtr<Gfx::Bitmap>> Renderer::load_image(NonnullRefPtr<Stream
|
|||||||
if (filter_object->is<NameObject>())
|
if (filter_object->is<NameObject>())
|
||||||
return filter_object->cast<NameObject>()->name() == name;
|
return filter_object->cast<NameObject>()->name() == name;
|
||||||
auto filters = filter_object->cast<ArrayObject>();
|
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))) {
|
if (TRY(is_filter(CommonNames::JPXDecode))) {
|
||||||
return Error(Error::Type::RenderingUnsupported, "JPXDecode filter");
|
return Error(Error::Type::RenderingUnsupported, "JPXDecode filter");
|
||||||
|
|||||||
Reference in New Issue
Block a user