Optimize transform level propagate 14/281814/1
authorEunki, Hong <eunkiki.hong@samsung.com>
Thu, 22 Sep 2022 05:45:25 +0000 (14:45 +0900)
committerEunki, Hong <eunkiki.hong@samsung.com>
Thu, 22 Sep 2022 05:47:22 +0000 (14:47 +0900)
We can assume that if mIds[mParent[i]] < i,
then parent's mOrderedCompoents data validated.
So, if we can, we can use this valid parent value.

Change-Id: I464008a53d61258fcff846e07f92aee0a9d5cb8d
Signed-off-by: Eunki, Hong <eunkiki.hong@samsung.com>
dali/internal/update/manager/transform-manager.cpp

index 8f7680e9e3e13453296577dd88d90252a17d7363..bec0a7ca0c5ae6638d74a2208faafa992581dfe5 100644 (file)
@@ -370,15 +370,25 @@ void TransformManager::ReorderComponents()
     }
   }
 
-  // Propagate sceneId
+  // Propagate sceneId and level
   for(TransformId i = 0; i < mComponentCount; ++i)
   {
     parentId = mParent[i];
     while(parentId != INVALID_TRANSFORM_ID)
     {
-      mOrderedComponents[i].level++;
-      mOrderedComponents[i].sceneId = mOrderedComponents[mIds[parentId]].sceneId;
-      parentId                      = mParent[mIds[parentId]];
+      const uint32_t parentIndex = mIds[parentId];
+      ++mOrderedComponents[i].level;
+      mOrderedComponents[i].sceneId = mOrderedComponents[parentIndex].sceneId;
+      if(parentIndex < i)
+      {
+        // Parent information update done. We can reuse it.
+        mOrderedComponents[i].level += mOrderedComponents[parentIndex].level;
+        break;
+      }
+      else
+      {
+        parentId = mParent[parentIndex];
+      }
     }
   }