softproof not working when no printer profile is set (no sRGB preview on wide gamut screens), fixes #5143

This commit is contained in:
heckflosse
2019-01-19 19:22:45 +01:00
parent 36ca01616b
commit 3fc7c25965

View File

@@ -338,14 +338,39 @@ void ImProcFunctions::updateColorProfiles (const Glib::ustring& monitorProfile,
// flags |= cmsFLAGS_GAMUTCHECK;
// }
const auto make_gamma_table =
[](cmsHPROFILE prof, cmsTagSignature tag) -> void
{
cmsToneCurve *tc = static_cast<cmsToneCurve *>(cmsReadTag(prof, tag));
if (tc) {
const cmsUInt16Number *table = cmsGetToneCurveEstimatedTable(tc);
cmsToneCurve *tc16 = cmsBuildTabulatedToneCurve16(nullptr, cmsGetToneCurveEstimatedTableEntries(tc), table);
if (tc16) {
cmsWriteTag(prof, tag, tc16);
cmsFreeToneCurve(tc16);
}
}
};
cmsHPROFILE softproof = ProfileContent(oprof).toProfile();
if (softproof) {
make_gamma_table(softproof, cmsSigRedTRCTag);
make_gamma_table(softproof, cmsSigGreenTRCTag);
make_gamma_table(softproof, cmsSigBlueTRCTag);
}
monitorTransform = cmsCreateProofingTransform (
iprof, TYPE_Lab_FLT,
monitor, TYPE_RGB_FLT,
oprof,
softproof, //oprof,
monitorIntent, outIntent,
flags
);
if (softproof) {
cmsCloseProfile(softproof);
}
if (monitorTransform) {
softProofCreated = true;
}