From c8a7ea37b2320c85c17750cd691b6e2190a7592c Mon Sep 17 00:00:00 2001 From: Libor Pechacek Date: Fri, 28 Jun 2024 23:56:02 +0200 Subject: [PATCH] OcdFileImport: Reliably detect Registration black Mapper is unable to detect Registration black in absence of spot colors. This patch fixes the defect, loosens the name matching criterion and aligns the matching criteria along the supported OCD format versions. --- src/fileformats/ocd_file_import.cpp | 12 ++++++------ test/file_format_t.cpp | 5 ----- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/src/fileformats/ocd_file_import.cpp b/src/fileformats/ocd_file_import.cpp index 83418dbb9..0c9729981 100644 --- a/src/fileformats/ocd_file_import.cpp +++ b/src/fileformats/ocd_file_import.cpp @@ -503,12 +503,12 @@ void OcdFileImport::importColors(const OcdFile& file) } color->setKnockout(color_info.overprint != 0); - if ((i == 0 && color->isBlack() && color->getName() == QLatin1String("Registration black")) - || (!components.empty() && components.size() == num_separations - && color_info.cmyk.cyan == 200 + if ((color->isBlack() && color->getName().startsWith(QLatin1String("Registration black"))) + || (color_info.cmyk.cyan == 200 && color_info.cmyk.magenta == 200 && color_info.cmyk.yellow == 200 && color_info.cmyk.black == 200 + && components.size() == num_separations && std::all_of(color_info.separations, color_info.separations + num_separations, [](const auto& s) { return s == 200; }) ) ) { @@ -710,12 +710,12 @@ void OcdFileImport::importColor(const QString& param_string) if (!number_ok) return; - if ((cmyk.isBlack() && name == QLatin1String("Registration black")) - || (!components.empty() && components.size() == spot_colors.size() - && qFuzzyCompare(cmyk.c, 1) + if ((cmyk.isBlack() && name.startsWith(QLatin1String("Registration black"))) + || (qFuzzyCompare(cmyk.c, 1) && qFuzzyCompare(cmyk.m, 1) && qFuzzyCompare(cmyk.y, 1) && qFuzzyCompare(cmyk.k, 1) + && components.size() == spot_colors.size() && std::all_of(begin(components), end(components), [](const auto& c) { return qFuzzyCompare(c.factor, 1); }) ) ) { diff --git a/test/file_format_t.cpp b/test/file_format_t.cpp index 2563ab6fe..e178fb44d 100644 --- a/test/file_format_t.cpp +++ b/test/file_format_t.cpp @@ -1412,11 +1412,6 @@ void FileFormatTest::colorTest() // the target file format. for (auto i = 0; i < original->getNumColorPrios(); ++i) { - // >>>>>>>>> Temporary handling of OCD defects - if (*format_id == 'O' && i == 0 && original->getColorByPrio(0)->getName() != copy->getColorByPrio(0)->getName()) - QEXPECT_FAIL("", "Registration black is not properly detected in absence of spot colors", Continue); - // <<<<<<<<< Temporary handling of OCD defects - // Gratiously handle missing v8 features (opacity, limited name // length, CMYK color resolution). auto* color_in_original = original->getColorByPrio(i);