File indexing completed on 2024-05-19 04:26:43
0001 /* 0002 * SPDX-FileCopyrightText: 2023 Dmitry Kazakov <dimula73@gmail.com> 0003 * 0004 * SPDX-License-Identifier: GPL-2.0-or-later 0005 */ 0006 0007 #ifndef KISLOCKFRAMEGENERATIONLOCK_H 0008 #define KISLOCKFRAMEGENERATIONLOCK_H 0009 0010 #include <kritaimage_export.h> 0011 #include <KisAdaptedLock.h> 0012 0013 class KisImageAnimationInterface; 0014 0015 /** 0016 * A RAII-based locker for calling 0017 * animationInterface->lock/unlockFrameGeneration(), which 0018 * acquires the lock for the exclusive frame generation process. 0019 */ 0020 class KRITAIMAGE_EXPORT KisLockFrameGenerationLockAdapter 0021 { 0022 public: 0023 KisLockFrameGenerationLockAdapter(KisImageAnimationInterface *interface); 0024 0025 bool try_lock(); 0026 void lock(); 0027 void unlock(); 0028 0029 private: 0030 KisImageAnimationInterface *m_interface {nullptr}; 0031 }; 0032 0033 KIS_DECLARE_ADAPTED_LOCK(KisLockFrameGenerationLock, KisLockFrameGenerationLockAdapter) 0034 0035 #endif // KISLOCKFRAMEGENERATIONLOCK_H