Skip to content

Commit a242a79

Browse files
tankorsmashminggo
authored andcommitted
Small performance boost in using Mat4::operator*= instead of operator* (cocos2d#19960)
This avoids creating a new temporary Mat4 transform in operator* https://github.com/cocos2d/cocos2d-x/blob/v3/cocos/math/Mat4.inl#L60
1 parent 69e7825 commit a242a79

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cocos/2d/CCNode.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1686,7 +1686,7 @@ Mat4 Node::getNodeToParentTransform(Node* ancestor) const
16861686

16871687
for (Node *p = _parent; p != nullptr && p != ancestor ; p = p->getParent())
16881688
{
1689-
t = p->getNodeToParentTransform() * t;
1689+
t *= p->getNodeToParentTransform();
16901690
}
16911691

16921692
return t;

0 commit comments

Comments
 (0)