#define DALI_INTERNAL_SCENE_GRAPH_FRAME_CALLBACK_H
/*
- * Copyright (c) 2018 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2021 Samsung Electronics Co., Ltd.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
namespace Dali
{
-
namespace Internal
{
-
namespace SceneGraph
{
-
class Node;
class TransformManager;
class FrameCallback final : public PropertyOwner::Observer
{
public:
-
/**
* Creates a new FrameCallback.
* @param[in] frameCallbackInterface A reference to the FrameCallbackInterface implementation
* @return A new FrameCallback.
*/
- static FrameCallback* New( FrameCallbackInterface& frameCallbackInterface );
+ static FrameCallback* New(FrameCallbackInterface& frameCallbackInterface);
/**
* Non-virtual Destructor.
* @param[in] transformManager The Transform Manager
* @param[in] rootNode The rootNode of this frame-callback
*/
- void ConnectToSceneGraph( UpdateManager& updateManager, TransformManager& transformManager, Node& rootNode );
+ void ConnectToSceneGraph(UpdateManager& updateManager, TransformManager& transformManager, Node& rootNode);
// Movable but not copyable
- FrameCallback( const FrameCallback& ) = delete; ///< Deleted copy constructor.
- FrameCallback( FrameCallback&& ) = default; ///< Default move constructor.
- FrameCallback& operator=( const FrameCallback& ) = delete; ///< Deleted copy assignment operator.
- FrameCallback& operator=( FrameCallback&& ) = default; ///< Default move assignment operator.
+ FrameCallback(const FrameCallback&) = delete; ///< Deleted copy constructor.
+ FrameCallback(FrameCallback&&) = default; ///< Default move constructor.
+ FrameCallback& operator=(const FrameCallback&) = delete; ///< Deleted copy assignment operator.
+ FrameCallback& operator=(FrameCallback&&) = default; ///< Default move assignment operator.
/**
* Called from the update-thread after the scene has been updated, and is ready to render.
* @param[in] nodeHierarchyChanged Whether the node hierarchy has changed
* @return Whether to continue calling this FrameCallback or not.
*/
- bool Update( BufferIndex bufferIndex, float elapsedSeconds, bool nodeHierarchyChanged );
+ bool Update(BufferIndex bufferIndex, float elapsedSeconds, bool nodeHierarchyChanged);
/**
* Invalidates this FrameCallback and will no longer be associated with the FrameCallbackInterface.
* @param[in] iFace The FrameCallbackInterface pointer to compare with
* @return True if iFace matches our internally stored FrameCallbackInterface.
*/
- inline bool operator==( const FrameCallbackInterface* iFace )
+ inline bool operator==(const FrameCallbackInterface* iFace)
{
return mFrameCallbackInterface == iFace;
}
private:
-
// From PropertyOwner::Observer
/**
* @copydoc PropertyOwner::Observer::PropertyOwnerConnected()
*/
- void PropertyOwnerConnected( PropertyOwner& owner ) override { /* Nothing to do */ }
+ void PropertyOwnerConnected(PropertyOwner& owner) override
+ { /* Nothing to do */
+ }
/**
* @copydoc PropertyOwner::Observer::PropertyOwnerDisconnected()
*/
- void PropertyOwnerDisconnected( BufferIndex updateBufferIndex, PropertyOwner& owner ) override { /* Nothing to do */ }
+ void PropertyOwnerDisconnected(BufferIndex updateBufferIndex, PropertyOwner& owner) override
+ { /* Nothing to do */
+ }
/**
* @copydoc PropertyOwner::Observer::PropertyOwnerDisconnected()
*
* Will use this to disconnect the frame-callback if the accompanying node is destroyed
*/
- void PropertyOwnerDestroyed( PropertyOwner& owner ) override;
+ void PropertyOwnerDestroyed(PropertyOwner& owner) override;
// Construction
* Constructor.
* @param[in] frameCallbackInterface A pointer to the FrameCallbackInterface implementation
*/
- FrameCallback( FrameCallbackInterface* frameCallbackInterface );
+ FrameCallback(FrameCallbackInterface* frameCallbackInterface);
private:
-
- Mutex mMutex;
- std::unique_ptr< UpdateProxy > mUpdateProxy{ nullptr }; ///< A unique pointer to the implementation of the UpdateProxy.
- FrameCallbackInterface* mFrameCallbackInterface;
+ Mutex mMutex;
+ std::unique_ptr<UpdateProxy> mUpdateProxy{nullptr}; ///< A unique pointer to the implementation of the UpdateProxy.
+ FrameCallbackInterface* mFrameCallbackInterface;
+ bool mValid{true}; ///< Set to false when Invalidate() is called.
};
/**
* @param[in] iFace The FrameCallbackInterface pointer
* @return True if iFace matches the internally stored FrameCallbackInterface.
*/
-inline bool operator==( const OwnerPointer< FrameCallback >& frameCallback, const FrameCallbackInterface* iFace )
+inline bool operator==(const OwnerPointer<FrameCallback>& frameCallback, const FrameCallbackInterface* iFace)
{
return *frameCallback == iFace;
}