Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
Avoid crash when no TRC is present, but colorants are.
Wolthera van Hövell tot Westerflier03bf3ea9bf51
diff --git a/plugins/color/lcms2engine/colorprofiles/LcmsColorProfileContainer.cpp b/plugins/color/lcms2engine/colorprofiles/LcmsColorProfileContainer.cppindex 175a9e1bc0..5a53f39c41 100644--- a/plugins/color/lcms2engine/colorprofiles/LcmsColorProfileContainer.cpp+++ b/plugins/color/lcms2engine/colorprofiles/LcmsColorProfileContainer.cpp@@ -476,7 +476,7 @@ QVector <double> LcmsColorProfileContainer::getWhitePointxyY() constQVector <double> LcmsColorProfileContainer::getEstimatedTRC() const{QVector <double> TRCtriplet(3);- if (d->hasColorants) {+ if (d->hasColorants && hasTRC()) {if (cmsIsToneCurveLinear(d->redTRC)) {TRCtriplet[0] = 1.0;} else {@@ -509,7 +509,7 @@ QVector <double> LcmsColorProfileContainer::getEstimatedTRC() constvoid LcmsColorProfileContainer::LinearizeFloatValue(QVector <double> & Value) const{- if (d->hasColorants) {+ if (d->hasColorants && hasTRC()) {if (!cmsIsToneCurveLinear(d->redTRC)) {Value[0] = cmsEvalToneCurveFloat(d->redTRC, Value[0]);}@@ -529,7 +529,7 @@ void LcmsColorProfileContainer::LinearizeFloatValue(QVector <double> & Value) covoid LcmsColorProfileContainer::DelinearizeFloatValue(QVector <double> & Value) const{- if (d->hasColorants) {+ if (d->hasColorants && hasTRC()) {if (!cmsIsToneCurveLinear(d->redTRC)) {Value[0] = cmsEvalToneCurveFloat(*d->redTRCReverse, Value[0]);}@@ -552,7 +552,7 @@ void LcmsColorProfileContainer::LinearizeFloatValueFast(QVector <double> & Valueconst qreal scale = 65535.0;const qreal invScale = 1.0 / scale;- if (d->hasColorants) {+ if (d->hasColorants && hasTRC()) {//we can only reliably delinearise in the 0-1.0 range, outside of that leave the value alone.if (!cmsIsToneCurveLinear(d->redTRC) && Value[0]<1.0) {@@ -579,7 +579,7 @@ void LcmsColorProfileContainer::DelinearizeFloatValueFast(QVector <double> & Valconst qreal scale = 65535.0;const qreal invScale = 1.0 / scale;- if (d->hasColorants) {+ if (d->hasColorants && hasTRC()) {//we can only reliably delinearise in the 0-1.0 range, outside of that leave the value alone.if (!cmsIsToneCurveLinear(d->redTRC) && Value[0]<1.0) {