GI-556: cherry-pick https://github.com/bmanGH/cocos2d-x/commit/09ae90f