Commit e16e9ff5 authored by Dmitry Kazakov's avatar Dmitry Kazakov Committed by Ashwin Dhakaita

Fix artifacts when saving vector layers into PNG files

This patch has two parts:

1) KisShapeLayer should block the updates of the shape-canvas.
   When shapes are added to the layer, they initiate shape
   manager updates. That is not what we want, because all the
   rendered pixel data has already been copied in initShapeLayer()
   call.

2) Add a sanity check in KisDocument::initiateSavingInBackground().
   Theoretically, there should be no pending updates after cloning
   operation. But if they still appear somehow (which is a bug),
   just force them wait until they complete their execution.

BUG:404976
CCBUG:404742
parent d2f502e9
......@@ -843,6 +843,23 @@ bool KisDocument::initiateSavingInBackground(const QString actionName,
waitForImage(clonedDocument->image());
}
auto waitForImage = [] (KisImageSP image) {
KisMainWindow *window = KisPart::instance()->currentMainwindow();
if (window) {
if (window->viewManager()) {
window->viewManager()->blockUntilOperationsFinishedForced(image);
}
}
};
{
KisNodeSP newRoot = clonedDocument->image()->root();
KIS_SAFE_ASSERT_RECOVER(!KisLayerUtils::hasDelayedNodeWithUpdates(newRoot)) {
KisLayerUtils::forceAllDelayedNodesUpdate(newRoot);
waitForImage(clonedDocument->image());
}
}
KIS_ASSERT_RECOVER_RETURN_VALUE(!d->backgroundSaveDocument, false);
KIS_ASSERT_RECOVER_RETURN_VALUE(!d->backgroundSaveJob.isValid(), false);
d->backgroundSaveDocument.reset(clonedDocument.take());
......
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