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

Method increaseAtlasCapacity

core/2d/SpriteBatchNode.cpp:440–456  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

438}
439
440void SpriteBatchNode::increaseAtlasCapacity()
441{
442 // if we're going beyond the current TextureAtlas's capacity,
443 // all the previously initialized sprites will need to redo their texture coords
444 // this is likely computationally expensive
445 ssize_t quantity = (_textureAtlas->getCapacity() + 1) * 4 / 3;
446
447 AXLOGD("SpriteBatchNode: resizing TextureAtlas capacity from [{}] to [{}].",
448 static_cast<int>(_textureAtlas->getCapacity()), static_cast<int>(quantity));
449
450 if (!_textureAtlas->resizeCapacity(quantity))
451 {
452 // serious problems
453 AXLOGW("WARNING: Not enough memory to resize the atlas");
454 AXASSERT(false, "Not enough memory to resize the atlas");
455 }
456}
457
458void SpriteBatchNode::reserveCapacity(ssize_t newCapacity)
459{

Callers 2

insertQuadFromSpriteMethod · 0.95
updateQuadFromSpriteMethod · 0.95

Calls 2

resizeCapacityMethod · 0.80
getCapacityMethod · 0.45

Tested by

no test coverage detected