|
Krita Source Code Documentation
|
#include <kis_indirect_painting_support.h>
Inheritance diagram for KisIndirectPaintingSupport:Classes | |
| struct | FinalMergeSuspender |
| struct | ReadLocker |
| struct | WriteLocker |
Public Types | |
| using | FinalMergeSuspenderSP = QSharedPointer<FinalMergeSuspender> |
Public Member Functions | |
| bool | hasTemporaryTarget () const |
| KisIndirectPaintingSupport () | |
| void | mergeToLayer (KisNodeSP layer, KUndo2Command *parentCommand, const KUndo2MagicString &transactionText, int timedID) |
| virtual void | mergeToLayerThreaded (KisNodeSP layer, KUndo2Command *parentCommand, const KUndo2MagicString &transactionText, int timedID, QVector< KisRunnableStrokeJobData * > *jobs) |
| virtual void | setCurrentColor (const KoColor &color) |
| void | setTemporaryChannelFlags (const QBitArray &channelFlags) |
| void | setTemporaryCompositeOp (const QString &id) |
| void | setTemporaryOpacity (qreal o) |
| void | setTemporarySelection (KisSelectionSP selection) |
| void | setTemporaryTarget (KisPaintDeviceSP t) |
| void | setupTemporaryPainter (KisPainter *painter) const |
| virtual bool | supportsNonIndirectPainting () const |
| KisPaintDeviceSP | temporaryTarget () const |
| FinalMergeSuspenderSP | trySuspendFinalMerge () |
| virtual | ~KisIndirectPaintingSupport () |
Public Member Functions inherited from Private | |
| Private (KisCanvas2 *c) | |
Public Attributes | |
| QBitArray | channelFlags |
| QString | compositeOp |
| qreal | compositeOpacity |
| bool | finalMergeInProgress = true |
| QReadWriteLock | lock |
| KisSelectionSP | selection |
| KisPaintDeviceSP | temporaryTarget |
Public Attributes inherited from Private | |
| KisCanvas2 * | canvas |
| int | displayedFrame |
| int | intendedFrame |
Protected Types | |
| using | WriteLockerSP = QSharedPointer<WriteLocker> |
Protected Member Functions | |
| void | lockTemporaryTargetForWrite () const |
| void | mergeToLayerImpl (KisPaintDeviceSP dst, KUndo2Command *parentCommand, const KUndo2MagicString &transactionText, int timedID, bool cleanResources, WriteLockerSP sharedWriteLock, QVector< KisRunnableStrokeJobData * > *jobs) |
| void | releaseResources () |
| QString | temporaryCompositeOp () const |
| virtual void | writeMergeData (KisPainter *painter, KisPaintDeviceSP src, const QRect &rc) |
Private Member Functions | |
| KisIndirectPaintingSupport (const KisIndirectPaintingSupport &) | |
| void | lockTemporaryTarget () const |
| KisIndirectPaintingSupport & | operator= (const KisIndirectPaintingSupport &) |
| KisSelectionSP | temporarySelection () const |
| void | unlockTemporaryTarget () const |
Private Attributes | |
| Private *const | d |
Friends | |
| class | KisPainterBasedStrokeStrategy |
For classes that support indirect painting.
XXX: Name doesn't suggest an object – is KisIndirectPaintingLayer a better name? (BSAR)
Definition at line 25 of file kis_indirect_painting_support.cpp.
Definition at line 94 of file kis_indirect_painting_support.h.
|
protected |
Definition at line 149 of file kis_indirect_painting_support.h.
|
private |
| KisIndirectPaintingSupport::KisIndirectPaintingSupport | ( | ) |
Definition at line 38 of file kis_indirect_painting_support.cpp.
|
virtual |
| bool KisIndirectPaintingSupport::hasTemporaryTarget | ( | ) | const |
Definition at line 120 of file kis_indirect_painting_support.cpp.
References d.
|
private |
Lock the temporary target. It should be done for guarding every access to temporaryTarget() or original() NOTE: well, not "every", but...
Definition at line 78 of file kis_indirect_painting_support.cpp.
References d.
|
protected |
Definition at line 83 of file kis_indirect_painting_support.cpp.
References d.
| void KisIndirectPaintingSupport::mergeToLayer | ( | KisNodeSP | layer, |
| KUndo2Command * | parentCommand, | ||
| const KUndo2MagicString & | transactionText, | ||
| int | timedID ) |
Writes the temporary target into the paint device of the layer. This action will lock the temporary target itself.
When merging, we use barrier jobs only for ensuring that the merge jobs are not split by the update jobs. Merge jobs hold the shared lock, so forcing them out of CPU will basically cause a deadlock. When running in the fake executor, the jobs cannot be split anyway, so there is no danger in that.
Definition at line 133 of file kis_indirect_painting_support.cpp.
References KisFakeRunnableStrokeJobsExecutor::addRunnableJobs(), KisFakeRunnableStrokeJobsExecutor::AllowBarrierJobs, and mergeToLayerThreaded().
|
protected |
Move tool may not have an undo adapter
Brushes don't apply the selection, we apply that during the indirect painting merge operation. It is cheaper calculation-wise.
Definition at line 172 of file kis_indirect_painting_support.cpp.
References KritaUtils::addJobConcurrent(), KritaUtils::addJobSequential(), d, releaseResources(), setupTemporaryPainter(), void(), and writeMergeData().
|
virtual |
We create the lock in an unlocked state to avoid a deadlock, when layer-stack updating jobs push out the stroke jobs from the CPU and start sleeping on lockTemporaryTarget().
Now wait for all update jobs to finish and lock the indirect target
Reimplemented in KisColorizeMask.
Definition at line 149 of file kis_indirect_painting_support.cpp.
References KritaUtils::addJobBarrier(), mergeToLayerImpl(), and KisBaseNode::paintDevice().
|
private |
|
protected |
Definition at line 235 of file kis_indirect_painting_support.cpp.
References COMPOSITE_OVER, d, and OPACITY_OPAQUE_F.
Reimplemented in KisColorizeMask.
Definition at line 48 of file kis_indirect_painting_support.cpp.
| void KisIndirectPaintingSupport::setTemporaryChannelFlags | ( | const QBitArray & | channelFlags | ) |
Definition at line 68 of file kis_indirect_painting_support.cpp.
References channelFlags, and d.
| void KisIndirectPaintingSupport::setTemporaryCompositeOp | ( | const QString & | id | ) |
Definition at line 58 of file kis_indirect_painting_support.cpp.
References d.
| void KisIndirectPaintingSupport::setTemporaryOpacity | ( | qreal | o | ) |
Definition at line 63 of file kis_indirect_painting_support.cpp.
References d.
| void KisIndirectPaintingSupport::setTemporarySelection | ( | KisSelectionSP | selection | ) |
Definition at line 73 of file kis_indirect_painting_support.cpp.
| void KisIndirectPaintingSupport::setTemporaryTarget | ( | KisPaintDeviceSP | t | ) |
Definition at line 53 of file kis_indirect_painting_support.cpp.
References d.
| void KisIndirectPaintingSupport::setupTemporaryPainter | ( | KisPainter * | painter | ) | const |
Configures the painter to conform the painting parameters stored for th temporary target, such as compositeOp, opacity, channel flags and selection. Please do not setup them manually, but use this function instead.
Definition at line 125 of file kis_indirect_painting_support.cpp.
References d, KisPainter::setChannelFlags(), KisPainter::setCompositeOpId(), KisPainter::setOpacityF(), and KisPainter::setSelection().
|
virtual |
Reimplemented in KisColorizeMask.
Definition at line 100 of file kis_indirect_painting_support.cpp.
|
protected |
Definition at line 110 of file kis_indirect_painting_support.cpp.
References d.
|
private |
Only for debugging purposes. Please use setupTemporaryPainter() instead.
Definition at line 115 of file kis_indirect_painting_support.cpp.
References d.
| KisPaintDeviceSP KisIndirectPaintingSupport::temporaryTarget | ( | ) | const |
| KisIndirectPaintingSupport::FinalMergeSuspenderSP KisIndirectPaintingSupport::trySuspendFinalMerge | ( | ) |
When the stroke uses multithreaded final merge and supports suspension, then it should also suspend the final merge explicitly by requesting a special RAII object for the whole period of suspension.
Definition at line 105 of file kis_indirect_painting_support.cpp.
References d, and toQShared().
|
private |
Unlock the temporary target
Definition at line 89 of file kis_indirect_painting_support.cpp.
References d.
|
protectedvirtual |
Reimplemented in KisColorizeMask.
Definition at line 230 of file kis_indirect_painting_support.cpp.
References KisPainter::bitBlt().
|
friend |
Definition at line 175 of file kis_indirect_painting_support.h.
| QBitArray KisIndirectPaintingSupport::channelFlags |
Definition at line 30 of file kis_indirect_painting_support.cpp.
| QString KisIndirectPaintingSupport::compositeOp |
Definition at line 28 of file kis_indirect_painting_support.cpp.
| qreal KisIndirectPaintingSupport::compositeOpacity |
Definition at line 29 of file kis_indirect_painting_support.cpp.
|
private |
Definition at line 185 of file kis_indirect_painting_support.h.
| bool KisIndirectPaintingSupport::finalMergeInProgress = true |
Definition at line 34 of file kis_indirect_painting_support.cpp.
| QReadWriteLock KisIndirectPaintingSupport::lock |
Definition at line 33 of file kis_indirect_painting_support.cpp.
| KisSelectionSP KisIndirectPaintingSupport::selection |
Definition at line 31 of file kis_indirect_painting_support.cpp.
| KisPaintDeviceSP KisIndirectPaintingSupport::temporaryTarget |
Definition at line 27 of file kis_indirect_painting_support.cpp.