IccColorProfile.cpp (krita-5.1.3.tar.xz) | : | IccColorProfile.cpp (krita-5.1.4.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 67 | skipping to change at line 67 | |||
IccColorProfile::Container::~Container() | IccColorProfile::Container::~Container() | |||
{ | { | |||
} | } | |||
struct IccColorProfile::Private { | struct IccColorProfile::Private { | |||
struct Shared { | struct Shared { | |||
QScopedPointer<IccColorProfile::Data> data; | QScopedPointer<IccColorProfile::Data> data; | |||
QScopedPointer<LcmsColorProfileContainer> lcmsProfile; | QScopedPointer<LcmsColorProfileContainer> lcmsProfile; | |||
QVector<KoChannelInfo::DoubleRange> uiMinMaxes; | QVector<KoChannelInfo::DoubleRange> uiMinMaxes; | |||
bool canCreateCyclicTransform = false; | bool canCreateCyclicTransform = false; | |||
Shared() | ||||
: data(new IccColorProfile::Data()) | ||||
{ | ||||
} | ||||
}; | }; | |||
Private() | ||||
: shared(QSharedPointer<Shared>::create()) | ||||
{ | ||||
} | ||||
QSharedPointer<Shared> shared; | QSharedPointer<Shared> shared; | |||
}; | }; | |||
IccColorProfile::IccColorProfile(const QString &fileName) | IccColorProfile::IccColorProfile(const QString &fileName) | |||
: KoColorProfile(fileName), d(new Private) | : KoColorProfile(fileName), d(new Private) | |||
{ | { | |||
// QSharedPointer lacks a reset in Qt 4.x | ||||
d->shared = QSharedPointer<Private::Shared>(new Private::Shared()); | ||||
d->shared->data.reset(new Data()); | ||||
} | } | |||
IccColorProfile::IccColorProfile(const QByteArray &rawData) | IccColorProfile::IccColorProfile(const QByteArray &rawData) | |||
: KoColorProfile(QString()), d(new Private) | : KoColorProfile(QString()), d(new Private) | |||
{ | { | |||
d->shared = QSharedPointer<Private::Shared>(new Private::Shared()); | ||||
d->shared->data.reset(new Data()); | ||||
setRawData(rawData); | setRawData(rawData); | |||
init(); | init(); | |||
} | } | |||
IccColorProfile::IccColorProfile(const QVector<double> &colorants, | IccColorProfile::IccColorProfile(const QVector<double> &colorants, | |||
const ColorPrimaries colorPrimariesType, | const ColorPrimaries colorPrimariesType, | |||
const TransferCharacteristics transferFunction) | const TransferCharacteristics transferFunction) | |||
: KoColorProfile(QString()), d(new Private) | : KoColorProfile(QString()), d(new Private) | |||
{ | { | |||
KIS_ASSERT( | KIS_ASSERT( | |||
skipping to change at line 158 | skipping to change at line 154 | |||
cmsMLUsetASCII (mlu, "en", "US", name.join(" ").toLatin1()); | cmsMLUsetASCII (mlu, "en", "US", name.join(" ").toLatin1()); | |||
cmsWriteTag (iccProfile, cmsSigProfileDescriptionTag, mlu); | cmsWriteTag (iccProfile, cmsSigProfileDescriptionTag, mlu); | |||
cmsMLUfree (mlu); | cmsMLUfree (mlu); | |||
mlu = cmsMLUalloc (NULL, 1); | mlu = cmsMLUalloc (NULL, 1); | |||
cmsMLUsetASCII (mlu, "en", "US", QString("Profile generated by Krita, Public domain.").toLatin1()); | cmsMLUsetASCII (mlu, "en", "US", QString("Profile generated by Krita, Public domain.").toLatin1()); | |||
cmsWriteTag(iccProfile, cmsSigCopyrightTag, mlu); | cmsWriteTag(iccProfile, cmsSigCopyrightTag, mlu); | |||
cmsMLUfree (mlu); | cmsMLUfree (mlu); | |||
setCharacteristics(colorPrimariesType, transferFunction); | setCharacteristics(colorPrimariesType, transferFunction); | |||
d->shared = QSharedPointer<Private::Shared>::create(); | d->shared = QSharedPointer<Private::Shared>(new Private::Shared()); | |||
d->shared->data.reset(new Data()); | ||||
setRawData(LcmsColorProfileContainer::lcmsProfileToByteArray(iccProfile)); | setRawData(LcmsColorProfileContainer::lcmsProfileToByteArray(iccProfile)); | |||
cmsCloseProfile(iccProfile); | cmsCloseProfile(iccProfile); | |||
setFileName(name.join(" ").split(" ").join("-")+".icc"); | setFileName(name.join(" ").split(" ").join("-")+".icc"); | |||
init(); | init(); | |||
} | } | |||
IccColorProfile::IccColorProfile(const IccColorProfile &rhs) | IccColorProfile::IccColorProfile(const IccColorProfile &rhs) | |||
: KoColorProfile(rhs) | : KoColorProfile(rhs) | |||
, d(new Private(*rhs.d)) | , d(new Private(*rhs.d)) | |||
skipping to change at line 351 | skipping to change at line 348 | |||
QVector <qreal> IccColorProfile::getEstimatedTRC() const | QVector <qreal> IccColorProfile::getEstimatedTRC() const | |||
{ | { | |||
QVector <qreal> dummy(3); | QVector <qreal> dummy(3); | |||
dummy.fill(2.2);//estimated sRGB trc. | dummy.fill(2.2);//estimated sRGB trc. | |||
if (d->shared->lcmsProfile) { | if (d->shared->lcmsProfile) { | |||
return d->shared->lcmsProfile->getEstimatedTRC(); | return d->shared->lcmsProfile->getEstimatedTRC(); | |||
} | } | |||
return dummy; | return dummy; | |||
} | } | |||
bool IccColorProfile::compareTRC(TransferCharacteristics characteristics, float | ||||
error) const | ||||
{ | ||||
if (d->shared->lcmsProfile) { | ||||
return d->shared->lcmsProfile->compareTRC(characteristics, error); | ||||
} | ||||
return false; | ||||
} | ||||
void IccColorProfile::linearizeFloatValue(QVector <qreal> & Value) const | void IccColorProfile::linearizeFloatValue(QVector <qreal> & Value) const | |||
{ | { | |||
if (d->shared->lcmsProfile) | if (d->shared->lcmsProfile) | |||
d->shared->lcmsProfile->LinearizeFloatValue(Value); | d->shared->lcmsProfile->LinearizeFloatValue(Value); | |||
} | } | |||
void IccColorProfile::delinearizeFloatValue(QVector <qreal> & Value) const | void IccColorProfile::delinearizeFloatValue(QVector <qreal> & Value) const | |||
{ | { | |||
if (d->shared->lcmsProfile) | if (d->shared->lcmsProfile) | |||
d->shared->lcmsProfile->DelinearizeFloatValue(Value); | d->shared->lcmsProfile->DelinearizeFloatValue(Value); | |||
} | } | |||
End of changes. 6 change blocks. | ||||
11 lines changed or deleted | 17 lines changed or added |