Commit 4463699d authored by Dmitry Kazakov's avatar Dmitry Kazakov
Browse files

Fix double application of selection in ColorSmudge brush

When doing bitBltWithFixedSelection() the passed mask is merged with
the current selection. We shouldn't try to reuse d->paramInfo for the
merge because it may have a custom opacity/flow set.

BUG:423851
parent 5fe62e6f
......@@ -626,16 +626,20 @@ void KisPainter::bitBltWithFixedSelection(qint32 dstX, qint32 dstY,
d->selection->projection()->readBytes(mergedSelectionBytes, dstX, dstY, srcWidth, srcHeight);
KoCompositeOp::ParameterInfo multiplyParamInfo;
multiplyParamInfo.opacity = 1.0f;
multiplyParamInfo.flow = 1.0f;
// Merge selections here by multiplying them - compositeOP(COMPOSITE_MULT)
d->paramInfo.dstRowStart = mergedSelectionBytes;
d->paramInfo.dstRowStride = srcWidth * selection->pixelSize();
d->paramInfo.srcRowStart = selRowStart;
d->paramInfo.srcRowStride = selBounds.width() * selection->pixelSize();
d->paramInfo.maskRowStart = 0;
d->paramInfo.maskRowStride = 0;
d->paramInfo.rows = srcHeight;
d->paramInfo.cols = srcWidth;
KoColorSpaceRegistry::instance()->alpha8()->compositeOp(COMPOSITE_MULT)->composite(d->paramInfo);
multiplyParamInfo.dstRowStart = mergedSelectionBytes;
multiplyParamInfo.dstRowStride = srcWidth * selection->pixelSize();
multiplyParamInfo.srcRowStart = selRowStart;
multiplyParamInfo.srcRowStride = selBounds.width() * selection->pixelSize();
multiplyParamInfo.maskRowStart = 0;
multiplyParamInfo.maskRowStride = 0;
multiplyParamInfo.rows = srcHeight;
multiplyParamInfo.cols = srcWidth;
KoColorSpaceRegistry::instance()->alpha8()->compositeOp(COMPOSITE_MULT)->composite(multiplyParamInfo);
// Blit to dstBytes (intermediary bit array)
d->paramInfo.dstRowStart = dstBytes;
......@@ -644,6 +648,8 @@ void KisPainter::bitBltWithFixedSelection(qint32 dstX, qint32 dstY,
d->paramInfo.srcRowStride = srcWidth * srcDev->pixelSize();
d->paramInfo.maskRowStart = mergedSelectionBytes;
d->paramInfo.maskRowStride = srcWidth * selection->pixelSize();
d->paramInfo.rows = srcHeight;
d->paramInfo.cols = srcWidth;
d->colorSpace->bitBlt(srcDev->colorSpace(), d->paramInfo, d->compositeOp, d->renderingIntent, d->conversionFlags);
delete[] mergedSelectionBytes;
}
......@@ -1103,16 +1109,20 @@ void KisPainter::bltFixedWithFixedSelection(qint32 dstX, qint32 dstY,
}
d->selection->projection()->readBytes(mergedSelectionBytes, dstX, dstY, srcWidth, srcHeight);
KoCompositeOp::ParameterInfo multiplyParamInfo;
multiplyParamInfo.opacity = 1.0f;
multiplyParamInfo.flow = 1.0f;
// Merge selections here by multiplying them - compositeOp(COMPOSITE_MULT)
d->paramInfo.dstRowStart = mergedSelectionBytes;
d->paramInfo.dstRowStride = srcWidth * selection->pixelSize();
d->paramInfo.srcRowStart = selRowStart;
d->paramInfo.srcRowStride = selBounds.width() * selection->pixelSize();
d->paramInfo.maskRowStart = 0;
d->paramInfo.maskRowStride = 0;
d->paramInfo.rows = srcHeight;
d->paramInfo.cols = srcWidth;
KoColorSpaceRegistry::instance()->alpha8()->compositeOp(COMPOSITE_MULT)->composite(d->paramInfo);
multiplyParamInfo.dstRowStart = mergedSelectionBytes;
multiplyParamInfo.dstRowStride = srcWidth * selection->pixelSize();
multiplyParamInfo.srcRowStart = selRowStart;
multiplyParamInfo.srcRowStride = selBounds.width() * selection->pixelSize();
multiplyParamInfo.maskRowStart = 0;
multiplyParamInfo.maskRowStride = 0;
multiplyParamInfo.rows = srcHeight;
multiplyParamInfo.cols = srcWidth;
KoColorSpaceRegistry::instance()->alpha8()->compositeOp(COMPOSITE_MULT)->composite(multiplyParamInfo);
// Blit to dstBytes (intermediary bit array)
d->paramInfo.dstRowStart = dstBytes;
......@@ -1121,6 +1131,8 @@ void KisPainter::bltFixedWithFixedSelection(qint32 dstX, qint32 dstY,
d->paramInfo.srcRowStride = srcBounds.width() * srcDev->pixelSize();
d->paramInfo.maskRowStart = mergedSelectionBytes;
d->paramInfo.maskRowStride = srcWidth * selection->pixelSize();
d->paramInfo.rows = srcHeight;
d->paramInfo.cols = srcWidth;
d->colorSpace->bitBlt(srcDev->colorSpace(), d->paramInfo, d->compositeOp, d->renderingIntent, d->conversionFlags);
delete[] mergedSelectionBytes;
......
Supports Markdown
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