From bf80f10dfd41585698f94906c0eedd3a28ea2480 Mon Sep 17 00:00:00 2001 From: James Chen Date: Fri, 22 Jul 2016 18:37:43 +0800 Subject: [PATCH] Remove unneeded std::bind, and use const & for input parameters. --- cocos/2d/CCLabel.h | 4 ++-- cocos/2d/CCLabelTextFormatter.cpp | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cocos/2d/CCLabel.h b/cocos/2d/CCLabel.h index 9c5a5650c9..90772d2fa7 100644 --- a/cocos/2d/CCLabel.h +++ b/cocos/2d/CCLabel.h @@ -648,8 +648,8 @@ protected: bool multilineTextWrapByChar(); bool multilineTextWrapByWord(); - bool multilineTextWrap(std::function lambda); - void shrinkLabelToContentSize(std::function lambda); + bool multilineTextWrap(const std::function& lambda); + void shrinkLabelToContentSize(const std::function& lambda); bool isHorizontalClamp(); bool isVerticalClamp(); float getRenderingFontSize()const; diff --git a/cocos/2d/CCLabelTextFormatter.cpp b/cocos/2d/CCLabelTextFormatter.cpp index 34d265d14f..7228d2d29f 100644 --- a/cocos/2d/CCLabelTextFormatter.cpp +++ b/cocos/2d/CCLabelTextFormatter.cpp @@ -130,7 +130,7 @@ void Label::updateBMFontScale() } } -bool Label::multilineTextWrap(std::function nextTokenLen) +bool Label::multilineTextWrap(const std::function& nextTokenLen) { int textLen = getStringLength(); int lineIndex = 0; @@ -270,12 +270,12 @@ bool Label::multilineTextWrap(std::function lambda) +void Label::shrinkLabelToContentSize(const std::function& lambda) { float fontSize = this->getRenderingFontSize();