Skip to content

armgit / krita

Public Imported from GitHub
0

Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.

C++
864 B
Raw Blame
/*
 *  SPDX-FileCopyrightText: 2023 Dmitry Kazakov <[email protected]>
 *
 *  SPDX-License-Identifier: GPL-2.0-or-later
 */

#ifndef KISLOCKFRAMEGENERATIONLOCK_H
#define KISLOCKFRAMEGENERATIONLOCK_H

#include <kritaimage_export.h>
#include <KisAdaptedLock.h>

class KisImageAnimationInterface;

/**
 * A RAII-based locker for calling
 * animationInterface->lock/unlockFrameGeneration(), which
 * acquires the lock for the exclusive frame generation process.
 */
class KRITAIMAGE_EXPORT KisLockFrameGenerationLockAdapter
{
public:
    KisLockFrameGenerationLockAdapter(KisImageAnimationInterface *interface);

    bool try_lock();
    void lock();
    void unlock();

private:
    KisImageAnimationInterface *m_interface {nullptr};
};

KIS_DECLARE_ADAPTED_LOCK(KisLockFrameGenerationLock, KisLockFrameGenerationLockAdapter)

#endif // KISLOCKFRAMEGENERATIONLOCK_H