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
49 bool isEmpty() const;
50
58 bool isIdle() const;
59
60 qint32 sizeMetric() const;
61
62 void updateSettings();
63
64 int overrideLevelOfDetail() const;
65
66protected:
67 void addJob(KisNodeSP node, const QVector<QRect> &rects, const QRect& cropRect, int levelOfDetail, KisBaseRectsWalker::UpdateType type, bool dontInvalidateFrames);
68
69 bool processOneJob(KisUpdaterContext &updaterContext);
70
71 bool trySplitJob(KisNodeSP node, const QRect& rc, const QRect& cropRect, int levelOfDetail, KisBaseRectsWalker::UpdateType type, bool dontInvalidateFrames);
72 bool tryMergeJob(KisNodeSP node, const QRect& rc, const QRect& cropRect, int levelOfDetail, KisBaseRectsWalker::UpdateType type, bool dontInvalidateFrames);
73
74 void collectJobs(KisBaseRectsWalkerSP &baseWalker, QRect baseRect,
75 const qreal maxAlpha);
76 bool joinRects(QRect& baseRect, const QRect& newRect, qreal maxAlpha);
77
78protected:
79
80 mutable QMutex m_lock;
83
96
101
107
112
114};
115
117{
118public:
119 KisWalkersList& getWalkersList();
120 KisSpontaneousJobsList& getSpontaneousJobsList();
121};
122
123#endif /* __KIS_SIMPLE_UPDATE_QUEUE_H */
124
KisSpontaneousJobsList m_spontaneousJobsList
QListIterator< KisSpontaneousJob * > KisSpontaneousJobsListIterator
QList< KisSpontaneousJob * > KisSpontaneousJobsList
QListIterator< KisBaseRectsWalkerSP > KisWalkersListIterator
QMutableListIterator< KisSpontaneousJob * > KisMutableSpontaneousJobsListIterator
QList< KisBaseRectsWalkerSP > KisWalkersList
QMutableListIterator< KisBaseRectsWalkerSP > KisMutableWalkersListIterator