Commit 999b37ef authored by Wolthera van Hövell's avatar Wolthera van Hövell 🛍

Replace old pattern painting places with the new fill algorithm.

This covers the fill tool, geometric tool, fill with pattern, and
layer style. This also implements scale for layer style. All of
these seem to support blending modes.
parent 46e0e5f6
......@@ -259,7 +259,7 @@ void KisFillPainter::fillPattern(int startX, int startY, KisPaintDeviceSP source
KisPaintDeviceSP filled = device()->createCompositionSourceDevice();
Q_CHECK_PTR(filled);
KisFillPainter painter(filled);
painter.fillRect(0, 0, m_width, m_height, pattern());
painter.fillRect(QRect(0, 0, m_width, m_height), pattern(), QTransform());
painter.end();
genericFillEnd(filled);
......
......@@ -1456,7 +1456,7 @@ void KisPainter::Private::fillPainterPathImpl(const QPainterPath& path, const QR
break;
case FillStylePattern:
if (pattern) { // if the user hasn't got any patterns installed, we shouldn't crash...
fillPainter->fillRect(fillRect, pattern);
fillPainter->fillRect(fillRect, pattern, QTransform());
}
break;
case FillStyleGenerator:
......
......@@ -389,9 +389,6 @@ namespace KisLsUtils
int verticalPhase,
bool alignWithLayer)
{
if (scale != 100) {
warnKrita << "KisLsOverlayFilter::applyOverlay(): Pattern scaling is NOT implemented!";
}
KIS_SAFE_ASSERT_RECOVER_RETURN(pattern);
QSize psize(pattern->width(), pattern->height());
......@@ -410,8 +407,11 @@ namespace KisLsUtils
QRect fillRect = applyRect | applyRect.translated(patternOffset);
KisFillPainter gc(fillDevice);
gc.fillRect(fillRect.x(), fillRect.y(),
fillRect.width(), fillRect.height(), pattern, -patternOffset);
QTransform transform;
transform.translate(-patternOffset.x(), -patternOffset.y());
qreal scaleNorm = qreal(scale*0.01);
transform.scale(scaleNorm, scaleNorm);
gc.fillRect(fillRect, pattern, transform);
gc.end();
}
......
......@@ -82,7 +82,7 @@ void FillProcessingVisitor::fillPaintDevice(KisPaintDeviceSP device, KisUndoAdap
fillPainter.setProgress(helper.updater());
if (m_usePattern) {
fillPainter.fillRect(fillRect, m_resources->currentPattern());
fillPainter.fillRect(fillRect, m_resources->currentPattern(), QTransform());
} else if (m_useBgColor) {
fillPainter.fillRect(fillRect,
m_resources->currentBgColor(),
......
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