Add new dirty flags about descendent hierarchy changed.
It will be useful when we want to know that given node's traveler
need to reset cache or not.
Change-Id: I62cebb40b92e808bcf5fd446517da32442463b42
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
}
else
{
- (iter++)->second->NodeHierarchyChanged();
+ if(iter->first->IsDescendentHierarchyChanged())
+ {
+ iter->second->NodeHierarchyChanged();
+ }
+ ++iter;
}
}
}
DALI_LOG_INFO(gLogFilter, Debug::General, "[%x] ConnectNode\n", node);
+ parent->SetDirtyFlag(NodePropertyFlags::DESCENDENT_HIERARCHY_CHANGED); // make parent dirty so that render items dont get reused
parent->ConnectChild(node);
node->AddInitializeResetter(*this);
Node* parent = node->GetParent();
DALI_ASSERT_ALWAYS(nullptr != parent);
- parent->SetDirtyFlag(NodePropertyFlags::CHILD_DELETED); // make parent dirty so that render items dont get reused
+ parent->SetDirtyFlag(NodePropertyFlags::CHILD_DELETED | NodePropertyFlags::DESCENDENT_HIERARCHY_CHANGED); // make parent dirty so that render items dont get reused
parent->DisconnectChild(mSceneGraphBuffers.GetUpdateBufferIndex(), *node);
// note, this vector is already in depth order.
// So if we reverse iterate, we can assume that
// my descendant node's depth index are updated.
+
+ // And also, This API is the last flushed message.
+ // We can now setup the DESCENDENT_HIERARCHY_CHANGED flag here.
for(auto rIter = nodeDepths->nodeDepths.rbegin(), rEndIter = nodeDepths->nodeDepths.rend(); rIter != rEndIter; rIter++)
{
auto* node = rIter->node;
+ node->PropagateDescendentFlags();
node->SetDepthIndex(rIter->sortedDepth);
if(node->IsChildrenReorderRequired())
{
* Flag whether property has changed, during the Update phase.
*/
enum class NodePropertyFlags : uint8_t
-// 8 bits is enough for 5 flags (compiler will check it)
+// 8 bits is enough for 6 flags (compiler will check it)
{
- NOTHING = 0x000,
- TRANSFORM = 0x001,
- VISIBLE = 0x002,
- COLOR = 0x004,
- CHILD_DELETED = 0x008,
- CHILDREN_REORDER = 0x010,
- ALL = (CHILDREN_REORDER << 1) - 1 // all the flags
+ NOTHING = 0x000,
+ TRANSFORM = 0x001,
+ VISIBLE = 0x002,
+ COLOR = 0x004,
+ CHILD_DELETED = 0x008,
+ CHILDREN_REORDER = 0x010,
+ DESCENDENT_HIERARCHY_CHANGED = 0x020,
+ ALL = (DESCENDENT_HIERARCHY_CHANGED << 1) - 1 // all the flags
};
struct NodeDepthPair
* @note It will be reset when mDirtyFlag reseted.
* @return True if children sibiling order need to be changed.
*/
- uint32_t IsChildrenReorderRequired() const
+ bool IsChildrenReorderRequired() const
{
return mDirtyFlags & NodePropertyFlags::CHILDREN_REORDER;
}
/**
+ * @brief Get whether descendent hierarchy was changed.
+ * @pre The flag will be propagate at UpdateManager::SetDepthIndices().
+ * @note It will be reset when mDirtyFlag reseted.
+ * @return True if children sibiling order need to be changed.
+ */
+ bool IsDescendentHierarchyChanged() const
+ {
+ return mDirtyFlags & NodePropertyFlags::DESCENDENT_HIERARCHY_CHANGED;
+ }
+
+ /**
+ * @brief Propagate the heirarchy changeness flag to it's parent node.
+ */
+ void PropagateDescendentFlags()
+ {
+ if(IsDescendentHierarchyChanged() && mParent)
+ {
+ mParent->SetDirtyFlag(NodePropertyFlags::DESCENDENT_HIERARCHY_CHANGED);
+ }
+ }
+
+ /**
* @brief Sets the boolean which states whether the position should use the anchor-point.
* @param[in] positionUsesAnchorPoint True if the position should use the anchor-point
*/