fixed opacity of label

This commit is contained in:
Dhilan007 2014-10-09 10:54:35 +08:00
parent 442f767c89
commit 462e38cbc6
2 changed files with 12 additions and 6 deletions

View File

@ -1248,13 +1248,11 @@ bool Label::isOpacityModifyRGB() const
void Label::setOpacityModifyRGB(bool isOpacityModifyRGB)
{
_isOpacityModifyRGB = isOpacityModifyRGB;
for(const auto& child: _children) {
child->setOpacityModifyRGB(_isOpacityModifyRGB);
if (isOpacityModifyRGB != _isOpacityModifyRGB)
{
_isOpacityModifyRGB = isOpacityModifyRGB;
updateColor();
}
_reusedLetter->setOpacityModifyRGB(true);
}
void Label::updateDisplayedColor(const Color3B& parentColor)

View File

@ -577,7 +577,15 @@ void SpriteBatchNode::removeSpriteFromAtlas(Sprite *sprite)
void SpriteBatchNode::updateBlendFunc(void)
{
if (! _textureAtlas->getTexture()->hasPremultipliedAlpha())
{
_blendFunc = BlendFunc::ALPHA_NON_PREMULTIPLIED;
setOpacityModifyRGB(false);
}
else
{
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
setOpacityModifyRGB(true);
}
}
// CocosNodeTexture protocol