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

Method updateBatchNode

core/2d/Label.cpp:1165–1207  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1163}
1164
1165void Label::updateBatchNode()
1166{
1167 const std::unordered_map<unsigned int, Texture2D*>& textures = _fontAtlas->getTextures();
1168 const size_t textureCount = textures.size();
1169 const size_t nodeCount = _batchNodes.size();
1170
1171 if (textureCount > nodeCount)
1172 {
1173 _batchNodes.reserve(textureCount);
1174
1175 for (size_t index = nodeCount; index < textureCount; ++index)
1176 {
1177 SpriteBatchNode* const batchNode = SpriteBatchNode::createWithTexture(textures.at(index));
1178 if (batchNode)
1179 {
1180 _isOpacityModifyRGB = batchNode->getTexture()->hasPremultipliedAlpha();
1181 _blendFunc = batchNode->getBlendFunc();
1182 batchNode->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT);
1183 batchNode->setPosition(Vec2::ZERO);
1184 _batchNodes.pushBack(batchNode);
1185 }
1186 }
1187 }
1188 if (_batchNodes.empty())
1189 {
1190 return;
1191 }
1192
1193 // optimize for one-texture-only scenario if multiple textures, then we
1194 // should count how many chars are per texture
1195 if (textureCount == 1)
1196 _batchNodes.at(0)->reserveCapacity(_utf32Text.size());
1197
1198 _reusedLetter->setBatchNode(_batchNodes.at(0));
1199
1200 computeAlignmentOffset();
1201
1202 updateQuads();
1203
1204 updateLabelLetters();
1205
1206 updateColor();
1207}
1208
1209bool Label::computeHorizontalKernings(const std::u32string& stringToRender)
1210{

Callers

nothing calls this directly

Calls 12

updateColorFunction · 0.85
hasPremultipliedAlphaMethod · 0.80
pushBackMethod · 0.80
reserveCapacityMethod · 0.80
sizeMethod · 0.45
reserveMethod · 0.45
atMethod · 0.45
getTextureMethod · 0.45
setAnchorPointMethod · 0.45
setPositionMethod · 0.45
emptyMethod · 0.45
setBatchNodeMethod · 0.45

Tested by

no test coverage detected