Paste P146

Masterwork From Distant Lands
ActivePublic

Authored by dkazakov on Dec 27 2017, 12:01 PM.
diff --git a/libs/pigment/compositeops/KoCompositeOpFunctions.h b/libs/pigment/compositeops/KoCompositeOpFunctions.h
index 475084c..9ddbd46 100644
--- a/libs/pigment/compositeops/KoCompositeOpFunctions.h
+++ b/libs/pigment/compositeops/KoCompositeOpFunctions.h
@@ -375,7 +375,12 @@ inline T cfGrainExtract(T src, T dst) {
template<class T>
inline T cfHardMix(T src, T dst) {
- return (dst > Arithmetic::halfValue<T>()) ? cfColorDodge(src,dst) : cfColorBurn(src,dst);
+ using namespace Arithmetic;
+ typedef typename KoColorSpaceMathsTraits<T>::compositetype composite_type;
+
+ const composite_type sum = composite_type(src) + dst;
+
+ return sum >= unitValue<T>() ? unitValue<T>() : zeroValue<T>();
}
template<class T>
dkazakov edited the content of this paste. (Show Details)Dec 27 2017, 12:01 PM
dkazakov changed the title of this paste from untitled to Masterwork From Distant Lands.
dkazakov updated the paste's language from autodetect to autodetect.