mirror of https://github.com/axmolengine/axmol.git
Merge pull request #5558 from Dhilan007/develop_label
close #4276:fixed crash on CocoStudioGuiTest->LabelBMFontTest.
This commit is contained in:
commit
20146c3ecb
|
@ -826,8 +826,11 @@ void Label::setColor(const Color3B& color)
|
||||||
|
|
||||||
void Label::updateColor()
|
void Label::updateColor()
|
||||||
{
|
{
|
||||||
V3F_C4B_T2F_Quad *quads = _textureAtlas->getQuads();
|
if (nullptr == _textureAtlas)
|
||||||
auto count = _textureAtlas->getTotalQuads();
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
Color4B color4( _displayedColor.r, _displayedColor.g, _displayedColor.b, _displayedOpacity );
|
Color4B color4( _displayedColor.r, _displayedColor.g, _displayedColor.b, _displayedOpacity );
|
||||||
|
|
||||||
// special opacity for premultiplied textures
|
// special opacity for premultiplied textures
|
||||||
|
@ -837,13 +840,23 @@ void Label::updateColor()
|
||||||
color4.g *= _displayedOpacity/255.0f;
|
color4.g *= _displayedOpacity/255.0f;
|
||||||
color4.b *= _displayedOpacity/255.0f;
|
color4.b *= _displayedOpacity/255.0f;
|
||||||
}
|
}
|
||||||
for (int index=0; index<count; ++index)
|
|
||||||
|
cocos2d::TextureAtlas* textureAtlas;
|
||||||
|
V3F_C4B_T2F_Quad *quads;
|
||||||
|
for (const auto& batchNode:_batchNodes)
|
||||||
{
|
{
|
||||||
quads[index].bl.colors = color4;
|
textureAtlas = batchNode->getTextureAtlas();
|
||||||
quads[index].br.colors = color4;
|
quads = textureAtlas->getQuads();
|
||||||
quads[index].tl.colors = color4;
|
auto count = textureAtlas->getTotalQuads();
|
||||||
quads[index].tr.colors = color4;
|
|
||||||
_textureAtlas->updateQuad(&quads[index], index);
|
for (int index = 0; index < count; ++index)
|
||||||
|
{
|
||||||
|
quads[index].bl.colors = color4;
|
||||||
|
quads[index].br.colors = color4;
|
||||||
|
quads[index].tl.colors = color4;
|
||||||
|
quads[index].tr.colors = color4;
|
||||||
|
textureAtlas->updateQuad(&quads[index], index);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue