File indexing completed on 2024-05-12 15:58:39
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 0018 0019 class KisRegenerateFrameStrokeStrategy : public KisSimpleStrokeStrategy 0020 { 0021 public: 0022 enum Type { 0023 EXTERNAL_FRAME, 0024 CURRENT_FRAME 0025 }; 0026 0027 0028 public: 0029 /** 0030 * Constructs a strategy that refreshes an external frame in the 0031 * background without ending/cancelling any running actions 0032 */ 0033 KisRegenerateFrameStrokeStrategy(int frameId, 0034 const KisRegion &dirtyRegion, bool isCancellable, 0035 KisImageAnimationInterface *interface); 0036 0037 /** 0038 * Regenerates current frame without affecting the frames cache. 0039 * Used for redrawing the image after switching frames. 0040 * 0041 * NOTE: in contrast to the other c-tor, refreshing current frame 0042 * *does* end all the running stroke, because it is not a 0043 * background action, but a distinct user action. 0044 */ 0045 KisRegenerateFrameStrokeStrategy(KisImageAnimationInterface *interface); 0046 0047 ~KisRegenerateFrameStrokeStrategy() override; 0048 0049 void initStrokeCallback() override; 0050 void doStrokeCallback(KisStrokeJobData *data) override; 0051 void finishStrokeCallback() override; 0052 void cancelStrokeCallback() override; 0053 0054 KisStrokeStrategy* createLodClone(int levelOfDetail) override; 0055 void suspendStrokeCallback() override; 0056 void resumeStrokeCallback() override; 0057 0058 static QList<KisStrokeJobData*> createJobsData(KisImageWSP image); 0059 0060 private: 0061 struct Private; 0062 const QScopedPointer<Private> m_d; 0063 }; 0064 0065 #endif /* __KIS_REGENERATE_FRAME_STROKE_STRATEGY_H */