From 311cc7d9b9c26b188d3fb4f37719894a0282e147 Mon Sep 17 00:00:00 2001 From: Nico Weber Date: Tue, 24 Oct 2023 10:39:58 -0700 Subject: [PATCH] LibPDF: Implement two SeparationColorSpace methods Actually using separation color spaces still doesn't work, but we now no longer assert on them when they're used. Fixes 2 crashes on the `-n 500` 0000.zip pdfa dataset. --- Userland/Libraries/LibPDF/ColorSpace.cpp | 3 +-- Userland/Libraries/LibPDF/ColorSpace.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibPDF/ColorSpace.cpp b/Userland/Libraries/LibPDF/ColorSpace.cpp index 0afb4230cfe..6aec21a83a1 100644 --- a/Userland/Libraries/LibPDF/ColorSpace.cpp +++ b/Userland/Libraries/LibPDF/ColorSpace.cpp @@ -396,8 +396,7 @@ PDFErrorOr SeparationColorSpace::color(ReadonlySpan) const Vector SeparationColorSpace::default_decode() const { - warnln("PDF: TODO implement SeparationColorSpace::default_decode()"); - return {}; + return { 0.0f, 1.0f }; } } diff --git a/Userland/Libraries/LibPDF/ColorSpace.h b/Userland/Libraries/LibPDF/ColorSpace.h index 81f6631ec26..bc4a6064be8 100644 --- a/Userland/Libraries/LibPDF/ColorSpace.h +++ b/Userland/Libraries/LibPDF/ColorSpace.h @@ -151,7 +151,7 @@ public: ~SeparationColorSpace() override = default; PDFErrorOr color(ReadonlySpan arguments) const override; - int number_of_components() const override { TODO(); } + int number_of_components() const override { return 1; } Vector default_decode() const override; ColorSpaceFamily const& family() const override { return ColorSpaceFamily::Separation; }