Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_stroke_job.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2011 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef __KIS_STROKE_JOB_H
8#define __KIS_STROKE_JOB_H
9
12
13class KRITAIMAGE_EXPORT KisStrokeJob : public KisRunnableWithDebugName
14{
15public:
17 KisStrokeJobData *data,
18 int levelOfDetail,
19 bool isOwnJob)
20 : m_dabStrategy(strategy),
21 m_dabData(data),
22 m_levelOfDetail(levelOfDetail),
23 m_isOwnJob(isOwnJob)
24 {
25 }
26
27 ~KisStrokeJob() override {
28 delete m_dabData;
29 }
30
31 void run() override {
32 m_dabStrategy->run(m_dabData);
33 }
34
36 return m_dabData ? m_dabData->sequentiality() : KisStrokeJobData::SEQUENTIAL;
37 }
38
39 bool isSequential() const {
40 // Default value is 'SEQUENTIAL'
41 return m_dabData ? m_dabData->isSequential() : true;
42 }
43
44 bool isBarrier() const {
45 // Default value is simply 'SEQUENTIAL', *not* 'BARRIER'
46 return m_dabData ? m_dabData->isBarrier() : false;
47 }
48
49 bool isExclusive() const {
50 // Default value is 'NORMAL'
51 return m_dabData ? m_dabData->isExclusive() : false;
52 }
53
54 int levelOfDetail() const {
55 return m_dabData && m_dabData->levelOfDetailOverride() >= 0 ?
56 m_dabData->levelOfDetailOverride() : m_levelOfDetail;
57 }
58
59 bool isCancellable() const {
60 return m_isOwnJob &&
61 (!m_dabData || m_dabData->isCancellable());
62 }
63
64 bool isOwnJob() const {
65 return m_isOwnJob;
66 }
67
68 QString debugName() const override {
69 return m_dabStrategy->debugId();
70 }
71
72private:
73 // for testing use only, do not use in real code
74 friend QString getJobName(KisStrokeJob *job);
75 friend QString getCommandName(KisStrokeJob *job);
76 friend int cancelSeqNo(KisStrokeJob *job);
77
79 return m_dabStrategy;
80 }
81
83 return m_dabData;
84 }
85
86private:
87 // Shared between different jobs
89
90 // Owned by the job
92
95};
96
97#endif /* __KIS_STROKE_JOB_H */
KisStrokeJobData * m_dabData
bool isOwnJob() const
~KisStrokeJob() override
bool isSequential() const
friend QString getJobName(KisStrokeJob *job)
bool isExclusive() const
QString debugName() const override
bool isCancellable() const
KisStrokeJobData::Sequentiality sequentiality() const
bool isBarrier() const
KisStrokeJobStrategy * testingGetDabStrategy()
friend int cancelSeqNo(KisStrokeJob *job)
KisStrokeJob(KisStrokeJobStrategy *strategy, KisStrokeJobData *data, int levelOfDetail, bool isOwnJob)
KisStrokeJobStrategy * m_dabStrategy
int levelOfDetail() const
friend QString getCommandName(KisStrokeJob *job)
KisStrokeJobData * testingGetDabData()
void run() override