Fixed SizeMode not updating size on renderable in some cases 95/35595/2
authorTom Robinson <tom.robinson@samsung.com>
Wed, 18 Feb 2015 17:43:06 +0000 (17:43 +0000)
committerTom Robinson <tom.robinson@samsung.com>
Thu, 19 Feb 2015 09:24:39 +0000 (09:24 +0000)
Change-Id: I44d18bd0b5ec417616e3c4016d2ddf65744123d2

dali/internal/update/manager/update-algorithms.cpp

index a4e0c4b..5e08ce3 100644 (file)
@@ -173,7 +173,16 @@ inline void UpdateRootNodeTransformValues( Layer& rootNode, int nodeDirtyFlags,
   }
 }
 
-inline void UpdateNodeTransformValues( Node& node, int nodeDirtyFlags, BufferIndex updateBufferIndex )
+/**
+ * Updates transform values for the given node if the transform flag is dirty.
+ * This includes applying a new size should the SizeMode require it.
+ * Note that this will cause the size dirty flag to be set. This is why we pass
+ * the dirty flags in by reference.
+ * @param[in]     node The node to update
+ * @param[in,out] nodeDirtyFlags A reference to the dirty flags, these may be modified by this function
+ * @param[in]     updateBufferIndex The current index to use for this frame
+ */
+inline void UpdateNodeTransformValues( Node& node, int& nodeDirtyFlags, BufferIndex updateBufferIndex )
 {
   // If the transform values need to be reinherited
   if( nodeDirtyFlags & TransformFlag )
@@ -181,6 +190,7 @@ inline void UpdateNodeTransformValues( Node& node, int nodeDirtyFlags, BufferInd
     // Handle size relative to parent modes.
     // This must be delt with before rotation/translation as otherwise anything
     // anchored to a corner of this child would appear at the wrong position.
+    // The size dirty flag is modified if the size is being overridden.
     // Note: Switch is in order of use-case commonality.
     switch( node.GetSizeMode() )
     {
@@ -194,6 +204,7 @@ inline void UpdateNodeTransformValues( Node& node, int nodeDirtyFlags, BufferInd
       {
         // Set the nodes size to that of the parent.
         node.SetSize( updateBufferIndex, node.GetParent()->GetSize( updateBufferIndex ) );
+        nodeDirtyFlags |= SizeFlag;
         break;
       }
 
@@ -201,6 +212,7 @@ inline void UpdateNodeTransformValues( Node& node, int nodeDirtyFlags, BufferInd
       {
         // Set the nodes size to the parents multiplied by a user defined value.
         node.SetSize( updateBufferIndex, node.GetSizeModeFactor() * node.GetParent()->GetSize( updateBufferIndex ) );
+        nodeDirtyFlags |= SizeFlag;
         break;
       }
 
@@ -208,6 +220,7 @@ inline void UpdateNodeTransformValues( Node& node, int nodeDirtyFlags, BufferInd
       {
         // Set the nodes size to the parents plus a user defined value.
         node.SetSize( updateBufferIndex, node.GetSizeModeFactor() + node.GetParent()->GetSize( updateBufferIndex ) );
+        nodeDirtyFlags |= SizeFlag;
         break;
       }
     }
@@ -414,6 +427,8 @@ inline int UpdateNodesAndAttachments( Node& node,
 
   UpdateNodeGeometry( node, nodeDirtyFlags, updateBufferIndex );
 
+  // Note: nodeDirtyFlags are passed in by reference and may be modified by the following function.
+  // It is important that the modified version of these flags are used by the RenderableAttachment.
   UpdateNodeTransformValues( node, nodeDirtyFlags, updateBufferIndex );
 
   // Setting STENCIL will override OVERLAY, if that would otherwise have been inherited.