Krita Source Code Documentation
Loading...
Searching...
No Matches
kis_simple_update_queue.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2010 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef __KIS_SIMPLE_UPDATE_QUEUE_H
8#define __KIS_SIMPLE_UPDATE_QUEUE_H
9
10#include <QMutex>
11#include "kis_updater_context.h"
13
15typedef QListIterator<KisBaseRectsWalkerSP> KisWalkersListIterator;
16typedef QMutableListIterator<KisBaseRectsWalkerSP> KisMutableWalkersListIterator;
17
19typedef QListIterator<KisSpontaneousJob*> KisSpontaneousJobsListIterator;
20typedef QMutableListIterator<KisSpontaneousJob*> KisMutableSpontaneousJobsListIterator;
21
22
23class KRITAIMAGE_EXPORT KisSimpleUpdateQueue
24{
25public:
27 virtual ~KisSimpleUpdateQueue();
28
29 void processQueue(KisUpdaterContext &updaterContext);
30
31 void addUpdateJob(KisNodeSP node, const QVector<QRect> &rects, const QRect& cropRect, int levelOfDetail, KisProjectionUpdateFlags flags);
32 void addFullRefreshJob(KisNodeSP node, const QVector<QRect> &rects, const QRect& cropRect, int levelOfDetail, KisProjectionUpdateFlags flags);
33
34 // simplified overload for testing purposes only
35 void addUpdateJob(KisNodeSP node, const QRect &rc, const QRect& cropRect, int levelOfDetail);
36
37 // simplified overload for testing purposes only
38 void addFullRefreshJob(KisNodeSP node, const QRect &rc, const QRect& cropRect, int levelOfDetail);
39
40 void addSpontaneousJob(KisSpontaneousJob *spontaneousJob);
41
42
43 void optimize();
44
45 bool isEmpty() const;
46 qint32 sizeMetric() const;
47
48 void updateSettings();
49
50 int overrideLevelOfDetail() const;
51
52protected:
53 void addJob(KisNodeSP node, const QVector<QRect> &rects, const QRect& cropRect, int levelOfDetail, KisBaseRectsWalker::UpdateType type, bool dontInvalidateFrames);
54
55 bool processOneJob(KisUpdaterContext &updaterContext);
56
57 bool trySplitJob(KisNodeSP node, const QRect& rc, const QRect& cropRect, int levelOfDetail, KisBaseRectsWalker::UpdateType type, bool dontInvalidateFrames);
58 bool tryMergeJob(KisNodeSP node, const QRect& rc, const QRect& cropRect, int levelOfDetail, KisBaseRectsWalker::UpdateType type, bool dontInvalidateFrames);
59
60 void collectJobs(KisBaseRectsWalkerSP &baseWalker, QRect baseRect,
61 const qreal maxAlpha);
62 bool joinRects(QRect& baseRect, const QRect& newRect, qreal maxAlpha);
63
64protected:
65
66 mutable QMutex m_lock;
69
82
87
93
98
100};
101
103{
104public:
105 KisWalkersList& getWalkersList();
106 KisSpontaneousJobsList& getSpontaneousJobsList();
107};
108
109#endif /* __KIS_SIMPLE_UPDATE_QUEUE_H */
110
KisSpontaneousJobsList m_spontaneousJobsList
QListIterator< KisSpontaneousJob * > KisSpontaneousJobsListIterator
QList< KisSpontaneousJob * > KisSpontaneousJobsList
QListIterator< KisBaseRectsWalkerSP > KisWalkersListIterator
QMutableListIterator< KisSpontaneousJob * > KisMutableSpontaneousJobsListIterator
QList< KisBaseRectsWalkerSP > KisWalkersList
QMutableListIterator< KisBaseRectsWalkerSP > KisMutableWalkersListIterator