mirror of
https://github.com/SerenityOS/serenity.git
synced 2026-11-07 04:29:30 -10:00
LibPDF: Support setting pattern color spaces via a named resource
`/CS0 cs` in a form where the form has `/Resources<</ColorSpace<</CS0 [/Pattern]>>>>` now works. This happens e.g. in 2025-Laurenz-Thesis.pdf --page 34 (which has page number 29 written on it).
This commit is contained in:
1 parent
0c8a3d6cf7
commit
2ccde42476
2 files changed
+4
-4
No files matched your search
@@ -1844,12 +1844,12 @@ PDFErrorOr<NonnullRefPtr<ColorSpace>> Renderer::get_color_space_from_resources(V
|
||||
auto color_space_resource_dict = TRY(resources->get_dict(m_document, CommonNames::ColorSpace));
|
||||
if (!color_space_resource_dict->contains(color_space_name))
|
||||
return Error::malformed_error("ColorSpace resource dictionary does not contain {}", color_space_name);
|
||||
return get_color_space_from_document(TRY(color_space_resource_dict->get_object(m_document, color_space_name)));
|
||||
return get_color_space_from_document(TRY(color_space_resource_dict->get_object(m_document, color_space_name)), resources);
|
||||
}
|
||||
|
||||
PDFErrorOr<NonnullRefPtr<ColorSpace>> Renderer::get_color_space_from_document(NonnullRefPtr<Object> color_space_object)
|
||||
PDFErrorOr<NonnullRefPtr<ColorSpace>> Renderer::get_color_space_from_document(NonnullRefPtr<Object> color_space_object, Optional<NonnullRefPtr<DictObject>> resources)
|
||||
{
|
||||
return ColorSpace::create(m_document, color_space_object, *this);
|
||||
return ColorSpace::create(m_document, color_space_object, *this, resources);
|
||||
}
|
||||
|
||||
Gfx::AffineTransform const& Renderer::calculate_text_rendering_matrix() const
|
||||
|
||||
@@ -228,7 +228,7 @@ private:
|
||||
PDFErrorOr<void> paint_image_xobject(NonnullRefPtr<StreamObject>);
|
||||
void paint_empty_image(Gfx::IntSize);
|
||||
PDFErrorOr<NonnullRefPtr<ColorSpace>> get_color_space_from_resources(Value const&, NonnullRefPtr<DictObject>);
|
||||
PDFErrorOr<NonnullRefPtr<ColorSpace>> get_color_space_from_document(NonnullRefPtr<Object>);
|
||||
PDFErrorOr<NonnullRefPtr<ColorSpace>> get_color_space_from_document(NonnullRefPtr<Object>, Optional<NonnullRefPtr<DictObject>> = {});
|
||||
|
||||
static ColorOrStyle style_with_alpha(ColorOrStyle style, float alpha)
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user