File indexing completed on 2024-05-19 04:26:41

0001 /*
0002  *  SPDX-FileCopyrightText: 2023 Dmitry Kazakov <dimula73@gmail.com>
0003  *
0004  *  SPDX-License-Identifier: GPL-2.0-or-later
0005  */
0006 
0007 #ifndef KISBLOCKBACKGROUNDFRAMEGENERATIONLOCK_H
0008 #define KISBLOCKBACKGROUNDFRAMEGENERATIONLOCK_H
0009 
0010 #include <kritaimage_export.h>
0011 #include <KisAdaptedLock.h>
0012 
0013 class KisImageAnimationInterface;
0014 
0015 
0016 /**
0017  * A RAII-based locker for calling
0018  * animationInterface->block/unblockBackgroundFrameGeneration(),
0019  * which prohibits background frame cache generation process,
0020  * so that it doesn't interfere with interactive frame generation
0021  * using the dialog.
0022  */
0023 class KRITAIMAGE_EXPORT KisBlockBackgroundFrameGenerationLockAdapter
0024 {
0025 public:
0026     KisBlockBackgroundFrameGenerationLockAdapter(KisImageAnimationInterface *interface);
0027 
0028     void lock();
0029     void unlock();
0030 
0031 private:
0032     KisImageAnimationInterface *m_interface;
0033 };
0034 
0035 KIS_DECLARE_ADAPTED_LOCK(KisBlockBackgroundFrameGenerationLock, KisBlockBackgroundFrameGenerationLockAdapter)
0036 
0037 #endif // KISBLOCKBACKGROUNDFRAMEGENERATIONLOCK_H