Skip to content

Commit f180c0a

Browse files
kackythuangwei1024
authored andcommitted
fix Sprite update_blend_func (cocos2d#19649)
1 parent faf784e commit f180c0a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

cocos/2d/CCSprite.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,14 @@ void Sprite::setTexture(Texture2D *texture)
399399
}
400400
}
401401

402-
if ((_renderMode != RenderMode::QUAD_BATCHNODE) && (_texture != texture))
402+
if (_renderMode != RenderMode::QUAD_BATCHNODE)
403403
{
404-
CC_SAFE_RETAIN(texture);
405-
CC_SAFE_RELEASE(_texture);
406-
_texture = texture;
404+
if (_texture != texture)
405+
{
406+
CC_SAFE_RETAIN(texture);
407+
CC_SAFE_RELEASE(_texture);
408+
_texture = texture;
409+
}
407410
updateBlendFunc();
408411
}
409412
}

0 commit comments

Comments
 (0)