softproof not working when no printer profile is set (no sRGB preview on wide gamut screens), fixes #5143
This commit is contained in:
@@ -338,14 +338,39 @@ void ImProcFunctions::updateColorProfiles (const Glib::ustring& monitorProfile,
|
|||||||
// flags |= cmsFLAGS_GAMUTCHECK;
|
// 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 (
|
monitorTransform = cmsCreateProofingTransform (
|
||||||
iprof, TYPE_Lab_FLT,
|
iprof, TYPE_Lab_FLT,
|
||||||
monitor, TYPE_RGB_FLT,
|
monitor, TYPE_RGB_FLT,
|
||||||
oprof,
|
softproof, //oprof,
|
||||||
monitorIntent, outIntent,
|
monitorIntent, outIntent,
|
||||||
flags
|
flags
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (softproof) {
|
||||||
|
cmsCloseProfile(softproof);
|
||||||
|
}
|
||||||
|
|
||||||
if (monitorTransform) {
|
if (monitorTransform) {
|
||||||
softProofCreated = true;
|
softProofCreated = true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user