X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=dali%2Finternal%2Fevent%2Frender-tasks%2Frender-task-list-impl.h;h=c01b9816373be86dbf832f870bc719057727c0c4;hb=eacc080fe975c523d722dd17c044652317ddd6e8;hp=c82c917a33e63d0de3290cbfc9788453d7447cbc;hpb=c6b1508769b8710d7dce5241aa18c83b25d6fa3f;p=platform%2Fcore%2Fuifw%2Fdali-core.git diff --git a/dali/internal/event/render-tasks/render-task-list-impl.h b/dali/internal/event/render-tasks/render-task-list-impl.h index c82c917..c01b981 100644 --- a/dali/internal/event/render-tasks/render-task-list-impl.h +++ b/dali/internal/event/render-tasks/render-task-list-impl.h @@ -1,8 +1,8 @@ -#ifndef __DALI_INTERNAL_RENDER_TASK_LIST_H__ -#define __DALI_INTERNAL_RENDER_TASK_LIST_H__ +#ifndef DALI_INTERNAL_RENDER_TASK_LIST_H +#define DALI_INTERNAL_RENDER_TASK_LIST_H /* - * Copyright (c) 2014 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. @@ -21,24 +21,30 @@ // INTERNAL INCLUDES #include #include -#include #include + #include +#include +#include namespace Dali { - namespace Internal { - class EventThreadServices; class RenderTaskDefaults; +class Actor; +class CameraActor; + +using RenderTaskPtr = IntrusivePtr; +class RenderTaskList; +using RenderTaskListPtr = IntrusivePtr; namespace SceneGraph { class RenderTaskList; class UpdateManager; -} +} // namespace SceneGraph /** * A proxy for the scene-graph RenderTaskList. @@ -47,37 +53,73 @@ class UpdateManager; class RenderTaskList : public BaseObject, public CompleteNotificationInterface { public: + using RenderTaskContainer = std::vector; + + struct Exclusive + { + RenderTask* renderTaskPtr; ///< Pointer for comparison with current rendertask. + ActorObserver actor; ///< For comparison with current actor. + + bool operator==(const Exclusive& other) const + { + return renderTaskPtr == other.renderTaskPtr; + } + }; - typedef std::vector< Dali::RenderTask > RenderTaskContainer; + using ExclusivesContainer = std::vector; + using ExclusiveIter = ExclusivesContainer::iterator; /** * Create a RenderTaskList. - * @param[in] eventServices Used for sending message to the scene graph. - * @param[in] defaults Provides the default source & camera actors. - * @param[in] systemLevel True if this is the LayerList for actors added via the SystemLevel::Add(). * @return A newly allocated RenderTaskList; the caller takes ownership. */ - static RenderTaskList* New( EventThreadServices& eventServices, RenderTaskDefaults& defaults, bool systemLevel ); + static RenderTaskListPtr New(); /** * @copydoc Dali::RenderTaskList::CreateTask() */ - Dali::RenderTask CreateTask(); + RenderTaskPtr CreateTask(); + + /** + * @brief Creates a new RenderTask. + * + * This will be appended to the list of render-tasks. + * + * @param[in] sourceActor The actor and its children to be rendered for this render task. + * @param[in] cameraActor The actor from which the scene is viewed for this render task. + * @return A valid handle to a new RenderTask + */ + RenderTaskPtr CreateTask(Actor* sourceActor, CameraActor* cameraActor); + + /** + * @brief Creates a new RenderTask for overlay. + * This will be appended to the end of render-task list. + * @param[in] sourceActor The actor and its children to be rendered for this render task. + * @param[in] cameraActor The actor from which the scene is viewed for this render task. + * @return A valid handle to a new overlay RenderTask + * @note The Overlay RenderTask will be rendered after all the other render tasks are rendered. + */ + RenderTaskPtr CreateOverlayTask(Actor* sourceActor, CameraActor* cameraActor); /** * @copydoc Dali::RenderTaskList::RemoveTask() */ - void RemoveTask( Dali::RenderTask task ); + void RemoveTask(Internal::RenderTask& task); /** * @copydoc Dali::RenderTaskList::GetTaskCount() */ - unsigned int GetTaskCount() const; + uint32_t GetTaskCount() const; /** * @copydoc Dali::RenderTaskList::GetTask() */ - Dali::RenderTask GetTask( unsigned int index ) const; + RenderTaskPtr GetTask(uint32_t index) const; + + /** + * @copydoc Dali::RenderTaskList::GetOverlayTask() + */ + RenderTaskPtr GetOverlayTask() const; /** * Retrieve the container of render-tasks. @@ -89,12 +131,30 @@ public: } /** + * @brief Mark a rendertask as having exclusive access to its source actor. + * + * @param[in] task Pointer to the rendertask. + * @param[in] exclusive If a rendertask is to have exclusive acesss to its source actor. + */ + void SetExclusive(RenderTask* task, bool exclusive); + + /** + * @brief Return the list of rendertasks that exclusively own their source actor. + * + * @return [description] + */ + const ExclusivesContainer& GetExclusivesList() const + { + return mExclusives; + } + + /** * Provide notification signals for a "Finished" render task. * This method should be called in the event-thread * Queue NotifyFinishedMessage() from update-thread * @param object pointer to this class instance */ - static void NotifyFinished( void* object ); + static void NotifyFinished(void* object); /** * This method refreshes all render tasks that have a frame buffer @@ -102,43 +162,43 @@ public: */ void RecoverFromContextLoss(); -protected: + /** + * Retrieve the SceneGraph::RenderTaskList object. + * @return The RenderTaskList. + */ + const SceneGraph::RenderTaskList& GetSceneObject() const; +protected: /** * Construct a new RenderTaskList. - * @param[in] eventThreadServices Used for creating render-tasks in the scene graph. - * @param[in] defaults Provides the default source & camera actors. - * @param[in] systemLevel True if this is the system-level list. */ - RenderTaskList( EventThreadServices& eventThreadServices, RenderTaskDefaults& defaults, bool systemLevel ); + RenderTaskList(); /** * A reference counted object may only be deleted by calling Unreference() */ - virtual ~RenderTaskList(); + ~RenderTaskList() override; /** * 2nd-phase construction */ - void Initialize( SceneGraph::UpdateManager& updateManager ); + void Initialize(); private: // from CompleteNotificationInterface - /** * @copydoc CompleteNotificationInterface::NotifyCompleted() */ - virtual void NotifyCompleted(); + void NotifyCompleted() override; private: - EventThreadServices& mEventThreadServices; - RenderTaskDefaults& mDefaults; - - bool mIsSystemLevel; ///< True if the layers are added via the SystemLevel API + RenderTaskDefaults& mDefaults; SceneGraph::RenderTaskList* mSceneObject; ///< Raw-pointer to the scene-graph object; not owned. - RenderTaskContainer mTasks; ///< Reference counted render-tasks + RenderTaskContainer mTasks; ///< Reference counted render-tasks + ExclusivesContainer mExclusives; ///< List of rendertasks with exclusively owned source actors. + RenderTaskPtr mOverlayRenderTask{nullptr}; }; } // namespace Internal @@ -165,4 +225,4 @@ inline const Internal::RenderTaskList& GetImplementation(const Dali::RenderTaskL } // namespace Dali -#endif //__DALI_INTERNAL_RENDER_TASK_LIST_H__ +#endif // DALI_INTERNAL_RENDER_TASK_LIST_H