From ea0b763e3bd6ee74b8c1687aef3ba6da6526a26e Mon Sep 17 00:00:00 2001 From: Takaya Kakizaki Date: Tue, 30 Apr 2019 11:03:55 +0900 Subject: [PATCH] fix Sprite update_blend_func --- cocos/2d/CCSprite.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/cocos/2d/CCSprite.cpp b/cocos/2d/CCSprite.cpp index 3c1f7ae0d229..4cd1e3c057f3 100644 --- a/cocos/2d/CCSprite.cpp +++ b/cocos/2d/CCSprite.cpp @@ -399,11 +399,14 @@ void Sprite::setTexture(Texture2D *texture) } } - if ((_renderMode != RenderMode::QUAD_BATCHNODE) && (_texture != texture)) + if (_renderMode != RenderMode::QUAD_BATCHNODE) { - CC_SAFE_RETAIN(texture); - CC_SAFE_RELEASE(_texture); - _texture = texture; + if (_texture != texture) + { + CC_SAFE_RETAIN(texture); + CC_SAFE_RELEASE(_texture); + _texture = texture; + } updateBlendFunc(); } }