mirror of https://github.com/axmolengine/axmol.git
Merge pull request #9567 from joewan/v3-improve-perf
fix serious performance problem of Animate.
This commit is contained in:
commit
20beb3b9e0
|
@ -2237,7 +2237,7 @@ bool Animate::initWithAnimation(Animation* animation)
|
|||
float accumUnitsOfTime = 0;
|
||||
float newUnitOfTimeValue = singleDuration / animation->getTotalDelayUnits();
|
||||
|
||||
auto frames = animation->getFrames();
|
||||
auto& frames = animation->getFrames();
|
||||
|
||||
for (auto& frame : frames)
|
||||
{
|
||||
|
@ -2312,7 +2312,7 @@ void Animate::update(float t)
|
|||
t = fmodf(t, 1.0f);
|
||||
}
|
||||
|
||||
auto frames = _animation->getFrames();
|
||||
auto& frames = _animation->getFrames();
|
||||
auto numberOfFrames = frames.size();
|
||||
SpriteFrame *frameToDisplay = nullptr;
|
||||
|
||||
|
@ -2346,7 +2346,7 @@ void Animate::update(float t)
|
|||
|
||||
Animate* Animate::reverse() const
|
||||
{
|
||||
auto oldArray = _animation->getFrames();
|
||||
auto& oldArray = _animation->getFrames();
|
||||
Vector<AnimationFrame*> newArray(oldArray.size());
|
||||
|
||||
if (oldArray.size() > 0)
|
||||
|
|
|
@ -592,12 +592,12 @@ void Label::alignText()
|
|||
batchNode->getTextureAtlas()->removeAllQuads();
|
||||
}
|
||||
_fontAtlas->prepareLetterDefinitions(_currentUTF16String);
|
||||
auto textures = _fontAtlas->getTextures();
|
||||
auto& textures = _fontAtlas->getTextures();
|
||||
if (textures.size() > _batchNodes.size())
|
||||
{
|
||||
for (auto index = _batchNodes.size(); index < textures.size(); ++index)
|
||||
{
|
||||
auto batchNode = SpriteBatchNode::createWithTexture(textures[index]);
|
||||
auto batchNode = SpriteBatchNode::createWithTexture(textures.at(index));
|
||||
batchNode->setAnchorPoint(Vec2::ANCHOR_TOP_LEFT);
|
||||
batchNode->setPosition(Vec2::ZERO);
|
||||
Node::addChild(batchNode,0,Node::INVALID_TAG);
|
||||
|
@ -630,9 +630,9 @@ void Label::alignText()
|
|||
uvRect.origin.x = _lettersInfo[tag].def.U;
|
||||
uvRect.origin.y = _lettersInfo[tag].def.V;
|
||||
|
||||
letterSprite->setTexture(textures[_lettersInfo[tag].def.textureID]);
|
||||
letterSprite->setTexture(textures.at(_lettersInfo[tag].def.textureID));
|
||||
letterSprite->setTextureRect(uvRect);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -161,14 +161,14 @@ static void printFileUtils(int fd)
|
|||
FileUtils* fu = FileUtils::getInstance();
|
||||
|
||||
mydprintf(fd, "\nSearch Paths:\n");
|
||||
auto list = fu->getSearchPaths();
|
||||
auto& list = fu->getSearchPaths();
|
||||
for( const auto &item : list) {
|
||||
mydprintf(fd, "%s\n", item.c_str());
|
||||
}
|
||||
|
||||
mydprintf(fd, "\nResolution Order:\n");
|
||||
list = fu->getSearchResolutionsOrder();
|
||||
for( const auto &item : list) {
|
||||
auto& list1 = fu->getSearchResolutionsOrder();
|
||||
for( const auto &item : list1) {
|
||||
mydprintf(fd, "%s\n", item.c_str());
|
||||
}
|
||||
|
||||
|
@ -176,7 +176,7 @@ static void printFileUtils(int fd)
|
|||
mydprintf(fd, "%s\n", fu->getWritablePath().c_str());
|
||||
|
||||
mydprintf(fd, "\nFull Path Cache:\n");
|
||||
auto cache = fu->getFullPathCache();
|
||||
auto& cache = fu->getFullPathCache();
|
||||
for( const auto &item : cache) {
|
||||
mydprintf(fd, "%s -> %s\n", item.first.c_str(), item.second.c_str());
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ void foreachNodeDescendant(Node* parent, tCallBack callback)
|
|||
{
|
||||
callback(parent);
|
||||
|
||||
auto children = parent->getChildren();
|
||||
auto& children = parent->getChildren();
|
||||
for (auto child : children)
|
||||
{
|
||||
foreachNodeDescendant(child, callback);
|
||||
|
|
|
@ -1696,7 +1696,7 @@ bool Layout::isLastWidgetInContainer(Widget* widget, FocusDirection direction)c
|
|||
return true;
|
||||
}
|
||||
|
||||
auto container = parent->getChildren();
|
||||
auto& container = parent->getChildren();
|
||||
ssize_t index = container.getIndex(widget);
|
||||
if (parent->getLayoutType() == Type::HORIZONTAL)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue