diff --git a/extensions/GUI/CCScrollView/CCScrollView.cpp b/extensions/GUI/CCScrollView/CCScrollView.cpp index 9d1981e4dc..f487f0b84a 100644 --- a/extensions/GUI/CCScrollView/CCScrollView.cpp +++ b/extensions/GUI/CCScrollView/CCScrollView.cpp @@ -485,10 +485,17 @@ void ScrollView::addChild(Node * child, int zOrder, int tag) } } +void ScrollView::beforeDraw() +{ + _beforeDrawCommand.init(0, _vertexZ); + _beforeDrawCommand.func = CC_CALLBACK_0(ScrollView::onBeforeDraw, this); + Director::getInstance()->getRenderer()->addCommand(&_beforeDrawCommand); +} + /** * clip this view so that outside of the visible bounds can be hidden. */ -void ScrollView::beforeDraw() +void ScrollView::onBeforeDraw() { if (_clippingToBounds) { @@ -513,11 +520,18 @@ void ScrollView::beforeDraw() } } +void ScrollView::afterDraw() +{ + _afterDrawCommand.init(0, _vertexZ); + _afterDrawCommand.func = CC_CALLBACK_0(ScrollView::onAfterDraw, this); + Director::getInstance()->getRenderer()->addCommand(&_afterDrawCommand); +} + /** * retract what's done in beforeDraw so that there's no side effect to * other nodes. */ -void ScrollView::afterDraw() +void ScrollView::onAfterDraw() { if (_clippingToBounds) { diff --git a/extensions/GUI/CCScrollView/CCScrollView.h b/extensions/GUI/CCScrollView/CCScrollView.h index bef479e49b..c77d74bc13 100644 --- a/extensions/GUI/CCScrollView/CCScrollView.h +++ b/extensions/GUI/CCScrollView/CCScrollView.h @@ -254,11 +254,13 @@ protected: * clip this view so that outside of the visible bounds can be hidden. */ void beforeDraw(); + void onBeforeDraw(); /** * retract what's done in beforeDraw so that there's no side effect to * other nodes. */ void afterDraw(); + void onAfterDraw(); /** * Zoom handling */ @@ -351,6 +353,9 @@ protected: /** Touch listener */ EventListenerTouchOneByOne* _touchListener; + + CustomCommand _beforeDrawCommand; + CustomCommand _afterDrawCommand; }; // end of GUI group