46 m_resources(resources),
47 m_strokeInfos(strokeInfos),
50 m_supportsMaskingBrush(false),
51 m_supportsIndirectPainting(false)
61 m_resources(resources),
65 m_supportsMaskingBrush(false),
66 m_supportsIndirectPainting(false)
87 m_resources(rhs.m_resources),
88 m_useMergeID(rhs.m_useMergeID),
89 m_supportsMaskingBrush(rhs.m_supportsMaskingBrush),
90 m_supportsIndirectPainting(rhs.m_supportsIndirectPainting),
91 m_supportsContinuedInterstrokeData(rhs.m_supportsContinuedInterstrokeData)
102 "After the stroke has been started, no copying must happen");
135 Q_FOREACH (
const QRect &rc, rects) {
189 bool hasIndirectPainting,
190 const QString &indirectPaintingCompositeOp)
199 if(hasIndirectPainting) {
213 painter->
begin(maskingDevice,
nullptr);
261 if (autoKeyframeCommand) {
274 if (hasIndirectPainting) {
292 hasIndirectPainting =
false;
296 QScopedPointer<KisInterstrokeDataFactory> interstrokeDataFactory(
300 interstrokeDataFactory.reset();
303 QScopedPointer<KisInterstrokeDataTransactionWrapperFactory> wrapper;
305 if (interstrokeDataFactory) {
307 interstrokeDataFactory.take(),
319 if (hasIndirectPainting &&
323 const QString compositeOpId =
332 indirectCompositeOp);
360 : m_compatibilityInfo(*resourcesSnapshot)
365 if(_other->
timedId() == this->timedId() && _other->
timedId() != -1 ) {
366 const bool isCompatible =
368 MergeableStrokeUndoCommand *other =
369 dynamic_cast<MergeableStrokeUndoCommand*
>(cmd);
370 return other && m_compatibilityInfo == other->m_compatibilityInfo;
409 parentCommand.reset(
new MergeableStrokeUndoCommand(
m_resources));
410 parentCommand->setTimedID(
timedID(this->
id()));
413 parentCommand->setText(
name());
414 parentCommand->setTime(
m_transaction->undoCommand()->time());
415 parentCommand->setEndTime(QTime::currentTime());
431 parentCommand.data(),
437 [parentCommand, undoAdapter] () {
438 parentCommand->redo();
463 parentCommand->redo();
float value(const T *src, size_t ch)
virtual bool timedMergeWith(KUndo2Command *other)
virtual int timedId() const
The KisDumbUndoStore class doesn't actually save commands, so you cannot undo or redo!
KisPaintDeviceSP createCompositionSourceDevice() const
void setParentNode(KisNodeWSP parent)
static KisPaintOpRegistry * instance()
void initPainters(KisPaintDeviceSP targetDevice, KisPaintDeviceSP maskingDevice, KisSelectionSP selection, bool hasIndirectPainting, const QString &indirectPaintingCompositeOp)
KisIndirectPaintingSupport::FinalMergeSuspenderSP m_finalMergeSuspender
void setSupportsContinuedInterstrokeData(bool value)
QVector< KisFreehandStrokeInfo * > m_maskStrokeInfos
QScopedPointer< FakeUndoData > m_fakeUndoData
bool supportsMaskingBrush() const
bool needsMaskingUpdates() const
bool m_supportsIndirectPainting
void setSupportsMaskingBrush(bool value)
KisPaintDeviceSP targetDevice() const
void suspendStrokeCallback() override
void setSupportsIndirectPainting(bool value)
KisPainterBasedStrokeStrategy(const QLatin1String &id, const KUndo2MagicString &name, KisResourcesSnapshotSP resources, QVector< KisFreehandStrokeInfo * > strokeInfos)
KisPaintDeviceSP m_targetDevice
KisSelectionSP m_activeSelection
void setSupportsTimedMergeId(bool value)
bool m_supportsMaskingBrush
QVector< KisMaskedFreehandStrokePainter * > m_maskedPainters
~KisPainterBasedStrokeStrategy()
KisMaskedFreehandStrokePainter * maskedPainter(int strokeInfoId)
int numMaskedPainters() const
int timedID(const QString &id)
bool supportsTimedMergeId() const
QScopedPointer< KisMaskingBrushRenderer > m_maskingBrushRenderer
void finishStrokeCallback() override
void resumeStrokeCallback() override
bool supportsIndirectPainting() const
void initStrokeCallback() override
KisNodeSP targetNode() const
QVector< KisRunnableStrokeJobData * > doMaskingBrushUpdates(const QVector< QRect > &rects)
KisSelectionSP activeSelection() const
QScopedPointer< KUndo2Command > m_autokeyCommand
void cancelStrokeCallback() override
bool m_supportsContinuedInterstrokeData
QVector< KisFreehandStrokeInfo * > m_strokeInfos
KisResourcesSnapshotSP m_resources
QScopedPointer< KisTransaction > m_transaction
bool supportsContinuedInterstrokeData() const
void begin(KisPaintDeviceSP device)
void setRunnableStrokeJobsInterface(KisRunnableStrokeJobsInterface *interface)
void setChannelFlags(QBitArray channelFlags)
void setCompositeOpId(const KoCompositeOp *op)
void addCommand(KUndo2CommandSP command)
void setupPainter(KisPainter *painter)
KisPaintOpPresetSP currentPaintOpPreset() const
QString compositeOpId() const
void setupMaskingBrushPainter(KisPainter *painter)
bool needsIndirectPainting() const
QString indirectPaintingCompositeOp() const
KisNodeSP currentNode() const
QBitArray channelLockFlags() const
KoColor currentFgColor() const
KisPostExecutionUndoAdapter * postExecutionUndoAdapter() const
bool needsMaskingBrushRendering() const
KisSelectionSP activeSelection() const
KisRunnableStrokeJobsInterface * runnableJobsInterface() const
virtual void addRunnableJobs(const QVector< KisRunnableStrokeJobDataBase * > &list)=0
static auto unwrap(Command *cmd, Func &&func) -> decltype(func(static_cast< Command * >(nullptr)))
void enableJob(JobType type, bool enable=true, KisStrokeJobData::Sequentiality sequentiality=KisStrokeJobData::SEQUENTIAL, KisStrokeJobData::Exclusivity exclusivity=KisStrokeJobData::NORMAL)
void setCancellable(bool value)
KUndo2MagicString name() const
#define KIS_SAFE_ASSERT_RECOVER(cond)
#define KIS_SAFE_ASSERT_RECOVER_RETURN_VALUE(cond, val)
#define KIS_ASSERT_RECOVER_RETURN(cond)
#define KIS_ASSERT_RECOVER_NOOP(cond)
#define KIS_SAFE_ASSERT_RECOVER_NOOP(cond)
KUndo2Command * tryAutoCreateDuplicatedFrame(KisPaintDeviceSP device, AutoCreateKeyframeFlags flags)
create a new duplicated keyframe if auto-keyframe mode is on
void addJobConcurrent(QVector< Job * > &jobs, Func func)
void addJobSequential(QVector< Job * > &jobs, Func func)
void addJobBarrier(QVector< Job * > &jobs, Func func)
virtual KisPaintDeviceSP paintDevice() const =0
void addCommand(KUndo2Command *cmd)
void setTemporaryChannelFlags(const QBitArray &channelFlags)
virtual void mergeToLayerThreaded(KisNodeSP layer, KUndo2Command *parentCommand, const KUndo2MagicString &transactionText, int timedID, QVector< KisRunnableStrokeJobData * > *jobs)
KisSelectionSP temporarySelection() const
virtual void setCurrentColor(const KoColor &color)
KisPaintDeviceSP temporaryTarget
void setTemporaryTarget(KisPaintDeviceSP t)
void setTemporaryOpacity(qreal o)
bool hasTemporaryTarget() const
FinalMergeSuspenderSP trySuspendFinalMerge()
void setTemporarySelection(KisSelectionSP selection)
void setTemporaryCompositeOp(const QString &id)
QScopedPointer< KisPostExecutionUndoAdapter > undoAdapter
QScopedPointer< KisUndoStore > undoStore