Use const references whenever possible

This commit is contained in:
Wenhai Lin
2016-05-18 14:26:43 +08:00
parent 94c6dcdf6a
commit 5dcd5ed979
33 changed files with 72 additions and 72 deletions
@@ -294,7 +294,7 @@ void ControlSlider::needsLayout()
_progressSprite->setTextureRect(textureRect, _progressSprite->isTextureRectRotated(), textureRect.size);
}
void ControlSlider::sliderBegan(Vec2 location)
void ControlSlider::sliderBegan(const Vec2& location)
{
this->setSelected(true);
_thumbSprite->setVisible(false);
@@ -302,12 +302,12 @@ void ControlSlider::sliderBegan(Vec2 location)
setValue(valueForLocation(location));
}
void ControlSlider::sliderMoved(Vec2 location)
void ControlSlider::sliderMoved(const Vec2& location)
{
setValue(valueForLocation(location));
}
void ControlSlider::sliderEnded(Vec2 location)
void ControlSlider::sliderEnded(const Vec2& location)
{
if (this->isSelected())
{
@@ -318,7 +318,7 @@ void ControlSlider::sliderEnded(Vec2 location)
this->setSelected(false);
}
float ControlSlider::valueForLocation(Vec2 location)
float ControlSlider::valueForLocation(const Vec2& location)
{
float percent = location.x/ _backgroundSprite->getContentSize().width;
return MAX(MIN(_minimumValue + percent * (_maximumValue - _minimumValue), _maximumAllowedValue), _minimumAllowedValue);