We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4db6353 commit fa3ab72Copy full SHA for fa3ab72
cocos/renderer/CCTexture2D.cpp
@@ -1499,10 +1499,12 @@ void Texture2D::removeSpriteFrameCapInset(SpriteFrame* spriteFrame)
1499
/// halx99 spec, ANDROID ETC1 ALPHA supports.
1500
void Texture2D::setAlphaTexture(Texture2D* alphaTexture)
1501
{
1502
- if (alphaTexture != nullptr) {
1503
- this->_alphaTexture = alphaTexture;
1504
- this->_alphaTexture->retain();
1505
- this->_hasPremultipliedAlpha = true; // PremultipliedAlpha should be true.
+ if (alphaTexture != nullptr)
+ {
+ alphaTexture->retain();
+ CC_SAFE_RELEASE(_alphaTexture);
1506
+ _alphaTexture = alphaTexture;
1507
+ _hasPremultipliedAlpha = true; // PremultipliedAlpha should be true.
1508
}
1509
1510
0 commit comments