From: Eunki, Hong Date: Mon, 6 Nov 2023 06:00:02 +0000 (+0900) Subject: Reset UpdateProxy traveler only if descendent hierarchy changed X-Git-Tag: dali_2.2.52~7 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=760cbde2a256ee0c2071b6104b62b75456aa82c5;p=platform%2Fcore%2Fuifw%2Fdali-core.git Reset UpdateProxy traveler only if descendent hierarchy changed 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 --- diff --git a/dali/internal/update/manager/frame-callback-processor.cpp b/dali/internal/update/manager/frame-callback-processor.cpp index afa480ecd..8e02e21bd 100644 --- a/dali/internal/update/manager/frame-callback-processor.cpp +++ b/dali/internal/update/manager/frame-callback-processor.cpp @@ -95,7 +95,11 @@ bool FrameCallbackProcessor::Update(BufferIndex bufferIndex, float elapsedSecond } else { - (iter++)->second->NodeHierarchyChanged(); + if(iter->first->IsDescendentHierarchyChanged()) + { + iter->second->NodeHierarchyChanged(); + } + ++iter; } } } diff --git a/dali/internal/update/manager/update-manager.cpp b/dali/internal/update/manager/update-manager.cpp index 484687ae2..098c0a916 100644 --- a/dali/internal/update/manager/update-manager.cpp +++ b/dali/internal/update/manager/update-manager.cpp @@ -408,6 +408,7 @@ void UpdateManager::ConnectNode(Node* parent, Node* node) 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); @@ -425,7 +426,7 @@ void UpdateManager::DisconnectNode(Node* node) 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); @@ -1315,9 +1316,13 @@ void UpdateManager::SetDepthIndices(OwnerPointer& nodeDepths) // 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()) { diff --git a/dali/internal/update/nodes/node-declarations.h b/dali/internal/update/nodes/node-declarations.h index c6fb7aaa3..6a66d30a3 100644 --- a/dali/internal/update/nodes/node-declarations.h +++ b/dali/internal/update/nodes/node-declarations.h @@ -41,15 +41,16 @@ using NodeConstIter = NodeContainer::ConstIterator; * 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 diff --git a/dali/internal/update/nodes/node.h b/dali/internal/update/nodes/node.h index 2af3568d5..52f76bbbe 100644 --- a/dali/internal/update/nodes/node.h +++ b/dali/internal/update/nodes/node.h @@ -889,11 +889,33 @@ public: * @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