| 1163 | } |
| 1164 | |
| 1165 | void 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 | |
| 1209 | bool Label::computeHorizontalKernings(const std::u32string& stringToRender) |
| 1210 | { |
nothing calls this directly
no test coverage detected