mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 16:07:46 +00:00
LibPDF: Rename ColorSpaceFamily function to may_be_specified_directly()
It used to be called ColorSpaceFamily::never_needs_parameters(). But in the cpp file, the macro arg was called ever_needs_parameters, and the spec says "If the color space is one that can be specified by a name and no additional parameters (DeviceGray, DeviceRGB, DeviceCMYK, and certain cases of Pattern), the name may be specified directly." so let's use that language here. No behavior change.
This commit is contained in:
parent
095a2a17ed
commit
aea0e2f313
3 changed files with 11 additions and 11 deletions
|
@ -14,16 +14,16 @@ namespace PDF {
|
|||
|
||||
RefPtr<Gfx::ICC::Profile> ICCBasedColorSpace::s_srgb_profile;
|
||||
|
||||
#define ENUMERATE(name, ever_needs_parameters) \
|
||||
ColorSpaceFamily ColorSpaceFamily::name { #name, ever_needs_parameters };
|
||||
#define ENUMERATE(name, may_be_specified_directly) \
|
||||
ColorSpaceFamily ColorSpaceFamily::name { #name, may_be_specified_directly };
|
||||
ENUMERATE_COLOR_SPACE_FAMILIES(ENUMERATE);
|
||||
#undef ENUMERATE
|
||||
|
||||
PDFErrorOr<ColorSpaceFamily> ColorSpaceFamily::get(DeprecatedFlyString const& family_name)
|
||||
{
|
||||
#define ENUMERATE(f_name, ever_needs_parameters) \
|
||||
if (family_name == f_name.name()) { \
|
||||
return ColorSpaceFamily::f_name; \
|
||||
#define ENUMERATE(f_name, may_be_specified_directly) \
|
||||
if (family_name == f_name.name()) { \
|
||||
return ColorSpaceFamily::f_name; \
|
||||
}
|
||||
ENUMERATE_COLOR_SPACE_FAMILIES(ENUMERATE)
|
||||
#undef ENUMERATE
|
||||
|
|
|
@ -29,23 +29,23 @@ namespace PDF {
|
|||
|
||||
class ColorSpaceFamily {
|
||||
public:
|
||||
ColorSpaceFamily(DeprecatedFlyString name, bool never_needs_paramaters_p)
|
||||
ColorSpaceFamily(DeprecatedFlyString name, bool may_be_specified_directly)
|
||||
: m_name(move(name))
|
||||
, m_never_needs_parameters(never_needs_paramaters_p)
|
||||
, m_may_be_specified_directly(may_be_specified_directly)
|
||||
{
|
||||
}
|
||||
|
||||
DeprecatedFlyString name() const { return m_name; }
|
||||
bool never_needs_parameters() const { return m_never_needs_parameters; }
|
||||
bool may_be_specified_directly() const { return m_may_be_specified_directly; }
|
||||
static PDFErrorOr<ColorSpaceFamily> get(DeprecatedFlyString const&);
|
||||
|
||||
#define ENUMERATE(name, ever_needs_parameters) static ColorSpaceFamily name;
|
||||
#define ENUMERATE(name, may_be_specified_directly) static ColorSpaceFamily name;
|
||||
ENUMERATE_COLOR_SPACE_FAMILIES(ENUMERATE)
|
||||
#undef ENUMERATE
|
||||
|
||||
private:
|
||||
DeprecatedFlyString m_name;
|
||||
bool m_never_needs_parameters;
|
||||
bool m_may_be_specified_directly;
|
||||
};
|
||||
|
||||
class ColorSpace : public RefCounted<ColorSpace> {
|
||||
|
|
|
@ -958,7 +958,7 @@ PDFErrorOr<NonnullRefPtr<ColorSpace>> Renderer::get_color_space_from_resources(V
|
|||
auto maybe_color_space_family = ColorSpaceFamily::get(color_space_name);
|
||||
if (!maybe_color_space_family.is_error()) {
|
||||
auto color_space_family = maybe_color_space_family.release_value();
|
||||
if (color_space_family.never_needs_parameters()) {
|
||||
if (color_space_family.may_be_specified_directly()) {
|
||||
return ColorSpace::create(color_space_name);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue