[5.0] Add IsPositionOrSizeCurrentlyAnimating Actor devel API.
[platform/core/uifw/dali-core.git] / dali / internal / event / render-tasks / render-task-impl.h
index f58ad2b..d268b7b 100644 (file)
@@ -2,7 +2,7 @@
 #define __DALI_INTERNAL_RENDER_TASK_H__
 
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2018 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.
@@ -21,8 +21,9 @@
 // INTERNAL INCLUDES
 #include <dali/public-api/object/base-object.h>
 #include <dali/public-api/render-tasks/render-task.h>
-#include <dali/public-api/images/frame-buffer-image.h>
-#include <dali/internal/event/common/proxy-object.h>
+#include <dali/internal/event/images/frame-buffer-image-impl.h>
+#include <dali/internal/event/common/object-impl.h>
+#include <dali/internal/event/rendering/frame-buffer-impl.h>
 
 namespace Dali
 {
@@ -32,14 +33,15 @@ namespace Internal
 
 class Actor;
 class CameraActor;
-class EventToUpdate;
+class EventThreadServices;
 
 namespace SceneGraph
 {
 class RenderTask;
+class Camera;
 }
 
-class RenderTask : public ProxyObject
+class RenderTask : public Object
 {
 public:
 
@@ -47,9 +49,8 @@ public:
 
   /**
    * Creates a new RenderTask.
-   * @param[in] isSystemLevel Whether the render-task is on the system level task list.
    */
-  static RenderTask* New( bool isSystemLevel );
+  static RenderTask* New();
 
   /**
    * @copydoc Dali::RenderTask::SetSourceActor()
@@ -94,12 +95,22 @@ public:
   /**
    * @copydoc Dali::RenderTask::SetTargetFrameBuffer()
    */
-  void SetTargetFrameBuffer( Dali::FrameBufferImage frameBuffer );
+  void SetTargetFrameBuffer( FrameBufferImagePtr frameBuffer );
 
   /**
    * @copydoc Dali::RenderTask::GetTargetFrameBuffer
    */
-  Dali::FrameBufferImage GetTargetFrameBuffer() const;
+  FrameBufferImage* GetTargetFrameBuffer() const;
+
+  /**
+    * @copydoc Dali::RenderTask::SetFrameBuffer()
+    */
+   void SetFrameBuffer( FrameBufferPtr frameBuffer );
+
+   /**
+    * @copydoc Dali::RenderTask::GetFrameBuffer
+    */
+   FrameBuffer* GetFrameBuffer() const;
 
   /**
    * @copydoc Dali::RenderTask::SetScreenToFrameBufferFunction
@@ -162,6 +173,18 @@ public:
   const Vector4& GetClearColor() const;
 
   /**
+   * Indicate whether GL sync is required for native render target.
+   * @param[in] requiresSync whether GL sync is required.
+   */
+  void SetSyncRequired( bool requiresSync );
+
+  /**
+   * Query whether the sync object is required for native render target.
+   * @return True if the sync object is required, false otherwise.
+   */
+ bool IsSyncRequired() const;
+
+  /**
    * @copydoc Dali::RenderTask::SetClearEnabled()
    */
   void SetClearEnabled( bool enabled );
@@ -184,12 +207,12 @@ public:
   /**
    * @copydoc Dali::RenderTask::SetRefreshRate()
    */
-  void SetRefreshRate( unsigned int refreshRate );
+  void SetRefreshRate( uint32_t refreshRate );
 
   /**
    * @copydoc Dali::RenderTask::GetRefreshRate()
    */
-  unsigned int GetRefreshRate() const;
+  uint32_t GetRefreshRate() const;
 
   /**
    * Check if the render-task is hittable. If render task is offscreen, the screen coordinates may be translated.
@@ -206,10 +229,14 @@ public:
   bool TranslateCoordinates( Vector2& screenCoords ) const;
 
   /**
-   * Query whether the RenderTask is on the system level render-task list.
-   * @return true, if on the system level task list, false otherwise.
+   * @copydoc Dali::RenderTask::WorldToViewport()
    */
-  bool IsSystemLevel() const;
+  bool WorldToViewport(const Vector3 &position, float& viewportX, float& viewportY) const;
+
+  /**
+   * @copydoc Dali::RenderTask::ViewportToLocal()
+   */
+  bool ViewportToLocal(Actor* actor, float viewportX, float viewportY, float &localX, float &localY) const;
 
 public: // Used by RenderTaskList, which owns the SceneGraph::RenderTasks
 
@@ -231,70 +258,40 @@ public: // Used by RenderTaskList, which owns the SceneGraph::RenderTasks
    */
   void DiscardSceneObject();
 
-public: // Implementation of ProxyObject
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyCount()
-   */
-  virtual unsigned int GetDefaultPropertyCount() const;
+public: // Implementation of Object
 
   /**
-   * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyIndices()
+   * @copydoc Dali::Internal::Object::SetDefaultProperty()
    */
-  virtual void GetDefaultPropertyIndices( Property::IndexContainer& indices ) const;
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyName()
-   */
-  virtual const char* GetDefaultPropertyName(Property::Index index) const;
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyIndex()
-   */
-  virtual Property::Index GetDefaultPropertyIndex(const std::string& name) const;
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyWritable()
-   */
-  virtual bool IsDefaultPropertyWritable(Property::Index index) const;
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyAnimatable()
-   */
-  virtual bool IsDefaultPropertyAnimatable(Property::Index index) const;
-
-  /**
-   * @copydoc Dali::Internal::ProxyObject::IsDefaultPropertyAConstraintInput()
-   */
-  virtual bool IsDefaultPropertyAConstraintInput( Property::Index index ) const;
+  virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
 
   /**
-   * @copydoc Dali::Internal::ProxyObject::GetDefaultPropertyType()
+   * @copydoc Dali::Internal::Object::GetDefaultProperty()
    */
-  virtual Property::Type GetDefaultPropertyType(Property::Index index) const;
+  virtual Property::Value GetDefaultProperty( Property::Index index ) const;
 
   /**
-   * @copydoc Dali::Internal::ProxyObject::SetDefaultProperty()
+   * @copydoc Dali::Internal::Object::GetDefaultPropertyCurrentValue()
    */
-  virtual void SetDefaultProperty(Property::Index index, const Property::Value& propertyValue);
+  virtual Property::Value GetDefaultPropertyCurrentValue( Property::Index index ) const;
 
   /**
-   * @copydoc Dali::Internal::ProxyObject::GetDefaultProperty()
+   * @copydoc Dali::Internal::Object::OnNotifyDefaultPropertyAnimation()
    */
-  virtual Property::Value GetDefaultProperty( Property::Index index ) const;
+  virtual void OnNotifyDefaultPropertyAnimation( Animation& animation, Property::Index index, const Property::Value& value, Animation::Type animationType, bool animationStarted );
 
   /**
-   * @copydoc Dali::Internal::ProxyObject::GetSceneObject()
+   * @copydoc Dali::Internal::Object::GetSceneObject()
    */
   virtual const SceneGraph::PropertyOwner* GetSceneObject() const;
 
   /**
-   * @copydoc Dali::Internal::ProxyObject::GetSceneObjectAnimatableProperty()
+   * @copydoc Dali::Internal::Object::GetSceneObjectAnimatableProperty()
    */
   virtual const SceneGraph::PropertyBase* GetSceneObjectAnimatableProperty( Property::Index index ) const;
 
   /**
-   * @copydoc Dali::Internal::ProxyObject::GetSceneObjectInputProperty()
+   * @copydoc Dali::Internal::Object::GetSceneObjectInputProperty()
    */
   virtual const PropertyInputImpl* GetSceneObjectInputProperty( Property::Index index ) const;
 
@@ -317,7 +314,7 @@ public: //signals
   /**
    * @copydoc Dali::RenderTask::FinishedSignal()
    */
-  Dali::RenderTask::RenderTaskSignalV2& FinishedSignal();
+  Dali::RenderTask::RenderTaskSignalType& FinishedSignal();
 
   /**
    * Connects a callback function with the object's signals.
@@ -334,10 +331,8 @@ protected:
 
   /**
    * Construct a new RenderTask.
-   * @param[in] eventToUpdate Used to send messages to the update-thread.
-   * @param[in] isSystemLevel Whether the RenderTask is on the system level task list.
    */
-  RenderTask( EventToUpdate& eventToUpdate, bool isSystemLevel );
+  RenderTask();
 
   /**
    * A reference counted object may only be deleted by calling Unreference()
@@ -347,7 +342,7 @@ protected:
   /**
    * Helper class for connecting Nodes to the scene-graph RenderTask
    */
-  class Connector : public ProxyObject::Observer
+  class Connector : public Object::Observer
   {
   public:
 
@@ -379,22 +374,22 @@ protected:
      */
     void UpdateRenderTask();
 
-  public: // From ProxyObject::Observer
+  public: // From Object::Observer
 
     /**
-     * @copydoc Dali::Internal::ProxyObject::Observer::SceneObjectAdded
+     * @copydoc Dali::Internal::Object::Observer::SceneObjectAdded
      */
-    virtual void SceneObjectAdded( ProxyObject& proxy );
+    virtual void SceneObjectAdded( Object& object );
 
     /**
-     * @copydoc Dali::Internal::ProxyObject::Observer::SceneObjectAdded
+     * @copydoc Dali::Internal::Object::Observer::SceneObjectAdded
      */
-    virtual void SceneObjectRemoved( ProxyObject& proxy );
+    virtual void SceneObjectRemoved( Object& object );
 
     /**
-     * @copydoc Dali::Internal::ProxyObject::Observer::ProxyDestroyed
+     * @copydoc Dali::Internal::Object::Observer::ObjectDestroyed
      */
-    virtual void ProxyDestroyed( ProxyObject& proxy );
+    virtual void ObjectDestroyed( Object& object );
 
   private:
 
@@ -411,25 +406,29 @@ protected:
     RenderTask& mRenderTask;
 
     Actor* mActor; ///< Raw-pointer to the actor; not owned.
+    const SceneGraph::Camera* mCamera;    ///< Raw-pointer to camera scene-graph object; not owned.
   };
 
 private:
 
-  EventToUpdate& mEventToUpdate;
-
   SceneGraph::RenderTask* mSceneObject; ///< Raw-pointer to the scene-graph object; not owned.
 
   Connector mSourceConnector; ///< Responsible for connecting/disconnecting source Nodes
   Connector mCameraConnector; ///< Responsible for connecting/disconnecting camera Nodes
-  Connector mMappingConnector; /// Responsible for connecting/disconnection actor node, which used to mapping screen to frame buffer coordinate
+  Connector mMappingConnector; /// Responsible for connecting/disconnecting actor node, which used to mapping screen to frame buffer coordinate
 
   Vector4 mClearColor;       ///< Optional clear color
 
-  unsigned int mRefreshRate; ///< Determines how often the task is processed.
+  Vector2 mViewportPosition; ///< The cached viewport position
+  Vector2 mViewportSize;     ///< The cached viewport size
+
+  uint32_t mRefreshRate; ///< Determines how often the task is processed.
+
+  uint32_t mRefreshOnceCounter;
 
-  unsigned int mRefreshOnceCounter;
+  FrameBufferImagePtr mFrameBufferImage;  ///< Optional off-screen render target.
+  FrameBufferPtr  mFrameBuffer;
 
-  Dali::FrameBufferImage mFrameBufferImage;  ///< Optional off-screen render target.
 
   Dali::RenderTask::ScreenToFrameBufferFunction mScreenToFrameBufferFunction; ///< Used to convert screen to frame-buffer coordinates
 
@@ -437,10 +436,10 @@ private:
   bool mInputEnabled  : 1; ///< True if the render-task should be considered for input handling.
   bool mClearEnabled  : 1; ///< True if the render-task should be clear the color buffer.
   bool mCullMode      : 1; ///< True if the render-task's actors should be culled
-  bool mIsSystemLevel : 1; ///< True if the render-task is on the system level task list.
+  bool mRequiresSync  : 1; ///< True if the GL sync is required to track the render of.
 
   //Signals
-  Dali::RenderTask::RenderTaskSignalV2  mSignalFinishedV2; ///< Signal emmited when the render task has been processed.
+  Dali::RenderTask::RenderTaskSignalType  mSignalFinished; ///< Signal emmited when the render task has been processed.
 };
 
 } // namespace Internal