File indexing completed on 2024-05-19 04:26:32
0001 /* 0002 * SPDX-FileCopyrightText: 2015 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef __KIS_REGENERATE_FRAME_STROKE_STRATEGY_H 0008 #define __KIS_REGENERATE_FRAME_STROKE_STRATEGY_H 0009 0010 #include <kis_simple_stroke_strategy.h> 0011 0012 #include <QScopedPointer> 0013 0014 class KisRegion; 0015 0016 class KisImageAnimationInterface; 0017 class KisLockFrameGenerationLock; 0018 0019 0020 class KisRegenerateFrameStrokeStrategy : public KisSimpleStrokeStrategy 0021 { 0022 public: 0023 enum Type { 0024 EXTERNAL_FRAME, 0025 CURRENT_FRAME 0026 }; 0027 0028 0029 public: 0030 /** 0031 * Constructs a strategy that refreshes an external frame in the 0032 * background without ending/cancelling any running actions 0033 */ 0034 KisRegenerateFrameStrokeStrategy(int frameId, 0035 const KisRegion &dirtyRegion, 0036 bool isCancellable, 0037 KisImageAnimationInterface *interface, 0038 KisLockFrameGenerationLock &&frameGenerationLock); 0039 0040 /** 0041 * Regenerates current frame without affecting the frames cache. 0042 * Used for redrawing the image after switching frames. 0043 * 0044 * NOTE: in contrast to the other c-tor, refreshing current frame 0045 * *does* end all the running stroke, because it is not a 0046 * background action, but a distinct user action. 0047 */ 0048 KisRegenerateFrameStrokeStrategy(KisImageAnimationInterface *interface); 0049 0050 ~KisRegenerateFrameStrokeStrategy() override; 0051 0052 void initStrokeCallback() override; 0053 void doStrokeCallback(KisStrokeJobData *data) override; 0054 void finishStrokeCallback() override; 0055 void cancelStrokeCallback() override; 0056 0057 KisStrokeStrategy* createLodClone(int levelOfDetail) override; 0058 void suspendStrokeCallback() override; 0059 void resumeStrokeCallback() override; 0060 0061 static QList<KisStrokeJobData*> createJobsData(KisImageWSP image); 0062 0063 private: 0064 struct Private; 0065 const QScopedPointer<Private> m_d; 0066 }; 0067 0068 #endif /* __KIS_REGENERATE_FRAME_STROKE_STRATEGY_H */