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++
Remove KisImage::refreshGraph()
Dmitry Kazakov9f8f65fcb396
diff --git a/benchmarks/kis_projection_benchmark.cpp b/benchmarks/kis_projection_benchmark.cppindex 5c7a63a6f9..8d03158bbd 100644--- a/benchmarks/kis_projection_benchmark.cpp+++ b/benchmarks/kis_projection_benchmark.cpp@@ -31,7 +31,7 @@ void KisProjectionBenchmark::benchmarkProjection()QBENCHMARK{KisDocument *doc = KisPart::instance()->createDocument();doc->loadNativeFormat(QString(FILES_DATA_DIR) + '/' + "load_test.kra");- doc->image()->refreshGraph();+ doc->image()->initialRefreshGraph();doc->exportDocumentSync(QString(FILES_OUTPUT_DIR) + '/' + "save_test.kra", doc->mimeType());delete doc;}diff --git a/libs/image/kis_image.cc b/libs/image/kis_image.ccindex 4f9df9c6e8..841866aeb5 100644--- a/libs/image/kis_image.cc+++ b/libs/image/kis_image.cc@@ -2120,19 +2120,6 @@ void KisImage::requestStrokeEndActiveNode()Q_EMIT sigStrokeEndRequested();}-void KisImage::refreshGraph(KisNodeSP root)-{- refreshGraph(root, bounds(), bounds());-}--void KisImage::refreshGraph(KisNodeSP root, const QRect &rc, const QRect &cropRect)-{- if (!root) root = m_d->rootLayer;-- m_d->animationInterface->notifyNodeChanged(root.data(), rc, true);- m_d->scheduler.fullRefresh(root, rc, cropRect);-}-void KisImage::initialRefreshGraph(){/**diff --git a/libs/image/kis_image.h b/libs/image/kis_image.hindex c6113357ee..881883ec6d 100644--- a/libs/image/kis_image.h+++ b/libs/image/kis_image.h@@ -1141,10 +1141,13 @@ public:void refreshGraphAsync(KisNodeSP root, const QVector<QRect> &rects, const QRect &cropRect, KisProjectionUpdateFlags flags = KisProjectionUpdateFlag::None) override;/**- * Triggers synchronous recomposition of the projection+ * Triggers synchronous recomposition of the projection on the document+ * opening, i.e. with the cropRect set to null. Unlimited crop rect+ * forces the clone layers to regenerate all its sources.+ *+ * WARNING: If you are not loading a multilayered document, consider using+ * refreshGraphAsync() instead, possibly coupled with waitForDone().*/- void refreshGraph(KisNodeSP root = KisNodeSP());- void refreshGraph(KisNodeSP root, const QRect& rc, const QRect &cropRect);void initialRefreshGraph();/**diff --git a/libs/image/kis_update_scheduler.cpp b/libs/image/kis_update_scheduler.cppindex 403b6da3c2..d5f9681deb 100644--- a/libs/image/kis_update_scheduler.cpp+++ b/libs/image/kis_update_scheduler.cpp@@ -160,32 +160,6 @@ void KisUpdateScheduler::fullRefreshAsync(KisNodeSP root, const QRect &rc, constfullRefreshAsync(root, {rc}, cropRect, KisProjectionUpdateFlag::None);}-void KisUpdateScheduler::fullRefresh(KisNodeSP root, const QRect& rc, const QRect &cropRect)-{- KisBaseRectsWalkerSP walker = new KisFullRefreshWalker(cropRect);- walker->collectRects(root, rc);-- bool needLock = true;-- if(m_d->processingBlocked) {- warnImage << "WARNING: Calling synchronous fullRefresh under a scheduler lock held";- warnImage << "We will not assert for now, but please port caller's to strokes";- warnImage << "to avoid this warning";- needLock = false;- }-- if(needLock) immediateLockForReadOnly();- m_d->updaterContext.lock();-- Q_ASSERT(m_d->updaterContext.isJobAllowed(walker));- m_d->updaterContext.addMergeJob(walker);- m_d->updaterContext.unlock();-- m_d->updaterContext.waitForDone();-- if(needLock) unlock(true);-}-void KisUpdateScheduler::addSpontaneousJob(KisSpontaneousJob *spontaneousJob){m_d->updatesQueue.addSpontaneousJob(spontaneousJob);diff --git a/libs/image/kis_update_scheduler.h b/libs/image/kis_update_scheduler.hindex e4ba3c5a32..c6ee974117 100644--- a/libs/image/kis_update_scheduler.h+++ b/libs/image/kis_update_scheduler.h@@ -134,8 +134,6 @@ public:// simplified override for testing purposesvoid fullRefreshAsync(KisNodeSP root, const QRect &rc, const QRect &cropRect);- void fullRefresh(KisNodeSP root, const QRect& rc, const QRect &cropRect);-void addSpontaneousJob(KisSpontaneousJob *spontaneousJob);bool hasUpdatesRunning() const;diff --git a/libs/image/tests/kis_base_node_test.cpp b/libs/image/tests/kis_base_node_test.cppindex c78d7f402c..a2e9dbaff3 100644--- a/libs/image/tests/kis_base_node_test.cpp+++ b/libs/image/tests/kis_base_node_test.cpp@@ -142,7 +142,7 @@ void KisBaseNodeTest::testOpacityKeyframing()context.layer->paintDevice()->fill(context.imageRect, originalColor);// Regenerate projection..- context.image->refreshGraph();+ context.image->initialRefreshGraph();{ // Before A (Opacity should be the same as A!)context.image->animationInterface()->switchCurrentTimeAsync(0);diff --git a/libs/image/tests/kis_clone_layer_test.cpp b/libs/image/tests/kis_clone_layer_test.cppindex 30a1d62eff..11aabc3349 100644--- a/libs/image/tests/kis_clone_layer_test.cpp+++ b/libs/image/tests/kis_clone_layer_test.cpp@@ -135,7 +135,7 @@ void KisCloneLayerTest::testOriginalRefresh()QCOMPARE(root->projection()->exactBounds(), nullRect);- image->refreshGraph();+ image->refreshGraphAsync();image->waitForDone();const QRect expectedRect(10,10,110,110);@@ -175,7 +175,7 @@ void KisCloneLayerTest::testRemoveSourceLayer()}// Are we crashing?- image->refreshGraph();+ image->refreshGraphAsync();image->waitForDone();}diff --git a/libs/image/tests/kis_image_animation_interface_test.cpp b/libs/image/tests/kis_image_animation_interface_test.cppindex 4543c33840..353aec6e9b 100644--- a/libs/image/tests/kis_image_animation_interface_test.cpp+++ b/libs/image/tests/kis_image_animation_interface_test.cpp@@ -58,7 +58,9 @@ void KisImageAnimationInterfaceTest::testFrameRegeneration()dev2->fill(rc2, KoColor(Qt::green, dev1->colorSpace()));QCOMPARE(dev2->exactBounds(), rc2);- p.image->refreshGraph();+ p.image->refreshGraphAsync();+ p.image->waitForDone();+checkFrame(i, p.image, 0, false, rc1 | rc2);}@@ -84,7 +86,8 @@ void KisImageAnimationInterfaceTest::testFrameRegeneration()dev2->fill(rc4, KoColor(Qt::green, dev2->colorSpace()));QCOMPARE(dev2->exactBounds(), rc4);- p.image->refreshGraph();+ p.image->refreshGraphAsync();+ p.image->waitForDone();checkFrame(i, p.image, 10, false, rc3 | rc4);}@@ -200,7 +203,7 @@ void KisImageAnimationInterfaceTest::testAnimationCompositionBug()KisKeyframeChannel *rasterChannel = layer2->getKeyframeChannel(KisKeyframeChannel::Raster.id());rasterChannel->addKeyframe(10, &parentCommand);- p.image->refreshGraph();+ p.image->initialRefreshGraph();m_image = p.image;connect(p.image->animationInterface(), SIGNAL(sigFrameReady(int)), this, SLOT(slotFrameDone()), Qt::DirectConnection);diff --git a/libs/image/tests/kis_image_test.cpp b/libs/image/tests/kis_image_test.cppindex e8e8ca82ba..fe0de68d8c 100644--- a/libs/image/tests/kis_image_test.cpp+++ b/libs/image/tests/kis_image_test.cpp@@ -186,7 +186,7 @@ void KisImageTest::testConvertImageColorSpace()image->addNode(paint1, image->root());image->addNode(blur1, image->root());- image->refreshGraph();+ image->initialRefreshGraph();const KoColorSpace *cs16 = KoColorSpaceRegistry::instance()->rgb16();image->convertImageColorSpace(cs16,@@ -203,7 +203,8 @@ void KisImageTest::testConvertImageColorSpace()QVERIFY(*cs16 == *paint1->compositeOp()->colorSpace());QVERIFY(*cs16 == *blur1->compositeOp()->colorSpace());- image->refreshGraph();+ image->refreshGraphAsync();+ image->waitForDone();}void KisImageTest::testAssignImageProfile()diff --git a/libs/image/tests/kis_update_scheduler_test.cpp b/libs/image/tests/kis_update_scheduler_test.cppindex 4b1eb13dbd..770a3fb50a 100644--- a/libs/image/tests/kis_update_scheduler_test.cpp+++ b/libs/image/tests/kis_update_scheduler_test.cpp@@ -76,7 +76,8 @@ void KisUpdateSchedulerTest::testMerge()* Test synchronous Full Refresh*/- scheduler.fullRefresh(rootLayer, image->bounds(), image->bounds());+ scheduler.fullRefreshAsync(rootLayer, image->bounds(), image->bounds());+ scheduler.waitForDone();QCOMPARE(rootLayer->exactBounds(), image->bounds());QImage resultFRProjection = rootLayer->projection()->convertToQImage(0);diff --git a/libs/libkis/Document.cpp b/libs/libkis/Document.cppindex 1dbf25b3b8..aa2d807932 100644--- a/libs/libkis/Document.cpp+++ b/libs/libkis/Document.cpp@@ -827,7 +827,9 @@ bool Document::tryBarrierLock()void Document::refreshProjection(){if (!d->document || !d->document->image()) return;- d->document->image()->refreshGraph();+ d->document->image()->refreshGraphAsync();+ d->document->image()->waitForDone();+}QList<qreal> Document::horizontalGuides() constdiff --git a/libs/libkis/tests/TestChannel.cpp b/libs/libkis/tests/TestChannel.cppindex 981f5cdc29..4595310f2b 100644--- a/libs/libkis/tests/TestChannel.cpp+++ b/libs/libkis/tests/TestChannel.cpp@@ -94,7 +94,8 @@ void TestChannel::testReadWritePixelData()QByteArray ba = greenChan->pixelData(rc);ba.fill('\x80', 4);greenChan->setPixelData(ba, rc);- image->refreshGraph();+ image->refreshGraphAsync();+ image->waitForDone();QColor c;layer->paintDevice()->pixel(0, 0, &c);QVERIFY(c == QColor(255, 128, 0));diff --git a/libs/ui/KisMainWindow.cpp b/libs/ui/KisMainWindow.cppindex 057176a30e..5580434859 100644--- a/libs/ui/KisMainWindow.cpp+++ b/libs/ui/KisMainWindow.cpp@@ -2218,7 +2218,9 @@ void KisMainWindow::importVideoAnimation()}activeView()->canvasBase()->refetchDataFromImage();- document->image()->refreshGraph();+ document->image()->refreshGraphAsync();+ document->image()->waitForDone();+}}diff --git a/libs/ui/KisSaveGroupVisitor.cpp b/libs/ui/KisSaveGroupVisitor.cppindex 07088364fb..21bbf1b812 100644--- a/libs/ui/KisSaveGroupVisitor.cpp+++ b/libs/ui/KisSaveGroupVisitor.cpp@@ -102,7 +102,7 @@ bool KisSaveGroupVisitor::visit(KisGroupLayer *layer)gc.bitBlt(QPoint(0, 0), layer->projection(), r);dst->addNode(paintLayer, dst->rootLayer(), KisLayerSP(0));- dst->refreshGraph();+ dst->initialRefreshGraph();}QString path = m_path + "/" + m_baseName + "_" + layer->name().replace(' ', '_') + '.' + m_extension;diff --git a/libs/ui/tests/filter_stroke_test.cpp b/libs/ui/tests/filter_stroke_test.cppindex 3df2909a88..3b32005a74 100644--- a/libs/ui/tests/filter_stroke_test.cpp+++ b/libs/ui/tests/filter_stroke_test.cpp@@ -33,8 +33,7 @@ protected:void initImage(KisImageWSP image, KisNodeSP activeNode) override {QImage src(QString(FILES_DATA_DIR) + '/' + "carrot.png");activeNode->original()->convertFromQImage(src, 0);-- image->refreshGraph();+ image->initialRefreshGraph();}KisStrokeStrategy* createStroke(KisResourcesSnapshotSP resources,diff --git a/libs/ui/tests/kis_prescaled_projection_test.cpp b/libs/ui/tests/kis_prescaled_projection_test.cppindex bbd57aeef2..76d058fe1c 100644--- a/libs/ui/tests/kis_prescaled_projection_test.cpp+++ b/libs/ui/tests/kis_prescaled_projection_test.cpp@@ -389,7 +389,8 @@ void KisPrescaledProjectionTest::testUpdates()"cleared"));t.layer->setVisible(true);- t.image->refreshGraph();+ t.image->refreshGraphAsync();+ t.image->waitForDone();// Update incrementallydiff --git a/libs/ui/tests/kis_zoom_and_pan_test.cpp b/libs/ui/tests/kis_zoom_and_pan_test.cppindex 61bb7fd0b6..80f7433730 100644--- a/libs/ui/tests/kis_zoom_and_pan_test.cpp+++ b/libs/ui/tests/kis_zoom_and_pan_test.cpp@@ -50,7 +50,7 @@ public:m_mainWindow = KisPart::instance()->createMainWindow();m_view = new KisView(m_doc, m_mainWindow->viewManager(), m_mainWindow);- m_image->refreshGraph();+ m_image->initialRefreshGraph();m_mainWindow->show();}diff --git a/plugins/dockers/compositiondocker/compositiondocker_dock.cpp b/plugins/dockers/compositiondocker/compositiondocker_dock.cppindex 8623ab7cc8..75ee2945fe 100644--- a/plugins/dockers/compositiondocker/compositiondocker_dock.cpp+++ b/plugins/dockers/compositiondocker/compositiondocker_dock.cpp@@ -298,8 +298,8 @@ void CompositionDockerDock::exportImageClicked()// d) Export Image.// This task can then be threaded to work in parallel.composition->apply();+ image->refreshGraphAsync();image->waitForDone();- image->refreshGraph();QRect r = image->bounds();@@ -313,7 +313,7 @@ void CompositionDockerDock::exportImageClicked()gc.bitBlt(QPoint(0, 0), image->rootLayer()->projection(), r);dst->addNode(paintLayer, dst->rootLayer(), KisLayerSP(0));- dst->refreshGraph();+ dst->refreshGraphAsync();dst->waitForDone();d->setFileBatchMode(true);@@ -326,8 +326,8 @@ void CompositionDockerDock::exportImageClicked()currentComposition->apply();+ image->refreshGraphAsync();image->waitForDone();- image->refreshGraph();}}@@ -375,8 +375,8 @@ void CompositionDockerDock::exportAnimationClicked()continue;composition->apply();+ image->refreshGraphAsync();image->waitForDone();- image->refreshGraph();KisTimeSpan range = image->animationInterface()->documentPlaybackRange();@@ -395,8 +395,8 @@ void CompositionDockerDock::exportAnimationClicked()}currentComposition->apply();+ image->refreshGraphAsync();image->waitForDone();- image->refreshGraph();}}diff --git a/plugins/extensions/imagesplit/imagesplit.cpp b/plugins/extensions/imagesplit/imagesplit.cppindex 5ffa58cd57..8405f5c300 100644--- a/plugins/extensions/imagesplit/imagesplit.cpp+++ b/plugins/extensions/imagesplit/imagesplit.cpp@@ -66,7 +66,7 @@ bool Imagesplit::saveAsImage(const QRect &imgSize, const QString &mimeType, consgc.bitBlt(QPoint(0, 0), image->projection(), imgSize);dst->addNode(paintLayer, KisNodeSP(0));- dst->refreshGraph();+ dst->initialRefreshGraph();}document->setFileBatchMode(true);if (!document->exportDocumentSync(url, mimeType.toLatin1())) {diff --git a/plugins/extensions/layergroupswitcher/layergroupswitcher.cpp b/plugins/extensions/layergroupswitcher/layergroupswitcher.cppindex fd69aa55ca..681a2d76c6 100644--- a/plugins/extensions/layergroupswitcher/layergroupswitcher.cpp+++ b/plugins/extensions/layergroupswitcher/layergroupswitcher.cpp@@ -78,7 +78,7 @@ void LayerGroupSwitcher::moveIntoNextGroup()}}}- image->refreshGraph();+ image->refreshGraphAsync();}@@ -119,7 +119,7 @@ void LayerGroupSwitcher::moveIntoPreviousGroup()}}}- image->refreshGraph();+ image->refreshGraphAsync();}#include "layergroupswitcher.moc"diff --git a/plugins/tools/tool_transform2/strokes/transform_stroke_strategy.cpp b/plugins/tools/tool_transform2/strokes/transform_stroke_strategy.cppindex 6e92372ea5..763f2814ba 100644--- a/plugins/tools/tool_transform2/strokes/transform_stroke_strategy.cpp+++ b/plugins/tools/tool_transform2/strokes/transform_stroke_strategy.cpp@@ -171,7 +171,7 @@ void TransformStrokeStrategy::doStrokeCallback(KisStrokeJobData *data)}}- clonedImage->refreshGraph();+ clonedImage->refreshGraphAsync();KisLayerUtils::refreshHiddenAreaAsync(clonedImage, cloneRoot, clonedImage->bounds());KisLayerUtils::forceAllDelayedNodesUpdate(cloneRoot);@@ -231,7 +231,7 @@ void TransformStrokeStrategy::doStrokeCallback(KisStrokeJobData *data)}});- clonedImage->refreshGraph();+ clonedImage->refreshGraphAsync();KisLayerUtils::refreshHiddenAreaAsync(clonedImage, clonedGroup, clonedImage->bounds());KisLayerUtils::forceAllDelayedNodesUpdate(clonedGroup);