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/event/common/complete-notification-interface.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, public CompleteNotificationInterface
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
95 * @param object pointer to this class instance
97 static void NotifyFinished( void* object );
100 * This method refreshes all render tasks that have a frame buffer
101 * and a refresh rate of RefreshOnce.
103 void RecoverFromContextLoss();
108 * Construct a new RenderTaskList.
109 * @param[in] eventToUpdate Used for creating render-tasks in the scene graph.
110 * @param[in] defaults Provides the default source & camera actors.
111 * @param[in] systemLevel True if this is the system-level list.
113 RenderTaskList( EventToUpdate& eventToUpdate, RenderTaskDefaults& defaults, bool systemLevel );
116 * A reference counted object may only be deleted by calling Unreference()
118 virtual ~RenderTaskList();
121 * 2nd-phase construction
123 void Initialize( SceneGraph::UpdateManager& updateManager );
125 private: // from CompleteNotificationInterface
128 * @copydoc CompleteNotificationInterface::NotifyCompleted()
130 virtual void NotifyCompleted();
134 EventToUpdate& mEventToUpdate;
135 RenderTaskDefaults& mDefaults;
137 bool mIsSystemLevel; ///< True if the layers are added via the SystemLevel API
139 SceneGraph::RenderTaskList* mSceneObject; ///< Raw-pointer to the scene-graph object; not owned.
141 RenderTaskContainer mTasks; ///< Reference counted render-tasks
144 } // namespace Internal
146 // Helpers for public-api forwarding methods
148 inline Internal::RenderTaskList& GetImplementation(Dali::RenderTaskList& taskList)
150 DALI_ASSERT_ALWAYS(taskList && "RenderTaskList handle is empty");
152 BaseObject& handle = taskList.GetBaseObject();
154 return static_cast<Internal::RenderTaskList&>(handle);
157 inline const Internal::RenderTaskList& GetImplementation(const Dali::RenderTaskList& taskList)
159 DALI_ASSERT_ALWAYS(taskList && "RenderTaskList handle is empty");
161 const BaseObject& handle = taskList.GetBaseObject();
163 return static_cast<const Internal::RenderTaskList&>(handle);
168 #endif //__DALI_INTERNAL_RENDER_TASK_LIST_H__