本文整理汇总了C++中KisImageSP::barrierLock方法的典型用法代码示例。如果您正苦于以下问题:C++ KisImageSP::barrierLock方法的具体用法?C++ KisImageSP::barrierLock怎么用?C++ KisImageSP::barrierLock使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KisImageSP
的用法示例。
在下文中一共展示了KisImageSP::barrierLock方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: run
void KisCutCopyActionFactory::run(bool willCut, KisView2 *view)
{
KisImageSP image = view->image();
bool haveShapesSelected = view->selectionManager()->haveShapesSelected();
if (haveShapesSelected) {
#ifdef __GNUC__
#warning "Add saving of XML data for Cut/Copy of shapes"
#endif
image->barrierLock();
if (willCut) {
view->canvasBase()->toolProxy()->cut();
} else {
view->canvasBase()->toolProxy()->copy();
}
image->unlock();
} else {
KisNodeSP node = view->activeNode();
if (!node) return;
image->barrierLock();
ActionHelper::copyFromDevice(view, node->paintDevice());
image->unlock();
KUndo2Command *command = 0;
if (willCut && node->isEditable()) {
struct ClearSelection : public KisTransactionBasedCommand {
ClearSelection(KisNodeSP node, KisSelectionSP sel)
: m_node(node), m_sel(sel) {}
KisNodeSP m_node;
KisSelectionSP m_sel;
KUndo2Command* paint() {
KisTransaction transaction("", m_node->paintDevice());
m_node->paintDevice()->clearSelection(m_sel);
m_node->setDirty(m_sel->selectedRect());
return transaction.endAndTake();
}
};
command = new ClearSelection(node, view->selection());
}
QString actionName = willCut ? i18n("Cut") : i18n("Copy");
KisProcessingApplicator *ap = beginAction(view, actionName);
if (command) {
ap->applyCommand(command,
KisStrokeJobData::SEQUENTIAL,
KisStrokeJobData::NORMAL);
}
KisOperationConfiguration config(id());
config.setProperty("will-cut", willCut);
endAction(ap, config.toXML());
}
}