Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++

Use subgrid in LiquifyWorker::runOnQImage()

Agata Cackoe70a3840db1d
diff --git a/libs/image/kis_liquify_transform_worker.cpp b/libs/image/kis_liquify_transform_worker.cpp
index aac5348a4a..ad84faf202 100644
--- a/libs/image/kis_liquify_transform_worker.cpp
+++ b/libs/image/kis_liquify_transform_worker.cpp
@@ -524,11 +524,20 @@ QImage KisLiquifyTransformWorker::runOnQImage(const QImage &srcImage,
GridIterationTools::QImagePolygonOp polygonOp(srcImage, dstImage, srcImageOffset, dstQImageOffset);
GridIterationTools::RegularGridIndexesOp indexesOp(m_d->gridSize);
- GridIterationTools::iterateThroughGrid
- <GridIterationTools::AlwaysCompletePolygonPolicy>(polygonOp, indexesOp,
- m_d->gridSize,
- originalPointsLocal,
- transformedPointsLocal);
+
+
+ QRect correctSubGrid = GridIterationTools::calculateCorrectSubGrid(m_d->srcBounds, m_d->pixelPrecision, m_d->accumulatedBrushStrokes, m_d->gridSize);
+ GridIterationTools::iterateThroughGrid<GridIterationTools::AlwaysCompletePolygonPolicy>(polygonOp, indexesOp,
+ m_d->gridSize,
+ originalPointsLocal,
+ transformedPointsLocal,
+ correctSubGrid);
+
+
+ QList<QRectF> areasToCopy = GridIterationTools::cutOutSubgridFromBounds(correctSubGrid, m_d->srcBounds, m_d->gridSize, m_d->originalPoints);
+ for (int i = 0; i < areasToCopy.length(); i++) {
+ polygonOp.fastCopyArea(imageToThumbTransform.map(QPolygonF(areasToCopy[i])));
+ }
return dstImage;
}