mirror of https://github.com/axmolengine/axmol.git
Merge pull request #8573 from Dhilan007/v3-labelatlas
fix #8569: LabelAtlas opacity do not change when setting parent node's opacity
This commit is contained in:
commit
4b7d5694b8
|
@ -216,7 +216,15 @@ void AtlasNode::setBlendFunc(const BlendFunc &blendFunc)
|
|||
void AtlasNode::updateBlendFunc()
|
||||
{
|
||||
if( ! _textureAtlas->getTexture()->hasPremultipliedAlpha() )
|
||||
{
|
||||
_blendFunc = BlendFunc::ALPHA_NON_PREMULTIPLIED;
|
||||
setOpacityModifyRGB(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
||||
setOpacityModifyRGB(true);
|
||||
}
|
||||
}
|
||||
|
||||
void AtlasNode::setTexture(Texture2D *texture)
|
||||
|
|
|
@ -233,6 +233,12 @@ void LabelAtlas::updateColor()
|
|||
if (_textureAtlas)
|
||||
{
|
||||
Color4B color4( _displayedColor.r, _displayedColor.g, _displayedColor.b, _displayedOpacity );
|
||||
if (_isOpacityModifyRGB)
|
||||
{
|
||||
color4.r *= _displayedOpacity/255.0f;
|
||||
color4.g *= _displayedOpacity/255.0f;
|
||||
color4.b *= _displayedOpacity/255.0f;
|
||||
}
|
||||
auto quads = _textureAtlas->getQuads();
|
||||
ssize_t length = _string.length();
|
||||
for (int index = 0; index < length; index++)
|
||||
|
|
Loading…
Reference in New Issue