File indexing completed on 2024-05-12 16:01:25

0001 /*
0002  *  SPDX-FileCopyrightText: 2015 Jouni Pentikäinen <joupent@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KIS_ANIMATION_CACHE_POPULATOR_H
0008 #define KIS_ANIMATION_CACHE_POPULATOR_H
0009 
0010 #include <QObject>
0011 #include "kis_types.h"
0012 
0013 class KisPart;
0014 
0015 class KisAnimationCachePopulator : public QObject
0016 {
0017     Q_OBJECT
0018 
0019 public:
0020     KisAnimationCachePopulator(KisPart *part);
0021     ~KisAnimationCachePopulator() override;
0022 
0023     /**
0024      * Request generation of given frame. The request will
0025      * be ignored if the populator is already requesting a frame.
0026      * @return true if generation requested, false if busy
0027      */
0028     bool regenerate(KisAnimationFrameCacheSP cache, int frame);
0029     void requestRegenerationWithPriorityFrame(KisImageSP image, int frameIndex);
0030 
0031 public Q_SLOTS:
0032     void slotRequestRegeneration();
0033 
0034 private Q_SLOTS:
0035     void slotTimer();
0036 
0037     void slotRegeneratorFrameCancelled();
0038     void slotRegeneratorFrameReady();
0039 
0040     void slotConfigChanged();
0041 
0042 private:
0043     struct Private;
0044     QScopedPointer<Private> m_d;
0045 };
0046 
0047 #endif