Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions cocos/renderer/CCTexture2D.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1499,10 +1499,12 @@ void Texture2D::removeSpriteFrameCapInset(SpriteFrame* spriteFrame)
/// halx99 spec, ANDROID ETC1 ALPHA supports.
void Texture2D::setAlphaTexture(Texture2D* alphaTexture)
{
if (alphaTexture != nullptr) {
this->_alphaTexture = alphaTexture;
this->_alphaTexture->retain();
this->_hasPremultipliedAlpha = true; // PremultipliedAlpha should be true.
if (alphaTexture != nullptr)
{
alphaTexture->retain();
CC_SAFE_RELEASE(_alphaTexture);
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Old alpha texture needs to be released.

_alphaTexture = alphaTexture;
_hasPremultipliedAlpha = true; // PremultipliedAlpha should be true.
}
}

Expand Down