diff --git a/cocos/2d/CCSprite.cpp b/cocos/2d/CCSprite.cpp index 22bf725924..25de7b0434 100644 --- a/cocos/2d/CCSprite.cpp +++ b/cocos/2d/CCSprite.cpp @@ -42,8 +42,6 @@ THE SOFTWARE. #include "platform/CCFileUtils.h" #include "renderer/ccShaders.h" #include "renderer/backend/ProgramState.h" -#include "base/CCEventDispatcher.h" -#include "base/CCEventListenerCustom.h" NS_CC_BEGIN @@ -304,9 +302,6 @@ Sprite::Sprite() _debugDrawNode = DrawNode::create(); addChild(_debugDrawNode); #endif //CC_SPRITE_DEBUG_DRAW - - _projectionChangedEvent = Director::getInstance()->getEventDispatcher()->addCustomEventListener(Director::EVENT_PROJECTION_CHANGED, std::bind(&Sprite::onProjectionChanged, this, std::placeholders::_1)); - _projectionChangedEvent->retain(); } Sprite::~Sprite() @@ -316,9 +311,6 @@ Sprite::~Sprite() CC_SAFE_RELEASE(_spriteFrame); CC_SAFE_RELEASE(_texture); CC_SAFE_RELEASE(_programState); - - Director::getInstance()->getEventDispatcher()->removeEventListener(_projectionChangedEvent); - CC_SAFE_RELEASE(_projectionChangedEvent); } /* @@ -401,8 +393,6 @@ void Sprite::setProgramState(backend::ProgramState *programState) pipelineDescriptor.programState = _programState; _mvpMatrixLocation = pipelineDescriptor.programState->getUniformLocation("u_MVPMatrix"); - setMVPMatrixUniform(); - _textureLocation = pipelineDescriptor.programState->getUniformLocation("u_texture"); _alphaTextureLocation = pipelineDescriptor.programState->getUniformLocation("u_texture1"); @@ -1742,9 +1732,4 @@ void Sprite::setMVPMatrixUniform() programState->setUniform(_mvpMatrixLocation, projectionMat.m, sizeof(projectionMat.m)); } -void Sprite::onProjectionChanged(EventCustom* /*event*/) -{ - setMVPMatrixUniform(); -} - NS_CC_END diff --git a/cocos/2d/CCSprite.h b/cocos/2d/CCSprite.h index afbbe1414f..529f9a39ad 100644 --- a/cocos/2d/CCSprite.h +++ b/cocos/2d/CCSprite.h @@ -45,7 +45,6 @@ class Rect; class Size; class Texture2D; struct transformValues_; -class EventListenerCustom; #ifdef SPRITE_RENDER_IN_SUBPIXEL #undef SPRITE_RENDER_IN_SUBPIXEL @@ -642,7 +641,6 @@ protected: void updateStretchFactor(); void populateTriangle(int quadIndex, const V3F_C4B_T2F_Quad& quad); void setMVPMatrixUniform(); - void onProjectionChanged(EventCustom* event); // // Data used when the sprite is rendered using a SpriteSheet @@ -710,8 +708,6 @@ protected: int _fileType = 0; bool _stretchEnabled = true; - - EventListenerCustom* _projectionChangedEvent = nullptr; private: CC_DISALLOW_COPY_AND_ASSIGN(Sprite);