Commit 61edb745 authored by Ivan Yossi's avatar Ivan Yossi 👌 Committed by Boudewijn Rempt

Improve rendering of predefined default Rect dab

This patch calculates the horizontal and vertical fade areas
differently to avoid hard edges fade is not symmetric.

Additionaly artifacts are reduces on dabs with spikes greater than 2
parent df825790
......@@ -437,14 +437,11 @@ FastRowProcessor::process<Vc::CurrentImplementation::current()>(float* buffer, i
Vc::float_v vFade(vZero);
Vc::float_v::IndexType fxrInt(fxr * vTolerance);
Vc::float_v::IndexType fyrInt(fyr * vTolerance);
Vc::float_m fadeXMask = (fxr > vOne) && ((fxrInt >= fyrInt) || fyr < vOne);
Vc::float_m fadeYMask = (fyr > vOne) && ((fyrInt > fxrInt) || fxr < vOne);
vFade(fadeXMask) = fxrNorm;
vFade(!fadeXMask && fadeYMask) = fyrNorm;
Vc::float_m vFadeMask = fxrNorm < fyrNorm;
Vc::float_v vMaxVal = vFade;
vMaxVal(fxr > vOne) = fxrNorm;
vMaxVal(vFadeMask && fyr > vOne) = fyrNorm;
vFade = vMaxVal;
// Mask out the outer circle of the mask
vFade(outsideMask) = vOne;
......
......@@ -142,17 +142,19 @@ quint8 KisRectangleMaskGenerator::valueAt(qreal x, qreal y) const
qreal fxr = xr * d->transformedFadeX;
qreal fyr = yr * d->transformedFadeY;
int fxrInt = fxr * 1e4;
int fyrInt = fyr * 1e4;
qreal fxnorm = nxr * (fxr - 1.0) / (fxr - nxr);
qreal fynorm = nyr * (fyr - 1.0) / (fyr - nyr);
if (fxr > 1.0 && (fxrInt >= fyrInt || fyr < 1.0)) {
return 255 * nxr * (fxr - 1.0) / (fxr - nxr);
}
qreal retValue = 0;
if (fyr > 1.0 && (fyrInt > fxrInt || fxr < 1.0)) {
return 255 * nyr * (fyr - 1.0) / (fyr - nyr);
}
if(fxr > 1.0) {
retValue = fxnorm;
}
if (fxnorm < fynorm && fyr > 1.0) {
retValue = fynorm;
}
return 0;
return retValue * 255;
}
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