If a RenderTask's exclusive actor is destoryed, then ensure the RenderTaskList of...
[platform/core/uifw/dali-core.git] / dali / internal / event / render-tasks / render-task-list-impl.h
index 6d351c2..068a42f 100644 (file)
@@ -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) 2019 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.
 // INTERNAL INCLUDES
 #include <dali/public-api/common/vector-wrapper.h>
 #include <dali/public-api/object/base-object.h>
-#include <dali/public-api/render-tasks/render-task.h>
 #include <dali/public-api/render-tasks/render-task-list.h>
 #include <dali/internal/event/common/complete-notification-interface.h>
+#include <dali/internal/event/render-tasks/render-task-impl.h>
+#include <dali/internal/event/events/actor-observer.h>
 
 namespace Dali
 {
@@ -36,8 +37,9 @@ class RenderTaskDefaults;
 class Actor;
 class CameraActor;
 
+using RenderTaskPtr = IntrusivePtr<RenderTask>;
 class RenderTaskList;
-typedef IntrusivePtr<RenderTaskList> RenderTaskListPtr;
+using RenderTaskListPtr = IntrusivePtr<RenderTaskList>;
 
 namespace SceneGraph
 {
@@ -53,14 +55,16 @@ class RenderTaskList : public BaseObject, public CompleteNotificationInterface
 {
 public:
 
-  typedef std::vector< Dali::RenderTask > RenderTaskContainer;
+  using RenderTaskContainer = std::vector< RenderTaskPtr >;
 
   struct Exclusive
   {
     RenderTask* renderTaskPtr;        ///< Pointer for comparison with current rendertask.
-    Actor* actorPtr;                  ///< Pointer for comparison with current actor.
+    ActorObserver actor;              ///< For comparison with current actor.
   };
 
+  using ExclusivesContainer = std::vector< Exclusive >;
+
   /**
    * Create a RenderTaskList.
    * @return A newly allocated RenderTaskList; the caller takes ownership.
@@ -70,7 +74,7 @@ public:
   /**
    * @copydoc Dali::RenderTaskList::CreateTask()
    */
-  Dali::RenderTask CreateTask();
+  RenderTaskPtr CreateTask();
 
   /**
    * @brief Creates a new RenderTask.
@@ -81,12 +85,12 @@ public:
    * @param[in] cameraActor The actor from which the scene is viewed for this render task.
    * @return A valid handle to a new RenderTask
    */
-  Dali::RenderTask CreateTask( Actor* sourceActor, CameraActor* cameraActor);
+  RenderTaskPtr CreateTask( Actor* sourceActor, CameraActor* cameraActor);
 
   /**
    * @copydoc Dali::RenderTaskList::RemoveTask()
    */
-  void RemoveTask( Dali::RenderTask task );
+  void RemoveTask( Internal::RenderTask& task );
 
   /**
    * @copydoc Dali::RenderTaskList::GetTaskCount()
@@ -96,7 +100,7 @@ public:
   /**
    * @copydoc Dali::RenderTaskList::GetTask()
    */
-  Dali::RenderTask GetTask( uint32_t index ) const;
+  RenderTaskPtr GetTask( uint32_t index ) const;
 
   /**
    * Retrieve the container of render-tasks.
@@ -120,7 +124,7 @@ public:
    *
    * @return [description]
    */
-  const Vector< Exclusive >& GetExclusivesList() const
+  const ExclusivesContainer& GetExclusivesList() const
   {
     return mExclusives;
   }
@@ -139,6 +143,12 @@ public:
    */
   void RecoverFromContextLoss();
 
+  /**
+   * Retrieve the SceneGraph::RenderTaskList object.
+   * @return The RenderTaskList.
+   */
+  const SceneGraph::RenderTaskList& GetSceneObject() const;
+
 protected:
 
   /**
@@ -156,16 +166,6 @@ protected:
    */
   void Initialize();
 
-  /**
-   * Helper to create a scene-graph render task list
-   */
-  void CreateSceneObject();
-
-  /**
-   * Helper to destroy a scene-graph render task list
-   */
-  void DestroySceneObject();
-
 private: // from CompleteNotificationInterface
 
   /**
@@ -181,7 +181,7 @@ private:
   SceneGraph::RenderTaskList* mSceneObject; ///< Raw-pointer to the scene-graph object; not owned.
 
   RenderTaskContainer mTasks;           ///< Reference counted render-tasks
-  Vector< Exclusive > mExclusives;      ///< List of rendertasks with exclusively owned source actors.
+  ExclusivesContainer mExclusives;      ///< List of rendertasks with exclusively owned source actors.
 };
 
 } // namespace Internal
@@ -208,4 +208,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