Commit 06281313 authored by Miguel Lopez's avatar Miguel Lopez Committed by Dmitry Kazakov

Fix to Modulo Shift Continuous

Before, I have made several test where white layer wouldn't change anything for all modulo mode to verify that they all work as expected. Then over time, I realized that at this point, modulo shift continuous just doesn't make sense from the functional point of view and the former test just don't take into account of that.

The problem with older version: If you set 0 on the blend layer using modulo shift continuous, it assume that there's a shift because of inversion. However, 0 shift is 0 shift as in there shouldn't be any changes at all.

This patch fix that issue from the functional point of view.

Reviewers: #krita

Tags: #krita

Differential Revision:
parent 91b1ffb9
......@@ -849,10 +849,10 @@ inline T cfModuloShiftContinuous(T src, T dst) {
qreal fdst = scale<qreal>(dst);
if (fsrc == 1.0 && fdst == 0.0) {
return scale<T>(0.0);
return scale<T>(1.0);
return scale<T>((int(ceil(fdst+fsrc)) % 2 != 0) || (fdst == zeroValue<T>()) ? inv(cfModuloShift(fsrc,fdst)) : cfModuloShift(fsrc,fdst));
return scale<T>((int(ceil(fdst+fsrc)) % 2 != 0) || (fdst == zeroValue<T>()) ? cfModuloShift(fsrc,fdst) : inv(cfModuloShift(fsrc,fdst)));
template<class T>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment