Skip to content

armgit / krita

Public Imported from GitHub
0

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++

Add a test for preserve-positive property

Dmitry Kazakov62be649403a6
diff --git a/libs/pigment/tests/KoCompositeOpFunctions2.h b/libs/pigment/tests/KoCompositeOpFunctions2.h
index 1c81fefd3a..8346c4a29a 100644
--- a/libs/pigment/tests/KoCompositeOpFunctions2.h
+++ b/libs/pigment/tests/KoCompositeOpFunctions2.h
@@ -373,20 +373,24 @@ inline T cfSubtract(T src, T dst) {
}
template<class T>
-inline T cfInverseSubtract(T src, T dst) {
- using namespace Arithmetic;
- typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
- return clamp<T>(composite_type(dst) - inv(src));
-}
+struct CFInverseSubtract : ClampedSourceCompositeFunctorBase<T> {
+ static inline T composeChannel(T src, T dst) {
+ using namespace Arithmetic;
+ typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
+ return clamp<T>(composite_type(dst) - inv(src));
+ }
+};
template<class T>
-inline T cfExclusion(T src, T dst) {
- using namespace Arithmetic;
- typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
-
- composite_type x = mul(src, dst);
- return clamp<T>(composite_type(dst) + src - (x + x));
-}
+struct CFExclusion : ClampedSourceAndDestinationCompositeFunctorBase<T> {
+ static inline T composeChannel(T src, T dst) {
+ using namespace Arithmetic;
+ typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
+
+ composite_type x = mul(src, dst);
+ return clamp<T>(composite_type(dst) + src - (x + x));
+ }
+};
template<class T>
inline T cfDivide(T src, T dst) {
@@ -594,18 +598,22 @@ struct CFEquivalence : ClampedSourceAndDestinationBottomCompositeFunctorBase<T>
};
template<class T>
-inline T cfGrainMerge(T src, T dst) {
- using namespace Arithmetic;
- typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
- return clamp<T>(composite_type(dst) + src - halfValue<T>());
-}
+struct CFGrainMerge : ClampedSourceAndDestinationCompositeFunctorBase<T> {
+ static inline T composeChannel(T src, T dst) {
+ using namespace Arithmetic;
+ typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
+ return clampToSDR<T>(composite_type(dst) + src - halfValue<T>());
+ }
+};
template<class T>
-inline T cfGrainExtract(T src, T dst) {
- using namespace Arithmetic;
- typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
- return clamp<T>(composite_type(dst) - src + halfValue<T>());
-}
+struct CFGrainExtract : ClampedSourceAndDestinationCompositeFunctorBase<T> {
+ static inline T composeChannel(T src, T dst) {
+ using namespace Arithmetic;
+ typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
+ return clampToSDR<T>(composite_type(dst) - src + halfValue<T>());
+ }
+};
template<class T,
template <typename> typename ClampPolicy>
@@ -952,18 +960,21 @@ inline T cfSoftLightPegtopDelphi(T src, T dst) {
return clamp<T>(cfAddition(mul(dst,cfScreen(src,dst)),mul(mul(src,dst),inv(dst))));
}
+
template<class T>
-inline T cfNegation(T src, T dst) {
- using namespace Arithmetic;
- typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
+struct CFNegation : ClampedSourceAndDestinationCompositeFunctorBase<T> {
+ static inline T composeChannel(T src, T dst) {
+ using namespace Arithmetic;
+ typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
- composite_type unit = unitValue<T>();
- composite_type a = unit - src - dst;
- composite_type s = std::abs(a);
- composite_type d = unit - s;
+ composite_type unit = unitValue<T>();
+ composite_type a = unit - src - dst;
+ composite_type s = std::abs(a);
+ composite_type d = unit - s;
- return T(d);
-}
+ return T(d);
+ }
+};
template<class T>
inline T cfNor(T src, T dst) {
diff --git a/libs/pigment/tests/TestCompositeOpInversion.cpp b/libs/pigment/tests/TestCompositeOpInversion.cpp
index 2f3ea72e4a..c9d1bfae0d 100644
--- a/libs/pigment/tests/TestCompositeOpInversion.cpp
+++ b/libs/pigment/tests/TestCompositeOpInversion.cpp
@@ -304,10 +304,12 @@ enum TestFlag {
None = 0x0,
HDR = 0x1,
SrcCannotMakeNegative = 0x2,
- UseStrictSdrRange = 0x4,
- PreservesSdrRange = 0x8,
- PreservesStrictSdrRange = 0x10,
- HasUnboundedRange = 0x20
+ VerifyConsistencyInStrictSdrRange = 0x4,
+ SdrRangePreserveStable = 0x8,
+ SdrRangePreserveUnstable = 0x10,
+ HasUnboundedRange = 0x20,
+ PositivePreserveStable = 0x40,
+ PositivePreserveUnstable = 0x80,
};
Q_DECLARE_FLAGS(TestFlags, TestFlag)
Q_DECLARE_OPERATORS_FOR_FLAGS(TestFlags)
@@ -349,26 +351,29 @@ std::vector<std::pair<QString, TestFlags>> generateCompositeOpIdSet()
std::vector<std::pair<QString, TestFlags>> result;
auto addSdrPreservingHdrOp = [&] (const QString &id) {
- result.emplace_back(id, HDR | SrcCannotMakeNegative | PreservesStrictSdrRange);
- result.emplace_back(id, SrcCannotMakeNegative | PreservesSdrRange);
+ result.emplace_back(id, HDR | SrcCannotMakeNegative | SdrRangePreserveUnstable | PositivePreserveStable);
+ result.emplace_back(id, SrcCannotMakeNegative | SdrRangePreserveStable | PositivePreserveStable);
};
addSdrPreservingHdrOp(COMPOSITE_PIN_LIGHT);
addSdrPreservingHdrOp(COMPOSITE_BURN);
addSdrPreservingHdrOp(COMPOSITE_LINEAR_BURN);
- auto addSdrNonPreservingHdrOp = [&] (const QString &id) {
- result.emplace_back(id, HDR | SrcCannotMakeNegative);
- result.emplace_back(id, SrcCannotMakeNegative | PreservesSdrRange);
- };
+ // Hard-mix is the only stable positive-preserving mode
+ result.emplace_back(COMPOSITE_HARD_MIX, HDR | SrcCannotMakeNegative | PositivePreserveStable);
+ result.emplace_back(COMPOSITE_HARD_MIX, SrcCannotMakeNegative | SdrRangePreserveStable | PositivePreserveStable);
+
+ result.emplace_back(COMPOSITE_HARD_OVERLAY, HDR | SrcCannotMakeNegative | PositivePreserveUnstable);
+ result.emplace_back(COMPOSITE_HARD_OVERLAY, SrcCannotMakeNegative | SdrRangePreserveStable | PositivePreserveStable);
+
+ result.emplace_back(COMPOSITE_DODGE, HDR | SrcCannotMakeNegative | PositivePreserveUnstable);
+ result.emplace_back(COMPOSITE_DODGE, SrcCannotMakeNegative | SdrRangePreserveStable | PositivePreserveStable);
- addSdrNonPreservingHdrOp(COMPOSITE_HARD_MIX);
- addSdrNonPreservingHdrOp(COMPOSITE_HARD_OVERLAY);
- addSdrNonPreservingHdrOp(COMPOSITE_DODGE);
- addSdrNonPreservingHdrOp(COMPOSITE_VIVID_LIGHT);
+ result.emplace_back(COMPOSITE_VIVID_LIGHT, HDR | SrcCannotMakeNegative | PositivePreserveUnstable);
+ result.emplace_back(COMPOSITE_VIVID_LIGHT, SrcCannotMakeNegative | SdrRangePreserveStable | PositivePreserveStable);
auto addSdrPreservingOp = [&] (const QString &id) {
- result.emplace_back(id, PreservesSdrRange);
+ result.emplace_back(id, SdrRangePreserveStable | PositivePreserveStable);
};
addSdrPreservingOp(COMPOSITE_DARKEN);
@@ -382,9 +387,13 @@ std::vector<std::pair<QString, TestFlags>> generateCompositeOpIdSet()
addSdrPreservingOp(COMPOSITE_ERASE);
addSdrPreservingOp(COMPOSITE_COPY);
addSdrPreservingOp(COMPOSITE_GREATER);
+ addSdrPreservingOp(COMPOSITE_GRAIN_MERGE);
+ addSdrPreservingOp(COMPOSITE_GRAIN_EXTRACT);
+ addSdrPreservingOp(COMPOSITE_EXCLUSION);
+ addSdrPreservingOp(COMPOSITE_NEGATION);
auto addStrictSdrPreservingOp = [&] (const QString &id) {
- result.emplace_back(id, PreservesStrictSdrRange);
+ result.emplace_back(id, SdrRangePreserveUnstable | PositivePreserveStable);
};
addStrictSdrPreservingOp(COMPOSITE_MULT);
@@ -393,36 +402,36 @@ std::vector<std::pair<QString, TestFlags>> generateCompositeOpIdSet()
auto addUnboundedRangeOp = [&] (const QString &id) {
- result.emplace_back(id, HasUnboundedRange);
+ result.emplace_back(id, HasUnboundedRange | PositivePreserveStable);
};
addUnboundedRangeOp(COMPOSITE_ADD);
- addUnboundedRangeOp(COMPOSITE_SUBTRACT);
- addUnboundedRangeOp(COMPOSITE_INVERSE_SUBTRACT);
- addUnboundedRangeOp(COMPOSITE_DIVIDE);
addUnboundedRangeOp(COMPOSITE_LUMINOSITY_SAI);
- addUnboundedRangeOp(COMPOSITE_EXCLUSION);
- addUnboundedRangeOp(COMPOSITE_NEGATION);
- addUnboundedRangeOp(COMPOSITE_GRAIN_MERGE);
- addUnboundedRangeOp(COMPOSITE_GRAIN_EXTRACT);
+
+
+
+
+ result.emplace_back(COMPOSITE_DIVIDE, PositivePreserveUnstable);
+ result.emplace_back(COMPOSITE_INVERSE_SUBTRACT, HasUnboundedRange);
+ result.emplace_back(COMPOSITE_SUBTRACT, HasUnboundedRange);
// both channels are clamped, sdr only!
- result.emplace_back(COMPOSITE_SOFT_LIGHT_SVG, SrcCannotMakeNegative | PreservesSdrRange);
- result.emplace_back(COMPOSITE_SOFT_LIGHT_PHOTOSHOP, SrcCannotMakeNegative | PreservesSdrRange);
+ result.emplace_back(COMPOSITE_SOFT_LIGHT_SVG, SrcCannotMakeNegative | SdrRangePreserveStable | PositivePreserveStable);
+ result.emplace_back(COMPOSITE_SOFT_LIGHT_PHOTOSHOP, SrcCannotMakeNegative | SdrRangePreserveStable | PositivePreserveStable);
- result.emplace_back(COMPOSITE_HARD_MIX_PHOTOSHOP, SrcCannotMakeNegative | UseStrictSdrRange | PreservesStrictSdrRange);
- result.emplace_back(COMPOSITE_HARD_MIX_SOFTER_PHOTOSHOP, SrcCannotMakeNegative | UseStrictSdrRange | PreservesStrictSdrRange);
- result.emplace_back(COMPOSITE_ARC_TANGENT, UseStrictSdrRange | PreservesStrictSdrRange);
+ result.emplace_back(COMPOSITE_HARD_MIX_PHOTOSHOP, SrcCannotMakeNegative | VerifyConsistencyInStrictSdrRange | SdrRangePreserveUnstable | PositivePreserveStable);
+ result.emplace_back(COMPOSITE_HARD_MIX_SOFTER_PHOTOSHOP, SrcCannotMakeNegative | VerifyConsistencyInStrictSdrRange | SdrRangePreserveUnstable | PositivePreserveStable);
+ result.emplace_back(COMPOSITE_ARC_TANGENT, VerifyConsistencyInStrictSdrRange | SdrRangePreserveUnstable | PositivePreserveUnstable);
// doesn't clamp result, always preserves SDR state
- result.emplace_back(COMPOSITE_HARD_LIGHT, SrcCannotMakeNegative | PreservesStrictSdrRange);
- result.emplace_back(COMPOSITE_PARALLEL, SrcCannotMakeNegative | PreservesSdrRange);
- result.emplace_back(COMPOSITE_EQUIVALENCE, SrcCannotMakeNegative | PreservesStrictSdrRange);
- result.emplace_back(COMPOSITE_GEOMETRIC_MEAN, SrcCannotMakeNegative | PreservesSdrRange);
- result.emplace_back(COMPOSITE_ADDITIVE_SUBTRACTIVE, SrcCannotMakeNegative | PreservesSdrRange);
- result.emplace_back(COMPOSITE_GAMMA_DARK, SrcCannotMakeNegative | PreservesStrictSdrRange);
- result.emplace_back(COMPOSITE_GAMMA_LIGHT, SrcCannotMakeNegative | PreservesSdrRange);
- result.emplace_back(COMPOSITE_GAMMA_ILLUMINATION, SrcCannotMakeNegative | PreservesStrictSdrRange);
+ result.emplace_back(COMPOSITE_HARD_LIGHT, SrcCannotMakeNegative | SdrRangePreserveUnstable | PositivePreserveStable);
+ result.emplace_back(COMPOSITE_PARALLEL, SrcCannotMakeNegative | SdrRangePreserveStable | PositivePreserveStable);
+ result.emplace_back(COMPOSITE_EQUIVALENCE, SrcCannotMakeNegative | SdrRangePreserveUnstable | PositivePreserveStable);
+ result.emplace_back(COMPOSITE_GEOMETRIC_MEAN, SrcCannotMakeNegative | SdrRangePreserveStable | PositivePreserveStable);
+ result.emplace_back(COMPOSITE_ADDITIVE_SUBTRACTIVE, SrcCannotMakeNegative | SdrRangePreserveStable | PositivePreserveStable);
+ result.emplace_back(COMPOSITE_GAMMA_DARK, SrcCannotMakeNegative | SdrRangePreserveUnstable | PositivePreserveStable);
+ result.emplace_back(COMPOSITE_GAMMA_LIGHT, SrcCannotMakeNegative | SdrRangePreserveStable | PositivePreserveStable);
+ result.emplace_back(COMPOSITE_GAMMA_ILLUMINATION, SrcCannotMakeNegative | SdrRangePreserveUnstable | PositivePreserveStable);
return result;
}
@@ -655,7 +664,7 @@ void TestCompositeOpInversion::testF32vsU16ConsistencyInSDR()
};
auto checkInSdrRange = [=] (qreal value) {
- return checkInSdrRangeImpl(value, flags.testFlag(UseStrictSdrRange));
+ return checkInSdrRangeImpl(value, flags.testFlag(VerifyConsistencyInStrictSdrRange));
};
const bool isInSdrRange =
@@ -824,8 +833,8 @@ void TestCompositeOpInversion::testPreservesStrictSdrRange_data()
KritaUtils::filterContainer(ids,
[&] (const std::pair<QString, TestFlags> &op) {
- return op.second.testFlag(PreservesSdrRange) ||
- op.second.testFlag(PreservesStrictSdrRange);
+ return op.second.testFlag(SdrRangePreserveStable) ||
+ op.second.testFlag(SdrRangePreserveUnstable);
});
addAllOps(ids);
@@ -842,7 +851,7 @@ void TestCompositeOpInversion::testPreservesLooseSdrRange_data()
KritaUtils::filterContainer(ids,
[&] (const std::pair<QString, TestFlags> &op) {
- return op.second.testFlag(PreservesSdrRange);
+ return op.second.testFlag(SdrRangePreserveStable);
});
addAllOps(ids);
@@ -902,6 +911,124 @@ void TestCompositeOpInversion::testSrcCannotMakeNegative()
}
}
+void TestCompositeOpInversion::testPreservesStrictNegative_data()
+{
+ auto ids = generateCompositeOpIdSet();
+
+ KritaUtils::filterContainer(ids,
+ [&] (const std::pair<QString, TestFlags> &op) {
+ return op.second.testFlag(PositivePreserveStable) ||
+ op.second.testFlag(PositivePreserveUnstable);
+ });
+
+
+ addAllOps(ids);
+}
+
+void TestCompositeOpInversion::testPreservesStrictNegative()
+{
+ testNegativeImpl(true);
+}
+
+void TestCompositeOpInversion::testPreservesLooseNegative_data()
+{
+ auto ids = generateCompositeOpIdSet();
+
+ KritaUtils::filterContainer(ids,
+ [&] (const std::pair<QString, TestFlags> &op) {
+ return op.second.testFlag(PositivePreserveStable);
+ });
+
+
+ addAllOps(ids);
+}
+
+void TestCompositeOpInversion::testPreservesLooseNegative()
+{
+ testNegativeImpl(false);
+}
+
+void TestCompositeOpInversion::testNegativeImpl(bool useStrictZeroCheck)
+{
+ QFETCH(QString, id);
+ QFETCH(TestFlags, flags);
+
+ const KoColorSpace* csF = KoColorSpaceRegistry::instance()->colorSpace(RGBAColorModelID.id(), Float32BitsColorDepthID.id(), 0);
+ const KoCompositeOp *opF = createOp(csF, id, flags.testFlag(HDR));
+
+ KisColorPairSampler sampler;
+ sampler.alphaValues = generateOpacityValues();
+ sampler.colorValues = generateWideColorValues();
+
+ for (auto it = sampler.begin(); it != sampler.end(); ++it) {
+ KoColor srcColorF = it.srcColor(csF);
+ KoColor dstColorF = it.dstColor(csF);
+ KoColor resultColorF = dstColorF;
+
+ opF->composite(resultColorF.data(), 0, srcColorF.data(), 0,
+ 0, 0,
+ 1, 1,
+ it.opacity());
+
+ const float resultColorValueF = getColorValue(resultColorF);
+
+ const bool srcCheckValid = useStrictZeroCheck ?
+ it.srcColor() > 0.0 : float(it.srcColor()) >= -std::numeric_limits<float>::epsilon();
+
+ const bool dstCheckValid = useStrictZeroCheck ?
+ it.dstColor() > 0.0 : float(it.dstColor()) >= -std::numeric_limits<float>::epsilon();
+
+ const bool resultCheckValid = useStrictZeroCheck ?
+ resultColorValueF > -1.0f * std::numeric_limits<float>::epsilon() :
+ resultColorValueF >= -2.0f * std::numeric_limits<float>::epsilon();
+
+ if (srcCheckValid &&
+ dstCheckValid &&
+ !resultCheckValid) {
+
+ qDebug() << "--- resulting value in SDR range generates negative result! ---";
+ qDebug() << ppVar(useStrictZeroCheck);
+ qDebug() << ppVar(it.opacity());
+ qDebug() << "F32:" << fixed << qSetRealNumberPrecision(8)
+ << "s:" << dumpPixel(srcColorF) << "+" << "d:" << dumpPixel(dstColorF) << "->" << dumpPixel(resultColorF);
+ QFAIL("resulting value in SDR range generates negative result!");
+ }
+ }
+}
+
+
+void TestCompositeOpInversion::dumpOpCategories()
+{
+ auto ids = generateCompositeOpIdSet();
+ std::sort(ids.begin(), ids.end());
+
+ auto printCategory = [ids] (const QString &categoryName, TestFlags includeFlags, bool flagsFound = true) {
+ qDebug().noquote().nospace() << categoryName << ":";
+ for (auto it = ids.begin(); it != ids.end(); ++it) {
+ if (bool(it->second & includeFlags) == flagsFound) {
+ const QString hdrSuffix = it->second.testFlag(HDR) ? " HDR" : "";
+
+ qDebug().noquote().nospace() << " * \"" << KoCompositeOpRegistry::instance().getCompositeOpDisplayName(it->first) << "\" (" << it->first << ")" << hdrSuffix;
+ }
+ }
+ };
+
+ qDebug();
+ qDebug();
+ printCategory("Preserve SDR range (stable)", SdrRangePreserveStable);
+ qDebug();
+ printCategory("Preserve SDR range (unstable)", SdrRangePreserveUnstable);
+ qDebug();
+ printCategory("Does NOT preserve SDR range", SdrRangePreserveStable | SdrRangePreserveUnstable, false);
+
+ qDebug();
+ qDebug();
+ printCategory("Preserve positive range (stable)", PositivePreserveStable);
+ qDebug();
+ printCategory("Preserve positive range (unstable)", PositivePreserveUnstable);
+ qDebug();
+ printCategory("Does NOT preserve positive range", PositivePreserveStable | PositivePreserveUnstable, false);
+}
SIMPLE_TEST_MAIN(TestCompositeOpInversion)
diff --git a/libs/pigment/tests/TestCompositeOpInversion.h b/libs/pigment/tests/TestCompositeOpInversion.h
index 9758b64a62..38765c1eff 100644
--- a/libs/pigment/tests/TestCompositeOpInversion.h
+++ b/libs/pigment/tests/TestCompositeOpInversion.h
@@ -36,7 +36,16 @@ private Q_SLOTS:
void testSrcCannotMakeNegative();
void testSrcCannotMakeNegative_data();
+ void testPreservesStrictNegative();
+ void testPreservesStrictNegative_data();
+
+ void testPreservesLooseNegative();
+ void testPreservesLooseNegative_data();
+
+ void dumpOpCategories();
+
private:
+ void testNegativeImpl(bool useStrictZeroCheck);
void testPreservesSdrRangeImpl(bool useStrictRange);
};
diff --git a/libs/pigment/tests/TestCompositeOpInversion_p.cpp b/libs/pigment/tests/TestCompositeOpInversion_p.cpp
index e88274e5b0..9c62234c6b 100644
--- a/libs/pigment/tests/TestCompositeOpInversion_p.cpp
+++ b/libs/pigment/tests/TestCompositeOpInversion_p.cpp
@@ -168,12 +168,12 @@ const KoCompositeOp* createOp(const KoColorSpace *cs, const QString &id, bool is
} else if (id == COMPOSITE_INVERSE_SUBTRACT) {
if (cs->colorDepthId() == Float32BitsColorDepthID) {
using Traits = KoRgbF32Traits;
- constexpr auto func = &cfInverseSubtract<float>;
- op = new KoCompositeOpGenericSC<Traits, func, KoAdditiveBlendingPolicy<Traits>>(cs, id, KoCompositeOp::categoryArithmetic());
+ using func = CFInverseSubtract<float>;
+ op = new KoCompositeOpGenericSCFunctor<Traits, func, KoAdditiveBlendingPolicy<Traits>>(cs, id, KoCompositeOp::categoryArithmetic());
} else if (cs->colorDepthId() == Integer16BitsColorDepthID) {
using Traits = KoRgbU16Traits;
- constexpr auto func = &cfInverseSubtract<quint16>;
- op = new KoCompositeOpGenericSC<Traits, func, KoAdditiveBlendingPolicy<Traits>>(cs, id, KoCompositeOp::categoryArithmetic());
+ using func = CFInverseSubtract<quint16>;
+ op = new KoCompositeOpGenericSCFunctor<Traits, func, KoAdditiveBlendingPolicy<Traits>>(cs, id, KoCompositeOp::categoryArithmetic());
}
} else if (id == COMPOSITE_MULT) {
if (cs->colorDepthId() == Float32BitsColorDepthID) {
@@ -198,12 +198,12 @@ const KoCompositeOp* createOp(const KoColorSpace *cs, const QString &id, bool is
} else if (id == COMPOSITE_EXCLUSION) {
if (cs->colorDepthId() == Float32BitsColorDepthID) {
using Traits = KoRgbF32Traits;
- constexpr auto func = &cfExclusion<float>;
- op = new KoCompositeOpGenericSC<Traits, func, KoAdditiveBlendingPolicy<Traits>>(cs, id, KoCompositeOp::categoryArithmetic());
+ using func = CFExclusion<float>;
+ op = new KoCompositeOpGenericSCFunctor<Traits, func, KoAdditiveBlendingPolicy<Traits>>(cs, id, KoCompositeOp::categoryArithmetic());
} else if (cs->colorDepthId() == Integer16BitsColorDepthID) {
using Traits = KoRgbU16Traits;
- constexpr auto func = &cfExclusion<quint16>;
- op = new KoCompositeOpGenericSC<Traits, func, KoAdditiveBlendingPolicy<Traits>>(cs, id, KoCompositeOp::categoryArithmetic());
+ using func = CFExclusion<quint16>;
+ op = new KoCompositeOpGenericSCFunctor<Traits, func, KoAdditiveBlendingPolicy<Traits>>(cs, id, KoCompositeOp::categoryArithmetic());
}
} else if (id == COMPOSITE_DIFF) {
if (cs->colorDepthId() == Float32BitsColorDepthID) {
@@ -248,12 +248,12 @@ const KoCompositeOp* createOp(const KoColorSpace *cs, const QString &id, bool is
} else if (id == COMPOSITE_NEGATION) {
if (cs->colorDepthId() == Float32BitsColorDepthID) {
using Traits = KoRgbF32Traits;
- constexpr auto func = &cfNegation<float>;
- op = new KoCompositeOpGenericSC<Traits, func, KoAdditiveBlendingPolicy<Traits>>(cs, id, KoCompositeOp::categoryArithmetic());
+ using func = CFNegation<float>;
+ op = new KoCompositeOpGenericSCFunctor<Traits, func, KoAdditiveBlendingPolicy<Traits>>(cs, id, KoCompositeOp::categoryArithmetic());
} else if (cs->colorDepthId() == Integer16BitsColorDepthID) {
using Traits = KoRgbU16Traits;
- constexpr auto func = &cfNegation<quint16>;
- op = new KoCompositeOpGenericSC<Traits, func, KoAdditiveBlendingPolicy<Traits>>(cs, id, KoCompositeOp::categoryArithmetic());
+ using func = CFNegation<quint16>;
+ op = new KoCompositeOpGenericSCFunctor<Traits, func, KoAdditiveBlendingPolicy<Traits>>(cs, id, KoCompositeOp::categoryArithmetic());
}
} else if (id == COMPOSITE_HARD_MIX) {
if (cs->colorDepthId() == Float32BitsColorDepthID) {
@@ -343,22 +343,22 @@ const KoCompositeOp* createOp(const KoColorSpace *cs, const QString &id, bool is
} else if (id == COMPOSITE_GRAIN_MERGE) {
if (cs->colorDepthId() == Float32BitsColorDepthID) {
using Traits = KoRgbF32Traits;
- constexpr auto func = &cfGrainMerge<float>;
- op = new KoCompositeOpGenericSC<Traits, func, KoAdditiveBlendingPolicy<Traits>>(cs, id, KoCompositeOp::categoryArithmetic());
+ using func = CFGrainMerge<float>;
+ op = new KoCompositeOpGenericSCFunctor<Traits, func, KoAdditiveBlendingPolicy<Traits>>(cs, id, KoCompositeOp::categoryArithmetic());
} else if (cs->colorDepthId() == Integer16BitsColorDepthID) {
using Traits = KoRgbU16Traits;
- constexpr auto func = &cfGrainMerge<quint16>;
- op = new KoCompositeOpGenericSC<Traits, func, KoAdditiveBlendingPolicy<Traits>>(cs, id, KoCompositeOp::categoryArithmetic());
+ using func = CFGrainMerge<quint16>;
+ op = new KoCompositeOpGenericSCFunctor<Traits, func, KoAdditiveBlendingPolicy<Traits>>(cs, id, KoCompositeOp::categoryArithmetic());
}
} else if (id == COMPOSITE_GRAIN_EXTRACT) {
if (cs->colorDepthId() == Float32BitsColorDepthID) {
using Traits = KoRgbF32Traits;
- constexpr auto func = &cfGrainExtract<float>;
- op = new KoCompositeOpGenericSC<Traits, func, KoAdditiveBlendingPolicy<Traits>>(cs, id, KoCompositeOp::categoryArithmetic());
+ using func = CFGrainExtract<float>;
+ op = new KoCompositeOpGenericSCFunctor<Traits, func, KoAdditiveBlendingPolicy<Traits>>(cs, id, KoCompositeOp::categoryArithmetic());
} else if (cs->colorDepthId() == Integer16BitsColorDepthID) {
using Traits = KoRgbU16Traits;
- constexpr auto func = &cfGrainExtract<quint16>;
- op = new KoCompositeOpGenericSC<Traits, func, KoAdditiveBlendingPolicy<Traits>>(cs, id, KoCompositeOp::categoryArithmetic());
+ using func = CFGrainExtract<quint16>;
+ op = new KoCompositeOpGenericSCFunctor<Traits, func, KoAdditiveBlendingPolicy<Traits>>(cs, id, KoCompositeOp::categoryArithmetic());
}
} else if (id == COMPOSITE_GEOMETRIC_MEAN) {
if (cs->colorDepthId() == Float32BitsColorDepthID) {