From 481eed02c912edc7ad2e402460540880712c7d0f Mon Sep 17 00:00:00 2001 From: Adeel Kazmi Date: Tue, 19 Sep 2017 15:33:03 +0100 Subject: [PATCH] Change the order of the nodes when actors are moved This is required because certain clipping scenarios stopped working as we only changed the depth index on the nodes but not the order in which they appear in the container. Clipping relied on the order of the nodes in the hieararchy. Change-Id: I7194c35318f55c326fe82886d6b58a865999e7bc --- dali/internal/update/manager/update-manager.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/dali/internal/update/manager/update-manager.cpp b/dali/internal/update/manager/update-manager.cpp index cf23bc2..897573b 100644 --- a/dali/internal/update/manager/update-manager.cpp +++ b/dali/internal/update/manager/update-manager.cpp @@ -139,8 +139,25 @@ inline void EraseUsingDiscardQueue( OwnerContainer& container, T* object, Di } } +/** + * Descends into node's hierarchy and sorts the children of each child according to their depth-index. + * @param[in] node The node whose hierarchy to descend + */ +void SortSiblingNodesRecursively( Node& node ) +{ + NodeContainer& container = node.GetChildren(); + std::sort( container.Begin(), container.End(), + []( Node* a, Node* b ) { return a->GetDepthIndex() < b->GetDepthIndex(); } ); + + // Descend tree and sort as well + for( auto&& iter : container ) + { + SortSiblingNodesRecursively( *iter ); + } } +} // unnamed namespace + /** * Structure to contain UpdateManager internal data */ @@ -1022,6 +1039,9 @@ void UpdateManager::SetDepthIndices( OwnerPointer< NodeDepths >& nodeDepths ) { iter.node->SetDepthIndex( iter.sortedDepth ); } + + // Go through node hierarchy and rearrange siblings according to depth-index + SortSiblingNodesRecursively( *( mImpl->root ) ); } void UpdateManager::AddSampler( OwnerPointer< Render::Sampler >& sampler ) -- 2.7.4