Merge pull request #8588 from Dhilan007/v3-label8582

fixed issue#8582: opacity of label
This commit is contained in:
minggo 2014-10-09 15:50:44 +08:00
commit b8c5ce6db3
2 changed files with 12 additions and 6 deletions

View File

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

View File

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