From 31cd64e36244f56920ccb139ecda619cf6427167 Mon Sep 17 00:00:00 2001 From: TankorSmash Date: Mon, 22 Jul 2019 20:56:26 -0400 Subject: [PATCH] Small performance boost in using Mat4::operator*= instead of operator* This avoids creating a new temporary Mat4 transform in operator* https://github.com/cocos2d/cocos2d-x/blob/v3/cocos/math/Mat4.inl#L60 --- cocos/2d/CCNode.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cocos/2d/CCNode.cpp b/cocos/2d/CCNode.cpp index 8aea3820a4ad..11cceca7745a 100644 --- a/cocos/2d/CCNode.cpp +++ b/cocos/2d/CCNode.cpp @@ -1686,7 +1686,7 @@ Mat4 Node::getNodeToParentTransform(Node* ancestor) const for (Node *p = _parent; p != nullptr && p != ancestor ; p = p->getParent()) { - t = p->getNodeToParentTransform() * t; + t *= p->getNodeToParentTransform(); } return t;