diff --git a/Userland/Libraries/LibPDF/ColorSpace.cpp b/Userland/Libraries/LibPDF/ColorSpace.cpp index b3903527300..2596c49f2fe 100644 --- a/Userland/Libraries/LibPDF/ColorSpace.cpp +++ b/Userland/Libraries/LibPDF/ColorSpace.cpp @@ -621,7 +621,7 @@ PDFErrorOr> IndexedColorSpace::create(Document* docume auto base_object = param0.get>(); auto base = TRY(ColorSpace::create(document, base_object)); - if (base->family().name() == ColorSpaceFamily::Pattern.name() || base->family().name() == ColorSpaceFamily::Indexed.name()) + if (base->family() == ColorSpaceFamily::Pattern || base->family() == ColorSpaceFamily::Indexed) return Error { Error::Type::MalformedPDF, "Indexed color space has invalid base color space" }; // "The hival parameter is an integer that specifies the maximum valid index value. In other words, @@ -713,7 +713,7 @@ PDFErrorOr> SeparationColorSpace::create(Doc auto alternate_space = TRY(ColorSpace::create(document, alternate_space_object)); auto family = alternate_space->family(); - if (family.name() == ColorSpaceFamily::Pattern.name() || family.name() == ColorSpaceFamily::Indexed.name() || family.name() == ColorSpaceFamily::Separation.name() || family.name() == ColorSpaceFamily::DeviceN.name()) + if (family == ColorSpaceFamily::Pattern || family == ColorSpaceFamily::Indexed || family == ColorSpaceFamily::Separation || family == ColorSpaceFamily::DeviceN) return Error { Error::Type::MalformedPDF, "Separation color space has invalid alternate color space" }; // "The tintTransform parameter must be a function" diff --git a/Userland/Libraries/LibPDF/ColorSpace.h b/Userland/Libraries/LibPDF/ColorSpace.h index 200b0c8266d..3dac8d3a9c2 100644 --- a/Userland/Libraries/LibPDF/ColorSpace.h +++ b/Userland/Libraries/LibPDF/ColorSpace.h @@ -44,6 +44,11 @@ public: ENUMERATE_COLOR_SPACE_FAMILIES(ENUMERATE) #undef ENUMERATE + bool operator==(ColorSpaceFamily const& other) const + { + return m_name == other.m_name; + } + private: DeprecatedFlyString m_name; bool m_may_be_specified_directly;