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 Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
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.
22 #include <dali/public-api/common/vector-wrapper.h>
23 #include <dali/public-api/object/base-object.h>
24 #include <dali/public-api/render-tasks/render-task.h>
25 #include <dali/public-api/render-tasks/render-task-list.h>
26 #include <dali/internal/common/message.h>
35 class RenderTaskDefaults;
44 * A proxy for the scene-graph RenderTaskList.
45 * A separate LayerList is maintained for actors added via the SystemLevel::Add().
47 class RenderTaskList : public BaseObject
51 typedef std::vector< Dali::RenderTask > RenderTaskContainer;
54 * Create a RenderTaskList.
55 * @param[in] updateManager Used for creating render-tasks in the scene graph.
56 * @param[in] defaults Provides the default source & camera actors.
57 * @param[in] systemLevel True if this is the LayerList for actors added via the SystemLevel::Add().
58 * @return A newly allocated RenderTaskList; the caller takes ownership.
60 static RenderTaskList* New( SceneGraph::UpdateManager& updateManager, RenderTaskDefaults& defaults, bool systemLevel );
63 * @copydoc Dali::RenderTaskList::CreateTask()
65 Dali::RenderTask CreateTask();
68 * @copydoc Dali::RenderTaskList::RemoveTask()
70 void RemoveTask( Dali::RenderTask task );
73 * @copydoc Dali::RenderTaskList::GetTaskCount()
75 unsigned int GetTaskCount() const;
78 * @copydoc Dali::RenderTaskList::GetTask()
80 Dali::RenderTask GetTask( unsigned int index ) const;
83 * Retrieve the container of render-tasks.
84 * @return The container.
86 RenderTaskContainer& GetTasks()
92 * Provide notification signals for a "Finished" render task.
93 * This method should be called in the event-thread
94 * Queue NotifyFinishedMessage() from update-thread
96 void NotifyFinished();
101 * Construct a new RenderTaskList.
102 * @param[in] eventToUpdate Used for creating render-tasks in the scene graph.
103 * @param[in] defaults Provides the default source & camera actors.
104 * @param[in] systemLevel True if this is the system-level list.
106 RenderTaskList( EventToUpdate& eventToUpdate, RenderTaskDefaults& defaults, bool systemLevel );
109 * A reference counted object may only be deleted by calling Unreference()
111 virtual ~RenderTaskList();
114 * 2nd-phase construction
116 void Initialize( SceneGraph::UpdateManager& updateManager );
120 EventToUpdate& mEventToUpdate;
121 RenderTaskDefaults& mDefaults;
123 bool mIsSystemLevel; ///< True if the layers are added via the SystemLevel API
125 SceneGraph::RenderTaskList* mSceneObject; ///< Raw-pointer to the scene-graph object; not owned.
127 RenderTaskContainer mTasks; ///< Reference counted render-tasks
131 * Notification message for when 1+ render tasks have finished
132 * @param[in] renderTaskList This will provide the notification signals.
134 inline MessageBase* NotifyFinishedMessage( RenderTaskList& renderTaskList )
136 return new Message< RenderTaskList >( &renderTaskList, &RenderTaskList::NotifyFinished );
139 } // namespace Internal
141 // Helpers for public-api forwarding methods
143 inline Internal::RenderTaskList& GetImplementation(Dali::RenderTaskList& taskList)
145 DALI_ASSERT_ALWAYS(taskList && "RenderTaskList handle is empty");
147 BaseObject& handle = taskList.GetBaseObject();
149 return static_cast<Internal::RenderTaskList&>(handle);
152 inline const Internal::RenderTaskList& GetImplementation(const Dali::RenderTaskList& taskList)
154 DALI_ASSERT_ALWAYS(taskList && "RenderTaskList handle is empty");
156 const BaseObject& handle = taskList.GetBaseObject();
158 return static_cast<const Internal::RenderTaskList&>(handle);
163 #endif //__DALI_INTERNAL_RENDER_TASK_LIST_H__