Commit cae14d45 authored by Dmitry Kazakov's avatar Dmitry Kazakov
Browse files

Fix weird brush behavior when lightness strength is too low

When lightness strength is too low, we shouldn't let it drop to zero,
because in such a case the heightmap will peek through the the layer
color layer in a weird way.
parent 1bc3de38
......@@ -123,7 +123,20 @@ KisColorSmudgeStrategyLightness::paintDab(const QRect &srcRect, const QRect &dst
colorRateValue,
smudgeRadiusValue);
m_heightmapPainter.setOpacity(qRound(lightnessStrengthValue * 255.0));
const quint8 thresholdHeightmapOpacity = qRound(0.2 * 255.0);
quint8 heightmapOpacity = qRound(lightnessStrengthValue * 255.0);
if (heightmapOpacity < thresholdHeightmapOpacity) {
heightmapOpacity =
std::min(thresholdHeightmapOpacity,
std::max(smearRateOpacity(opacity, smudgeRateValue),
colorRateOpacity(opacity, smudgeRateValue,
colorRateValue, maxPossibleSmudgeRateValue)));
}
m_heightmapPainter.setOpacity(heightmapOpacity);
m_heightmapPainter.bltFixed(dstRect.topLeft(), m_origDab, m_origDab->bounds());
m_heightmapPainter.renderMirrorMaskSafe(dstRect, m_origDab, m_shouldPreserveOriginalDab);
......
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