1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 23:48:11 +00:00

LibPDF: Move color space creation from name or array into ColorSpace

No behavior change.
This commit is contained in:
Nico Weber 2023-11-03 01:44:18 -04:00 committed by Andrew Kaster
parent 1dfd49ef99
commit 3dca11c4e2
3 changed files with 15 additions and 10 deletions

View file

@ -980,16 +980,7 @@ PDFErrorOr<NonnullRefPtr<ColorSpace>> Renderer::get_color_space_from_resources(V
PDFErrorOr<NonnullRefPtr<ColorSpace>> Renderer::get_color_space_from_document(NonnullRefPtr<Object> color_space_object)
{
// "A color space is defined by an array object whose first element is a name object identifying the color space family.
// The remaining array elements, if any, are parameters that further characterize the color space;
// their number and types vary according to the particular family.
// For families that do not require parameters, the color space can be specified simply by the family name itself instead of an array."
// Pattern cannot be a name in these cases
if (color_space_object->is<NameObject>()) {
return ColorSpace::create(color_space_object->cast<NameObject>()->name());
}
return ColorSpace::create(m_document, color_space_object->cast<ArrayObject>());
return ColorSpace::create(m_document, color_space_object);
}
Gfx::AffineTransform const& Renderer::calculate_text_rendering_matrix()