diff --git a/libs/pigment/compositeops/KoCompositeOpFunctions.h b/libs/pigment/compositeops/KoCompositeOpFunctions.h index 8f8a236..9a97834 100644 --- a/libs/pigment/compositeops/KoCompositeOpFunctions.h +++ b/libs/pigment/compositeops/KoCompositeOpFunctions.h @@ -460,6 +460,9 @@ inline T cfGlow(T src, T dst) { if(dst == unitValue()) return unitValue(); + + if(src == zeroValue()) + return zeroValue(); return clamp(div(mul(src, src), inv(dst))); } @@ -468,22 +471,7 @@ template inline T cfReflect(T src, T dst) { using namespace Arithmetic; - if(dst == unitValue()) - return unitValue(); - - return clamp(cfGlow(dst,src)); - -} - -template -inline T cfUQuad1(T src, T dst) { - using namespace Arithmetic; - // Helper Blender Mode for Heat, and Freeze - Reptorian - - if(dst == zeroValue()) - return zeroValue(); - - return clamp(div(mul(inv(src), inv(src)),dst)); + return cfGlow(dst,src); } template @@ -492,18 +480,18 @@ inline T cfHeat(T src, T dst) { if(dst == zeroValue()) return zeroValue(); - - return clamp(inv(cfUQuad1(src,dst))); + + if(src == unitValue()) + return unitValue(); + + return inv(clamp(div(mul(inv(src), inv(src)),dst))); } template inline T cfFreeze(T src, T dst) { using namespace Arithmetic; - if(dst == zeroValue()) - return zeroValue(); - - return clamp(cfHeat(dst,src)); + return cfHeat(dst,src); }