diff --git a/autotests/test_colorspaces.cpp b/autotests/test_colorspaces.cpp index cc7333bc9d..b8f26664c2 100644 --- a/autotests/test_colorspaces.cpp +++ b/autotests/test_colorspaces.cpp @@ -225,7 +225,7 @@ void TestColorspaces::testOpenglShader_data() QTest::addColumn("maxError"); // the allowed error here needs to be this high because of llvmpipe. With real GPU drivers it's lower - QTest::addRow("Perceptual") << RenderingIntent::Perceptual << 6.5; + QTest::addRow("Perceptual") << RenderingIntent::Perceptual << 7.0; QTest::addRow("RelativeColorimetric") << RenderingIntent::RelativeColorimetric << 1.5; QTest::addRow("AbsoluteColorimetric") << RenderingIntent::AbsoluteColorimetric << 1.5; QTest::addRow("RelativeColorimetricWithBPC") << RenderingIntent::RelativeColorimetricWithBPC << 1.5; diff --git a/src/core/colorspace.cpp b/src/core/colorspace.cpp index 43c4495481..b583b68857 100644 --- a/src/core/colorspace.cpp +++ b/src/core/colorspace.cpp @@ -461,11 +461,14 @@ QMatrix4x4 ColorDescription::toOther(const ColorDescription &other, RenderingInt // add black point compensation: black and reference white from the source color space // should both be mapped to black and reference white in the destination color space + const double effectiveMin = std::max(minLuminance(), m_transferFunction.minLuminance); + const double otherEffectiveMin = std::max(other.minLuminance(), other.m_transferFunction.minLuminance); + // before color conversions, map [src min, src ref] to [0, 1] luminanceBefore.scale(1.0 / (reference - minLuminance())); - luminanceBefore.translate(-minLuminance(), -minLuminance(), -minLuminance()); + luminanceBefore.translate(-effectiveMin, -effectiveMin, -effectiveMin); // afterwards, map [0, 1] again to [dst min, dst ref] - luminanceAfter.translate(other.minLuminance(), other.minLuminance(), other.minLuminance()); + luminanceAfter.translate(otherEffectiveMin, otherEffectiveMin, otherEffectiveMin); luminanceAfter.scale(other.referenceLuminance() - other.minLuminance()); } else { // map only the reference luminance