Krita Source Code Documentation
Loading...
Searching...
No Matches
KisAsyncAnimationRendererBase.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: 2017 Dmitry Kazakov <dimula73@gmail.com>
3 *
4 * SPDX-License-Identifier: GPL-2.0-or-later
5 */
6
7#ifndef KISASYNCANIMATIONRENDERERBASE_H
8#define KISASYNCANIMATIONRENDERERBASE_H
9
10#include <QObject>
11#include "kis_types.h"
12
13#include "kritaui_export.h"
14
15class KisRegion;
16class KisLockFrameGenerationLock;
17
28class KRITAUI_EXPORT KisAsyncAnimationRendererBase : public QObject
29{
30 Q_OBJECT
31
32public:
33 enum Flag
34 {
35 None = 0x0,
36 Cancellable = 0x1
37 };
38 Q_DECLARE_FLAGS(Flags, Flag)
39
41 UserCancelled = 0,
43 RenderingTimedOut
44 };
45 Q_ENUM(CancelReason)
46
47public:
48 explicit KisAsyncAnimationRendererBase(QObject *parent = 0);
50
56 void startFrameRegeneration(KisImageSP image, int frame, const KisRegion &regionOfInterest, Flags flags, KisLockFrameGenerationLock &&frameGenerationLock);
57
61 void startFrameRegeneration(KisImageSP image, int frame, Flags flags, KisLockFrameGenerationLock &&frameGenerationLock);
62
66 bool isActive() const;
67
68public Q_SLOTS:
75 void cancelCurrentFrameRendering(CancelReason cancelReason);
76
77Q_SIGNALS:
78 void sigFrameCompleted(int frame);
80
81private Q_SLOTS:
82 void slotFrameRegenerationCancelled();
83 void slotFrameRegenerationTimedOut();
84 void slotFrameRegenerationFinished(int frame);
85
86protected Q_SLOTS:
90 void notifyFrameCompleted(int frame);
91
96 void notifyFrameCancelled(int frame, KisAsyncAnimationRendererBase::CancelReason cancelReason);
97
98protected:
113 virtual void frameCompletedCallback(int frame, const KisRegion &requestedRegion) = 0;
114
125 virtual void frameCancelledCallback(int frame, CancelReason cancelReason) = 0;
126
127
134 virtual void clearFrameRegenerationState(bool isCancelled);
135
136protected:
147
148private:
149 struct Private;
150 const QScopedPointer<Private> m_d;
151};
152
153Q_DECLARE_OPERATORS_FOR_FLAGS(KisAsyncAnimationRendererBase::Flags)
154
155#endif // KISASYNCANIMATIONRENDERERBASE_H
Q_DECLARE_FLAGS(KisUpdaterContextSnapshotEx, KisUpdaterContextSnapshotExTag)
Q_DECLARE_OPERATORS_FOR_FLAGS(KisBaseRectsWalker::SubtreeVisitFlags)
void sigFrameCancelled(int frame, KisAsyncAnimationRendererBase::CancelReason cancelReason)
virtual void frameCancelledCallback(int frame, CancelReason cancelReason)=0
frameCancelledCallback is called when the rendering of the frame was cancelled.
KisImageSP requestedImage() const
virtual void frameCompletedCallback(int frame, const KisRegion &requestedRegion)=0
frameCompletedCallback is called by the renderer when a new frame becomes ready
const QScopedPointer< Private > m_d
void sigFrameCompleted(int frame)