MCPcopy Create free account
hub / github.com/axmolengine/axmol / updateColor

Method updateColor

core/2d/Label.cpp:2594–2628  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2592}
2593
2594void Label::updateColor()
2595{
2596 if (_batchNodes.empty())
2597 {
2598 return;
2599 }
2600
2601 Color4B color4(_displayedColor.r, _displayedColor.g, _displayedColor.b, _displayedOpacity);
2602
2603 // special opacity for premultiplied textures
2604 if (_isOpacityModifyRGB)
2605 {
2606 color4.r *= _displayedOpacity / 255.0f;
2607 color4.g *= _displayedOpacity / 255.0f;
2608 color4.b *= _displayedOpacity / 255.0f;
2609 }
2610
2611 ax::TextureAtlas* textureAtlas;
2612 V3F_C4B_T2F_Quad* quads;
2613 for (auto&& batchNode : _batchNodes)
2614 {
2615 textureAtlas = batchNode->getTextureAtlas();
2616 quads = textureAtlas->getQuads();
2617 auto count = textureAtlas->getTotalQuads();
2618
2619 for (int index = 0; index < count; ++index)
2620 {
2621 quads[index].bl.colors = color4;
2622 quads[index].br.colors = color4;
2623 quads[index].tl.colors = color4;
2624 quads[index].tr.colors = color4;
2625 textureAtlas->updateQuad(quads[index], index);
2626 }
2627 }
2628}
2629
2630std::string Label::getDescription() const
2631{

Callers

nothing calls this directly

Calls 5

getTextureAtlasMethod · 0.80
getQuadsMethod · 0.80
getTotalQuadsMethod · 0.80
updateQuadMethod · 0.80
emptyMethod · 0.45

Tested by

no test coverage detected