Recalculated layer's reusability flags after transform update
[platform/core/uifw/dali-core.git] / dali / internal / update / nodes / node.h
index 6f6e681..a886a9b 100644 (file)
@@ -122,13 +122,13 @@ public:
    * @param[in] updated The updated flag
    * (used for partial rendering to mark an animating sub tree for example).
    */
-  void SetUpdated(bool updated) override
+  void SetUpdatedTree(bool updated)
   {
     mUpdated = updated;
 
     for(Node* child : mChildren)
     {
-      child->SetUpdated(updated);
+      child->SetUpdatedTree(updated);
     }
   }
 
@@ -360,7 +360,12 @@ public:
    */
   const Vector3& GetParentOrigin() const
   {
-    return mParentOrigin.Get(0);
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
+    {
+      return mParentOrigin.Get(0);
+    }
+
+    return Vector3::ZERO;
   }
 
   /**
@@ -378,7 +383,12 @@ public:
    */
   const Vector3& GetAnchorPoint() const
   {
-    return mAnchorPoint.Get(0);
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
+    {
+      return mAnchorPoint.Get(0);
+    }
+
+    return Vector3::ZERO;
   }
 
   /**
@@ -411,7 +421,11 @@ public:
    */
   const Vector3& GetWorldPosition(BufferIndex bufferIndex) const
   {
-    return mWorldPosition.Get(bufferIndex);
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
+    {
+      return mWorldPosition.Get(bufferIndex);
+    }
+    return Vector3::ZERO;
   }
 
   /**
@@ -448,7 +462,11 @@ public:
    */
   const Quaternion& GetWorldOrientation(BufferIndex bufferIndex) const
   {
-    return mWorldOrientation.Get(0);
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
+    {
+      return mWorldOrientation.Get(0);
+    }
+    return Quaternion::IDENTITY;
   }
 
   /**
@@ -485,7 +503,11 @@ public:
    */
   const Vector3& GetWorldScale(BufferIndex bufferIndex) const
   {
-    return mWorldScale.Get(0);
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
+    {
+      return mWorldScale.Get(0);
+    }
+    return Vector3::ONE;
   }
 
   /**
@@ -686,7 +708,12 @@ public:
    */
   const Matrix& GetWorldMatrix(BufferIndex bufferIndex) const
   {
-    return mWorldMatrix.Get(bufferIndex);
+    if(mTransformManagerData.Id() != INVALID_TRANSFORM_ID)
+    {
+      return mWorldMatrix.Get(bufferIndex);
+    }
+
+    return Matrix::IDENTITY;
   }
 
   /**
@@ -725,6 +752,16 @@ public:
     return mDrawMode;
   }
 
+  void SetTransparent(bool transparent)
+  {
+    mTransparent = transparent;
+  }
+
+  bool IsTransparent() const
+  {
+    return mTransparent;
+  }
+
   /*
    * Returns the transform id of the node
    * @return The transform component id of the node
@@ -749,7 +786,11 @@ public:
    */
   void SetDepthIndex(uint32_t depthIndex)
   {
-    mDepthIndex = depthIndex;
+    if(depthIndex != mDepthIndex)
+    {
+      SetDirtyFlag(NodePropertyFlags::DEPTH_INDEX);
+      mDepthIndex = depthIndex;
+    }
   }
 
   /**
@@ -954,6 +995,7 @@ protected:
   bool               mIsRoot : 1;                  ///< True if the node cannot have a parent
   bool               mIsLayer : 1;                 ///< True if the node is a layer
   bool               mPositionUsesAnchorPoint : 1; ///< True if the node should use the anchor-point when calculating the position
+  bool               mTransparent : 1;             ///< True if this node is transparent. This value do not affect children.
 
   // Changes scope, should be at end of class
   DALI_LOG_OBJECT_STRING_DECLARATION;
@@ -1038,6 +1080,17 @@ inline void SetDrawModeMessage(EventThreadServices& eventThreadServices, const N
   new(slot) LocalType(&node, &Node::SetDrawMode, drawMode);
 }
 
+inline void SetTransparentMessage(EventThreadServices& eventThreadServices, const Node& node, bool transparent)
+{
+  using LocalType = MessageValue1<Node, bool>;
+
+  // Reserve some memory inside the message queue
+  uint32_t* slot = eventThreadServices.ReserveMessageSlot(sizeof(LocalType));
+
+  // Construct message in the message queue memory; note that delete should not be called on the return value
+  new(slot) LocalType(&node, &Node::SetTransparent, transparent);
+}
+
 inline void DetachRendererMessage(EventThreadServices& eventThreadServices, const Node& node, const Renderer& renderer)
 {
   using LocalType = MessageValue1<Node, const Renderer*>;