From 5bc130dee765ad13c4f11545c41d8b0d35d66d3f Mon Sep 17 00:00:00 2001 From: mustime Date: Fri, 27 Jul 2012 18:20:11 +0800 Subject: [PATCH] issue #1381: change the setContentSize interface in CCScrollView --- cocos2dx/base_nodes/CCNode.cpp | 2 +- cocos2dx/extensions/CCScrollView/CCScrollView.cpp | 6 +++--- cocos2dx/extensions/CCScrollView/CCScrollView.h | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cocos2dx/base_nodes/CCNode.cpp b/cocos2dx/base_nodes/CCNode.cpp index b6802d3f0c..504d99bb71 100644 --- a/cocos2dx/base_nodes/CCNode.cpp +++ b/cocos2dx/base_nodes/CCNode.cpp @@ -357,7 +357,7 @@ void CCNode::setAnchorPoint(const CCPoint& point) } /// contentSize getter -CCSize CCNode::getContentSize() +const CCSize & CCNode::getContentSize() { return m_tContentSize; } diff --git a/cocos2dx/extensions/CCScrollView/CCScrollView.cpp b/cocos2dx/extensions/CCScrollView/CCScrollView.cpp index e4d2170c45..e3b81118c3 100644 --- a/cocos2dx/extensions/CCScrollView/CCScrollView.cpp +++ b/cocos2dx/extensions/CCScrollView/CCScrollView.cpp @@ -449,12 +449,12 @@ void CCScrollView::performedAnimatedScroll(float dt) } -CCSize CCScrollView::getContentSize() +const CCSize & CCScrollView::getContentSize() { - return CCSizeMake(m_pContainer->getContentSize().width, m_pContainer->getContentSize().height); + return m_pContainer->getContentSize(); } -void CCScrollView::setContentSize(CCSize size) +void CCScrollView::setContentSize(const CCSize & size) { this->setViewSize(size); } diff --git a/cocos2dx/extensions/CCScrollView/CCScrollView.h b/cocos2dx/extensions/CCScrollView/CCScrollView.h index ad219c4643..72fc7a1f46 100644 --- a/cocos2dx/extensions/CCScrollView/CCScrollView.h +++ b/cocos2dx/extensions/CCScrollView/CCScrollView.h @@ -206,8 +206,8 @@ public: virtual void ccTouchEnded(CCTouch *pTouch, CCEvent *pEvent); virtual void ccTouchCancelled(CCTouch *pTouch, CCEvent *pEvent); - virtual void setContentSize(CCSize size); - virtual CCSize getContentSize(); + virtual void setContentSize(const CCSize & size); + virtual const CCSize & getContentSize(); /** * Determines whether it clips its children or not.