|
Krita Source Code Documentation
|
#include <kis_suspend_projection_updates_stroke_strategy.h>
Inheritance diagram for KisSuspendProjectionUpdatesStrokeStrategy:Classes | |
| struct | Private |
| struct | SharedData |
| struct | SuspendUpdatesFilterInterface |
Public Types | |
| using | SharedDataSP = QSharedPointer<SharedData> |
Public Types inherited from KisSimpleStrokeStrategy | |
| enum | JobType { JOB_INIT = 0 , JOB_CANCEL , JOB_FINISH , JOB_DOSTROKE , JOB_SUSPEND , JOB_RESUME , NJOBS } |
Static Public Member Functions | |
| static QList< KisStrokeJobData * > | createResumeJobsData (KisImageWSP image) |
| static SharedDataSP | createSharedData () |
| static QList< KisStrokeJobData * > | createSuspendJobsData (KisImageWSP image) |
Static Public Member Functions inherited from KisSimpleStrokeStrategy | |
| static QLatin1String | jobTypeToString (JobType type) |
Private Member Functions | |
| void | cancelStrokeCallback () override |
| void | doStrokeCallback (KisStrokeJobData *data) override |
| void | initStrokeCallback () override |
| void | resumeStrokeCallback () override |
| void | suspendStrokeCallback () override |
Private Attributes | |
| const QScopedPointer< Private > | m_d |
Additional Inherited Members | |
Protected Member Functions inherited from KisSimpleStrokeStrategy | |
| void | enableJob (JobType type, bool enable=true, KisStrokeJobData::Sequentiality sequentiality=KisStrokeJobData::SEQUENTIAL, KisStrokeJobData::Exclusivity exclusivity=KisStrokeJobData::NORMAL) |
| KisSimpleStrokeStrategy (const KisSimpleStrokeStrategy &rhs) | |
Protected Member Functions inherited from KisStrokeStrategy | |
| void | addMutatedJob (KisStrokeJobData *data) |
| void | addMutatedJobs (const QVector< KisStrokeJobData * > list) |
| KisStrokeStrategy (const KisStrokeStrategy &rhs) | |
| void | setAsynchronouslyCancellable (bool value) |
| void | setBalancingRatioOverride (qreal value) |
| void | setCanForgetAboutMe (bool value) |
| void | setClearsRedoOnStart (bool value) |
| void | setExclusive (bool value) |
| void | setNeedsExplicitCancel (bool value) |
| void | setRequestsOtherStrokesToEnd (bool value) |
| void | setSupportsWrapAroundMode (bool value) |
Definition at line 15 of file kis_suspend_projection_updates_stroke_strategy.h.
Definition at line 26 of file kis_suspend_projection_updates_stroke_strategy.h.
| KisSuspendProjectionUpdatesStrokeStrategy::KisSuspendProjectionUpdatesStrokeStrategy | ( | KisImageWSP | image, |
| bool | suspend, | ||
| SharedDataSP | sharedData ) |
Here we add a dumb INIT job so that KisStrokesQueue would know that the stroke has already started or not. When the queue reaches the resume stroke and starts its execution, no Lod0 can execute anymore. So all the new Lod0 strokes should go to the end of the queue and wrapped into their own Suspend/Resume pair.
Definition at line 424 of file kis_suspend_projection_updates_stroke_strategy.cpp.
References KisStrokeJobData::BARRIER, KisSimpleStrokeStrategy::enableJob(), KisSimpleStrokeStrategy::JOB_CANCEL, KisSimpleStrokeStrategy::JOB_DOSTROKE, KisSimpleStrokeStrategy::JOB_INIT, KisSimpleStrokeStrategy::JOB_RESUME, KisSimpleStrokeStrategy::JOB_SUSPEND, m_d, KisStrokeStrategy::setClearsRedoOnStart(), and KisStrokeStrategy::setNeedsExplicitCancel().
|
override |
Definition at line 453 of file kis_suspend_projection_updates_stroke_strategy.cpp.
References m_d.
|
overrideprivatevirtual |
We shouldn't Q_EMIT any ad-hoc updates when cancelling the stroke. It generates weird temporary holes on the canvas, making the user feel awful, thinking his image got corrupted. We will just Q_EMIT a common refreshGraphAsync() that will do all the work in a beautiful way
Reimplemented from KisSimpleStrokeStrategy.
Definition at line 569 of file kis_suspend_projection_updates_stroke_strategy.cpp.
References KisImageSignalRouter::emitRequestLodPlanesSyncBlocked(), m_d, KisImage::refreshGraphAsync(), and KisImage::signalRouter().
|
static |
Definition at line 530 of file kis_suspend_projection_updates_stroke_strategy.cpp.
|
static |
Definition at line 535 of file kis_suspend_projection_updates_stroke_strategy.cpp.
References toQShared().
|
static |
Definition at line 525 of file kis_suspend_projection_updates_stroke_strategy.cpp.
|
overrideprivatevirtual |
When the Lod0 stroke is being recalculated in the background we should block all the updates it issues to avoid user distraction. The result of the final stroke should be shown to the user in the very end when everything is fully ready. Ideally the use should not notice that the image has changed :)
(Don't mix this process with suspend/resume capabilities of a single stroke. That is a different system!)
The process of the Lod0 regeneration consists of the following:
1) Suspend stroke executes. It sets a special updates filter on the image. The filter blocks all the updates and saves them in an internal structure to be emitted in the future.
2) Lod0 strokes are being recalculated. All their updates are blocked and saved in the filter.
3) Resume stroke starts:
3.1) First it disables emitting of sigImageUpdated() so the gui
will not get any update notifications.
3.2) Then it enables updates themselves.
3.3) Initiates all the updates that were requested by the Lod0
stroke. The node graph is regenerated, but the GUI does
not get this change.
3.4) Special barrier job waits for all the updates to finish
and, when they are done, enables GUI notifications again.
3.5) In a multithreaded way emits the GUI notifications for the
entire image. Multithreaded way is used to conform the
double-stage update principle of KisCanvas2.
Reimplemented from KisRunnableBasedStrokeStrategy.
Definition at line 512 of file kis_suspend_projection_updates_stroke_strategy.cpp.
References m_d, and KisRunnable::run().
|
overrideprivatevirtual |
Reimplemented from KisSimpleStrokeStrategy.
Definition at line 458 of file kis_suspend_projection_updates_stroke_strategy.cpp.
References KisRunnableStrokeJobsInterface::addRunnableJobs(), m_d, and KisRunnableBasedStrokeStrategy::runnableJobsInterface().
|
overrideprivatevirtual |
Reimplemented from KisSimpleStrokeStrategy.
Definition at line 621 of file kis_suspend_projection_updates_stroke_strategy.cpp.
References KisRunnableStrokeJobsInterface::addRunnableJobs(), m_d, and KisRunnableBasedStrokeStrategy::runnableJobsInterface().
|
overrideprivatevirtual |
The resume stroke can be suspended even when all its jobs are completed. In such a case, we should just ensure that all the internal state is reset to default.
Reimplemented from KisSimpleStrokeStrategy.
Definition at line 599 of file kis_suspend_projection_updates_stroke_strategy.cpp.
References KIS_SAFE_ASSERT_RECOVER_NOOP, and m_d.
|
private |
Definition at line 46 of file kis_suspend_projection_updates_stroke_strategy.h.