Merge "[dali-core] add all X11 colors to Color namespace" into devel/master
[platform/core/uifw/dali-core.git] / dali / internal / event / common / scene-impl.h
old mode 100644 (file)
new mode 100755 (executable)
index 9b95c2a..44a5e3b
@@ -44,6 +44,54 @@ namespace Internal
 namespace SceneGraph
 {
 class Scene;
+
+struct DirtyRect
+{
+  DirtyRect(Node* node, Render::Renderer* renderer, int frame, Rect<int>& rect)
+  : node(node),
+    renderer(renderer),
+    frame(frame),
+    rect(rect),
+    visited(true)
+  {
+  }
+
+  DirtyRect()
+  : node(nullptr),
+    renderer(nullptr),
+    frame(0),
+    rect(),
+    visited(true)
+  {
+  }
+
+  bool operator<(const DirtyRect& rhs) const
+  {
+    if (node == rhs.node)
+    {
+      if (renderer == rhs.renderer)
+      {
+        return frame > rhs.frame; // Most recent rects come first
+      }
+      else
+      {
+        return renderer < rhs.renderer;
+      }
+    }
+    else
+    {
+      return node < rhs.node;
+    }
+  }
+
+  Node* node;
+  Render::Renderer* renderer;
+  int frame;
+
+  Rect<int> rect;
+  bool visited;
+};
+
 }
 
 class EventProcessor;
@@ -66,12 +114,12 @@ public:
   /**
    * @copydoc Dali::Integration::Scene::New
    */
-  static ScenePtr New( Size size );
+  static ScenePtr New(Size size, int orientation = 0);
 
   /**
    * virtual destructor
    */
-  virtual ~Scene();
+  ~Scene() override;
 
   /**
    * @copydoc Dali::Integration::Scene::Add
@@ -184,17 +232,35 @@ public:
   SceneGraph::Scene* GetSceneObject() const;
 
   /**
+   * Notify the surface has been rotated.
+   * When the device is rotated or the rotation event is received by display manager,
+   * this function will be called by window implementation.
+   *
+   * @param[in] width The width of rotated surface
+   * @param[in] height The height of rotated surface
+   * @param[in] orientation The orientation of rotated surface
+   */
+  void SurfaceRotated(float width, float height, int orientation);
+
+  /**
+   * @brief Get surface's current orientation
+   *
+   * @return surface orientation
+   */
+  int GetSurfaceOrientation();
+
+  /**
    * Used by the EventProcessor to emit key event signals.
    * @param[in] event The key event.
    */
-  void EmitKeyEventSignal(const KeyEvent& event);
+  void EmitKeyEventSignal(const Dali::KeyEvent& event);
 
   /**
    * Used by the KeyEventProcessor to emit KeyEventGenerated signals.
    * @param[in] event The key event.
    * @return The return is true if KeyEvent is consumed, otherwise false.
    */
-  bool EmitKeyEventGeneratedSignal(const KeyEvent& event);
+  bool EmitKeyEventGeneratedSignal(const Dali::KeyEvent& event);
 
   /**
    * Emits the event processing finished signal.
@@ -207,13 +273,13 @@ public:
    * Emits the touched signal.
    * @param[in] touch The touch event details.
    */
-  void EmitTouchedSignal( const Dali::TouchData& touch );
+  void EmitTouchedSignal( const Dali::TouchEvent& touch );
 
   /**
    * Used by the EventProcessor to emit wheel event signals.
    * @param[in] event The wheel event.
    */
-  void EmitWheelEventSignal( const WheelEvent& event );
+  void EmitWheelEventSignal( const Dali::WheelEvent& event );
 
   /**
    * @copydoc Dali::Integration::Scene::AddFrameRenderedCallback
@@ -251,28 +317,35 @@ public:
   Integration::Scene::EventProcessingFinishedSignalType& EventProcessingFinishedSignal();
 
   /**
-    * @copydoc Integration::Scene::TouchSignal()
+    * @copydoc Integration::Scene::TouchedSignal()
     */
-  Integration::Scene::TouchSignalType& TouchSignal();
+  Integration::Scene::TouchEventSignalType& TouchedSignal();
 
   /**
    * @copydoc Integration::Scene::sWheelEventSignal()
    */
   Integration::Scene::WheelEventSignalType& WheelEventSignal();
 
+  /**
+   * @brief Get ItemsDirtyRects
+   *
+   * @return the ItemsDirtyRects
+   */
+  std::vector<Dali::Internal::SceneGraph::DirtyRect>& GetItemsDirtyRects();
+
 public:
 
   /**
    * From RenderTaskDefaults; retrieve the default root actor.
    * @return The default root actor.
    */
-  virtual Actor& GetDefaultRootActor();
+  Actor& GetDefaultRootActor() override;
 
   /**
    * From RenderTaskDefaults; retrieve the default camera actor.
    * @return The default camera actor.
    */
-  virtual CameraActor& GetDefaultCameraActor();
+  CameraActor& GetDefaultCameraActor() override;
 
 private:
 
@@ -283,8 +356,9 @@ private:
    * Second-phase constructor.
    *
    * @param[in] size The size of the set surface
+   * @param[in] orientation The orientation of the set surface for this scene
    */
-  void Initialize( Size size );
+  void Initialize(Size size, int orientation);
 
   // Undefined
   Scene(const Scene&) = delete;
@@ -292,6 +366,15 @@ private:
   // Undefined
   Scene& operator=(const Scene& rhs) = delete;
 
+  /**
+   * Informs the scene that the set surface has been resized or rotated.
+   *
+   * @param[in] width The width of rotated surface
+   * @param[in] height The height of rotated surface
+   * @param[in] orientation The orientation of rotated surface
+   */
+  void ChangedSurface(float width, float height, int orientation);
+
 private:
   Internal::SceneGraph::Scene* mSceneObject;
 
@@ -315,6 +398,9 @@ private:
 
   EventProcessor mEventProcessor;
 
+  // The Surface's orientation
+  int mSurfaceOrientation;
+
   // The key event signal
   Integration::Scene::KeyEventSignalType mKeyEventSignal;
   Integration::Scene::KeyEventGeneratedSignalType   mKeyEventGeneratedSignal;
@@ -323,10 +409,12 @@ private:
   Integration::Scene::EventProcessingFinishedSignalType mEventProcessingFinishedSignal;
 
   // The touch signal
-  Integration::Scene::TouchSignalType mTouchSignal;
+  Integration::Scene::TouchEventSignalType mTouchedSignal;
 
   // The wheel event signal
   Integration::Scene::WheelEventSignalType mWheelEventSignal;
+
+  std::vector<Dali::Internal::SceneGraph::DirtyRect>                    mItemsDirtyRects;
 };
 
 } // Internal