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>
34 class EventThreadServices;
35 class RenderTaskDefaults;
45 * A proxy for the scene-graph RenderTaskList.
46 * A separate LayerList is maintained for actors added via the SystemLevel::Add().
48 class RenderTaskList : public BaseObject, public CompleteNotificationInterface
52 typedef std::vector< Dali::RenderTask > RenderTaskContainer;
56 RenderTask* renderTaskPtr; ///< Pointer for comparison with current rendertask.
57 Actor* actorPtr; ///< Pointer for comparison with current actor.
61 * Create a RenderTaskList.
62 * @param[in] eventServices Used for sending message to the scene graph.
63 * @param[in] defaults Provides the default source & camera actors.
64 * @param[in] systemLevel True if this is the LayerList for actors added via the SystemLevel::Add().
65 * @return A newly allocated RenderTaskList; the caller takes ownership.
67 static RenderTaskList* New( EventThreadServices& eventServices, RenderTaskDefaults& defaults, bool systemLevel );
70 * @copydoc Dali::RenderTaskList::CreateTask()
72 Dali::RenderTask CreateTask();
75 * @copydoc Dali::RenderTaskList::RemoveTask()
77 void RemoveTask( Dali::RenderTask task );
80 * @copydoc Dali::RenderTaskList::GetTaskCount()
82 unsigned int GetTaskCount() const;
85 * @copydoc Dali::RenderTaskList::GetTask()
87 Dali::RenderTask GetTask( unsigned int index ) const;
90 * Retrieve the container of render-tasks.
91 * @return The container.
93 RenderTaskContainer& GetTasks()
99 * @brief Mark a rendertask as having exclusive access to its source actor.
101 * @param[in] task Pointer to the rendertask.
102 * @param[in] exclusive If a rendertask is to have exclusive acesss to its source actor.
104 void SetExclusive( RenderTask* task, bool exclusive );
107 * @brief Return the list of rendertasks that exclusively own their source actor.
109 * @return [description]
111 const Vector< Exclusive >& GetExclusivesList() const
117 * Provide notification signals for a "Finished" render task.
118 * This method should be called in the event-thread
119 * Queue NotifyFinishedMessage() from update-thread
120 * @param object pointer to this class instance
122 static void NotifyFinished( void* object );
125 * This method refreshes all render tasks that have a frame buffer
126 * and a refresh rate of RefreshOnce.
128 void RecoverFromContextLoss();
133 * Construct a new RenderTaskList.
134 * @param[in] eventThreadServices Used for creating render-tasks in the scene graph.
135 * @param[in] defaults Provides the default source & camera actors.
136 * @param[in] systemLevel True if this is the system-level list.
138 RenderTaskList( EventThreadServices& eventThreadServices, RenderTaskDefaults& defaults, bool systemLevel );
141 * A reference counted object may only be deleted by calling Unreference()
143 virtual ~RenderTaskList();
146 * 2nd-phase construction
148 void Initialize( SceneGraph::UpdateManager& updateManager );
150 private: // from CompleteNotificationInterface
153 * @copydoc CompleteNotificationInterface::NotifyCompleted()
155 virtual void NotifyCompleted();
159 EventThreadServices& mEventThreadServices;
160 RenderTaskDefaults& mDefaults;
162 bool mIsSystemLevel; ///< True if the layers are added via the SystemLevel API
164 SceneGraph::RenderTaskList* mSceneObject; ///< Raw-pointer to the scene-graph object; not owned.
166 RenderTaskContainer mTasks; ///< Reference counted render-tasks
167 Vector< Exclusive > mExclusives; ///< List of rendertasks with exclusively owned source actors.
170 } // namespace Internal
172 // Helpers for public-api forwarding methods
174 inline Internal::RenderTaskList& GetImplementation(Dali::RenderTaskList& taskList)
176 DALI_ASSERT_ALWAYS(taskList && "RenderTaskList handle is empty");
178 BaseObject& handle = taskList.GetBaseObject();
180 return static_cast<Internal::RenderTaskList&>(handle);
183 inline const Internal::RenderTaskList& GetImplementation(const Dali::RenderTaskList& taskList)
185 DALI_ASSERT_ALWAYS(taskList && "RenderTaskList handle is empty");
187 const BaseObject& handle = taskList.GetBaseObject();
189 return static_cast<const Internal::RenderTaskList&>(handle);
194 #endif //__DALI_INTERNAL_RENDER_TASK_LIST_H__