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>
}
}
- // 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];
+ }
}
}