1 #ifndef __DALI_INTERNAL_RENDER_TASK_LIST_H__
2 #define __DALI_INTERNAL_RENDER_TASK_LIST_H__
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
7 // Licensed under the Flora License, Version 1.0 (the License);
8 // you may not use this file except in compliance with the License.
9 // You may obtain a copy of the License at
11 // http://floralicense.org/license/
13 // Unless required by applicable law or agreed to in writing, software
14 // distributed under the License is distributed on an AS IS BASIS,
15 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 // See the License for the specific language governing permissions and
17 // limitations under the License.
21 #include <dali/public-api/common/vector-wrapper.h>
22 #include <dali/public-api/object/base-object.h>
23 #include <dali/public-api/render-tasks/render-task.h>
24 #include <dali/public-api/render-tasks/render-task-list.h>
25 #include <dali/internal/common/message.h>
34 class RenderTaskDefaults;
43 * A proxy for the scene-graph RenderTaskList.
44 * A separate LayerList is maintained for actors added via the SystemLevel::Add().
46 class RenderTaskList : public BaseObject
50 typedef std::vector< Dali::RenderTask > RenderTaskContainer;
53 * Create a RenderTaskList.
54 * @param[in] updateManager Used for creating render-tasks in the scene graph.
55 * @param[in] defaults Provides the default source & camera actors.
56 * @param[in] systemLevel True if this is the LayerList for actors added via the SystemLevel::Add().
57 * @return A newly allocated RenderTaskList; the caller takes ownership.
59 static RenderTaskList* New( SceneGraph::UpdateManager& updateManager, RenderTaskDefaults& defaults, bool systemLevel );
62 * @copydoc Dali::RenderTaskList::CreateTask()
64 Dali::RenderTask CreateTask();
67 * @copydoc Dali::RenderTaskList::RemoveTask()
69 void RemoveTask( Dali::RenderTask task );
72 * @copydoc Dali::RenderTaskList::GetTaskCount()
74 unsigned int GetTaskCount() const;
77 * @copydoc Dali::RenderTaskList::GetTask()
79 Dali::RenderTask GetTask( unsigned int index ) const;
82 * Retrieve the container of render-tasks.
83 * @return The container.
85 RenderTaskContainer& GetTasks()
91 * Provide notification signals for a "Finished" render task.
92 * This method should be called in the event-thread
93 * Queue NotifyFinishedMessage() from update-thread
95 void NotifyFinished();
100 * Construct a new RenderTaskList.
101 * @param[in] eventToUpdate Used for creating render-tasks in the scene graph.
102 * @param[in] defaults Provides the default source & camera actors.
103 * @param[in] systemLevel True if this is the system-level list.
105 RenderTaskList( EventToUpdate& eventToUpdate, RenderTaskDefaults& defaults, bool systemLevel );
108 * A reference counted object may only be deleted by calling Unreference()
110 virtual ~RenderTaskList();
113 * 2nd-phase construction
115 void Initialize( SceneGraph::UpdateManager& updateManager );
119 EventToUpdate& mEventToUpdate;
120 RenderTaskDefaults& mDefaults;
122 bool mIsSystemLevel; ///< True if the layers are added via the SystemLevel API
124 SceneGraph::RenderTaskList* mSceneObject; ///< Raw-pointer to the scene-graph object; not owned.
126 RenderTaskContainer mTasks; ///< Reference counted render-tasks
130 * Notification message for when 1+ render tasks have finished
131 * @param[in] renderTaskList This will provide the notification signals.
133 inline MessageBase* NotifyFinishedMessage( RenderTaskList& renderTaskList )
135 return new Message< RenderTaskList >( &renderTaskList, &RenderTaskList::NotifyFinished );
138 } // namespace Internal
140 // Helpers for public-api forwarding methods
142 inline Internal::RenderTaskList& GetImplementation(Dali::RenderTaskList& taskList)
144 DALI_ASSERT_ALWAYS(taskList && "RenderTaskList handle is empty");
146 BaseObject& handle = taskList.GetBaseObject();
148 return static_cast<Internal::RenderTaskList&>(handle);
151 inline const Internal::RenderTaskList& GetImplementation(const Dali::RenderTaskList& taskList)
153 DALI_ASSERT_ALWAYS(taskList && "RenderTaskList handle is empty");
155 const BaseObject& handle = taskList.GetBaseObject();
157 return static_cast<const Internal::RenderTaskList&>(handle);
162 #endif //__DALI_INTERNAL_RENDER_TASK_LIST_H__